Ask Your Question
1

What is the explanation for the PHPDoc attributes `@property-read` and `@property-write`?

asked 2022-04-25 11:00:00 +0000

plato gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-06-07 19:00:00 +0000

lalupa gravatar image

The PHPDoc attribute @property-read is used to declare a property that can be read from outside the class, but cannot be set from outside the class. This means that the property is a read-only property.

On the other hand, @property-write is used to declare a property that can be set from outside the class, but cannot be read from outside the class. This means that the property is a write-only property.

In both cases, the property can be accessed from within the class itself. These attributes are used for documentation purposes only and do not actually change the functionality of the code.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-04-25 11:00:00 +0000

Seen: 15 times

Last updated: Jun 07 '22