Dear all,

Here is a new RFC for you to consider:
https://wiki.php.net/rfc/promoted_readonly_constructor_reassign

As a quick intro, my motivation for that RFC is that I find it quite
annoying that readonly properties play badly with CPP (constructor property
promotion).

Doing simple processing of any argument before assigning it to a readonly
property forces opting out of CPP.

This RFC would allow setting once a readonly property in the body of a
constructor after the property was previously (and implicitly) set using
CPP.

This allows keeping property declarations in their compact form while still
enabling validation, normalization, or conditional initialization.

Cheers,
Nicolas

Reply via email to