Re: [RFC] [Discussion] Typed class constants

From: Date: Fri, 03 Feb 2023 20:08:00 +0000
Subject: Re: [RFC] [Discussion] Typed class constants
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-119463@lists.php.net to get a copy of this message
> Le 31 janv. 2023 à 22:01, Máté Kocsis <kocsismate90@gmail.com> a écrit : > > > Please find the updated RFC here: > https://wiki.php.net/rfc/typed_class_constants. > > Regards, > Máté Hi, 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): ```php enum qux { const foo_alias = self::foo; case foo; } var_dump(qux::foo_alias); // enum(qux::foo) ``` I think that self should be allowed here, because it is meaningful. —Claude

« previous php.internals (#119463) next »