Re: Class Constant Finalization
| From: | Stanislav Malyshev | Date: | Wed, 25 Jan 2017 08:14:11 +0000 |
| Subject: | Re: Class Constant Finalization | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-97954@lists.php.net to get a copy of this message | ||
Hi!
>> Given that we can now declare a class constant as public, protected, or
>> private, can we also declare them final in 7.2?
>
> That doesn't make much sense to me. Constant belongs to a class. I don't
> see much utility in "no class extending from this one can define
> constant with the same name". final makes sense when the alternative is
> override, and you want to exclude it. But since there's no override
> here, no point to exclude anything.
Adding to this, you kind of can simulate it with static::, as Nikita
described, but if you go as far, you probably know what you're doing and
then you should be allowed to do it. Not that I see much point in doing
it, but if you want to...
--
Stas Malyshev
smalyshev@gmail.com