Re: [PHP-DEV] [RFC] [Draft] Final constants

2021-04-21 Thread Christian Schneider
Am 21.04.2021 um 17:08 schrieb Andreas Leathley : > On 21.04.21 15:14, Christian Schneider wrote: >> I never really understood the desire to restrict how people can use >> your code. >> If there is no good reason to override the value of a class constant people >> won't do it. >> If there might be

Re: [PHP-DEV] [RFC] [Draft] Final constants

2021-04-21 Thread Andreas Leathley
On 21.04.21 15:14, Christian Schneider wrote: I never really understood the desire to restrict how people can use your code. If there is no good reason to override the value of a class constant people won't do it. If there might be a good reason (even one you as the original designer didn't pre

Re: [PHP-DEV] [RFC] [Draft] Final constants

2021-04-21 Thread Christian Schneider
Am 21.04.2021 um 14:25 schrieb Máté Kocsis : >> 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 actual

Re: [PHP-DEV] [RFC] [Draft] Final constants

2021-04-21 Thread Máté Kocsis
> > 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 i

RE: [PHP-DEV] [RFC] [Draft] Final constants

2021-04-21 Thread CHU Zhaowei
Can I ask why you use late static binding while you don't want your constant value to be changed/overridden by child classes? IMHO, `self::FOO` is all you need. Personally, I don't use late static binding with class constants since the coding standard rule I previously referenced forbids this,

Re: [PHP-DEV] [RFC] [Draft] Final constants

2021-04-20 Thread Máté Kocsis
> > Can I ask why you use late static binding while you don't want your > constant value to be changed/overridden by child classes? IMHO, `self::FOO` > is all you need. > Personally, I don't use late static binding with class constants since the coding standard rule I previously referenced forbids

RE: [PHP-DEV] [RFC] [Draft] Final constants

2021-04-19 Thread CHU Zhaowei
rnals List Subject: [PHP-DEV] [RFC] [Draft] Final constants Hi Internals, I've recently realized that class constant values cannot always be trusted when late static binding is involved (e.g. static::FOO or $this::FOO), since they can be freely overridden in child classes. That's

Re: [PHP-DEV] [RFC] [Draft] Final constants

2021-04-18 Thread Nikita Popov
On Sun, Apr 18, 2021 at 4:20 PM Máté Kocsis wrote: > Hi Internals, > > I've recently realized that class constant values cannot always be trusted > when late static binding is involved (e.g. static::FOO or $this::FOO), > since they can be freely overridden in child classes. That's why the engine

[PHP-DEV] [RFC] [Draft] Final constants

2021-04-18 Thread Máté Kocsis
Hi Internals, I've recently realized that class constant values cannot always be trusted when late static binding is involved (e.g. static::FOO or $this::FOO), since they can be freely overridden in child classes. That's why the engine knows neither the type and the value before run-time. Doctrin