>
> My point is actually what’s your scenario for a final constant? If you
> want to make sure the value you access are not changed by child class,
> `self::` can serve the purpose already. If you want to make sure


 Yes, my intention is to actually make class constant overriding impossible
when it is desired. You can't really achieve this with only using self::,
since you can only control your own code. Yes, I know that child classes
could still declare a new class constant to overcome this limitation, but
at least there will be no doubt what they should expect if they try to
override the constant value. Otherwise, they have to check whether the
parent class uses self:: or static:: calls.

I  agree we should fix the weird behavior but that’s another topic.


No, I believe it isn't. Currently, only interface constants are not
(directly) overridable. If we simply made all class/interface constans
overridable, then one could not retain the original behavior in case of
interfaces. While the solution offered by my proposal wouldn't be
compatible with older PHP versions, it's still better to offer the
possibility than not doing anything.

Regards:
Máté

Reply via email to