Re: [RFC] [Discussion] `#[\Override]` for class constants
| From: | Gina P. Banyard | Date: | Tue, 31 Mar 2026 12:26:58 +0000 |
| Subject: | Re: [RFC] [Discussion] `#[\Override]` for class constants | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-130515@lists.php.net to get a copy of this message | ||
On Tuesday, 31 March 2026 at 00:45, Daniel Scherzer <daniel.e.scherzer@gmail.com> wrote:
> Hi internals,
>
> I'd like to start the discussion for a new RFC about adding support for
>
#[\Override] for class constants.
>
> * RFC: https://wiki.php.net/rfc/override_constants
> * Implementation: https://github.com/php/php-src/pull/20478
>
> I'd also like to draw specific attention to the open question, which I am soliciting
> feedback on: how should #[\Override] work for enum cases? See the
> RFC page for details.
It's impossible to override an enum case. Enums are final and cannot be extended. So just error
if someone tries to use #[\Override] on an enum case as it is non-sensical.
Best regards,
Gina P. Banyard