# [RFC] [Discussion] Final constants

- Thread: https://externals.io/message/114273
- Original archive: https://news-web.php.net/php.internals/114273
- Started by kocsismate90@gmail.com on 2021-05-04T15:22:00+00:00
- Messages: 4
- RFC: Final class constants (Implemented (PHP 8.1)) — https://externals.io/rfc/final_class_const.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #114273 — kocsismate90@gmail.com — 2021-05-04T15:22:00+00:00

URL: https://externals.io/message/114273#114273

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é

---

## #114488 — kocsismate90@gmail.com — 2021-05-16T13:52:10+00:00

URL: https://externals.io/message/114273#114488 · In reply to: #114273

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é

---

## #114509 — Gabriel Caruso — 2021-05-17T23:22:48+00:00

URL: https://externals.io/message/114273#114509 · In reply to: #114488

> 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()`?

---

## #114512 — Guilliam Xavier — 2021-05-18T07:41:22+00:00

URL: https://externals.io/message/114273#114512 · In reply to: #114509

On Tue, May 18, 2021 at 1:23 AM Gabriel Caruso <carusogabriel34@gmail.com>
wrote:

> 
>
> > […]
> vote
> > […]
>
>
> 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
