> Hi,
> The RFC talks only about global constants. What about class constants? It
is somewhat
> cumbersome to get a mutable object in this position, but it is
nevertheless possible, and,
> at least for consistency, it should be ensured that they are treated the
same way as global constants:
> https://3v4l.org/QhM1L
Hi Claude,
Good point, thanks. I've extended the implementation so they're handled the
same way; both forms
from your example now work:
c::o->b = 42;
$c::o->b = 42;
One consequence worth flagging: enum cases are class constants, so
unset(Enum::Case->value)
(and writes to readonly case properties) now raise the regular runtime
readonly-property Error instead of
the old compile-time "temporary expression" error, i.e. identical to $x =
Enum::Case; unset($x->value);.
Enum case properties remain immutable.
I've updated the PR (#20903) and bumped the RFC
<https://wiki.php.net/rfc/const_object_property_write> to v0.3 to cover
this. Since it widens the scope,
I'll restart the discussion cooldown and push the vote date back
accordingly.
Best regards,
__
*Khaled Alam*
On Mon, Jun 22, 2026 at 12:01 AM Claude Pache <claude.pache@gmail.com>
wrote: