Hi Everyone,
I've just written an RFC for final constants:
https://wiki.php.net/rfc/final_class_const. The prior thread can be found
at https://externals.io/message/114066
In my opinion, the main value proposition of this RFC are the following:
- people can make their intention more clear that a constant shouldn't be
overridden - it can help fix an inconsistency in the language
- the engine can infer the value of a constant in case of references via
late static binding
Máté
As I've fully finished the implementation, I intend to bring this to a vote
on Wednesday if no new concerns come up (besides the usual question about
the usefulness of the feature).
Máté
As I've fully finished the implementation, I intend to bring this to a vote
on Wednesday if no new concerns come up (besides the usual question about
the usefulness of the feature).Máté
Interesting RFC Maté, thanks for bringing it.
How would we know if a given constant is overwritable?
Would we need something like ReflectionConstant::isOverwritable()
?
On Tue, May 18, 2021 at 1:23 AM Gabriel Caruso carusogabriel34@gmail.com
wrote:
As I've fully finished the implementation, I intend to bring this to a
vote
on Wednesday if no new concerns come up (besides the usual question about
the usefulness of the feature).Máté
Interesting RFC Maté, thanks for bringing it.
How would we know if a given constant is overwritable?
Would we need something like
ReflectionConstant::isOverwritable()
?
Hi Gabriel, see https://wiki.php.net/rfc/final_class_const#reflection
A
ReflectionClassConstant::isFinal()
method is added in order to be
able to retrieve if a constant is final.
Regards =)
--
Guilliam Xavier