Re: [RFC] [Discussion] Typed class constants
| From: | Máté Kocsis | Date: | Fri, 17 Feb 2023 08:13:53 +0000 |
| Subject: | Re: [RFC] [Discussion] Typed class constants | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-119567@lists.php.net to get a copy of this message | ||
Hi Claude,
The RFC states that it is technically not possible to have a constant of
> effective type
static or self.
> While this is probably correct for
> regular classes, this is not true for enums. The following code ostensibly
> works (https://3v4l.org/84W92):
>
To be exact, defining class constants with the class itself as value is
already impossible: https://3v4l.org/J7C30 So this isn't
really a
limitation imposed by the current RFC, but a new yet mentioned restriction
of
https://wiki.php.net/rfc/new_in_initializers.
I'll try to make this clear
in the RFC text.
Since the discussion has been settled for quite a long time, I'd like to
start the vote in the second half of next week, unless new concerns are
brought up. So it's time to review the RFC carefully :)
Máté