Hi Internals,

I'd like to propose adding support for readonly classes:
https://wiki.php.net/rfc/readonly_classes

The implementation heavily builds on the semantics of the already accepted
readonly properties RFC (https://wiki.php.net/rfc/readonly_properties_v2),
basically the only thing I had to implement in the PR are the following:
- Any declared property of a readonly class is implicitly treated as
readonly
- Creation of dynamic properties is forbidden

Readonly classes would make it easier to declare immutable(-alike) classes,
especially if a class
contains a lot of properties. As a side-effect, one could already opt out
from dynamic properties
completely, which won't really be possible for quite some time, even if
https://wiki.php.net/rfc/deprecate_dynamic_properties passes.

Regards:
Máté

Reply via email to