[RFC] Allow Readonly Property Defaults#22588
Conversation
| --EXPECTF-- | ||
| int(42) | ||
|
|
||
| Fatal error: Set access level of D::$prop must be omitted (as in class J) in %s on line %d |
There was a problem hiding this comment.
I don't think the test is testing what you want. $prop should be public(set) in D.
There was a problem hiding this comment.
Hey Tim, thanks for the review!
It's essentially a copy of here:
https://github.com/php/php-src/blob/master/Zend/tests/property_hooks/interface_get_set_readonly.phpt#L11
The intention was to confirm that having a default value does not change anything. You probably think it was not what I wanted to test because of the irrelevant error message? If so please check the comment in the existing test file above -- known issue, it seems.
The case you mean should be tested here:
https://github.com/php/php-src/pull/22588/changes#diff-a5f6cb0065c3c8fe569119380cdb62cb4a1a7b9813fcf3bb97723894cb262667R10
--
Fine?
There was a problem hiding this comment.
It's essentially a copy of here:
I assume that test predated asymmetric visibility. It should probably be adjusted to include public(set) (or a second test added).
The case you mean should be tested here:
No. That test is not testing the behavior of the interaction between readonly and set; in an interface.
RFC: https://wiki.php.net/rfc/readonly_property_defaults
Discussion thread: https://news-web.php.net/php.internals/131760
Voting thread: tbd