wondering whether there is a reason for readonly properties in can not be initialized from global scope

anyone got a clue ?

@dgoosens
wiki.php.net/rfc/readonly_prop :
"There is currently no way to make a property readable to everyone and writeable only to the containing object, with PHP's visibility specifiers allowing all or nothing: a scope can either both read and write, or do neither. While __get and __set exist, these do not actually allow control of the same property, merely only exposing a separate property, and they are only usable for undeclared properties, which cannot be reflected and are not performant."

Sign in to participate in the conversation
PHP Community on Mastodon

Open source. Open community. We are dedicated to building and enriching the PHP community.