Re: [RFC] [Discussion] Typed class constants
| From: | Claude Pache | Date: | Fri, 17 Feb 2023 12:38:41 +0000 |
| Subject: | Re: [RFC] [Discussion] Typed class constants | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-119569@lists.php.net to get a copy of this message | ||
Hi Máté,
I think you didn’t understand me, so I’ll restate:
> To be exact, defining class constants with the class itself as value is already impossible:
> https://3v4l.org/J7C30
No, for some specific sort of class, namely for enum, it is absolutely possible to define a constant
with an effective type of
self: https://3v4l.org/r8Jo3
```php
enum A {
case foo;
const bar = self::foo;
}
var_dump(A::bar instanceof A); // true
```
—Claude