Re: Is there an RFC/discussion for ::class being a specific type?
| From: | Claude Pache | Date: | Tue, 16 Nov 2021 18:57:05 +0000 |
| Subject: | Re: Is there an RFC/discussion for ::class being a specific type? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-116424@lists.php.net to get a copy of this message | ||
> Le 16 nov. 2021 à 18:34, Kamil Tekiela <tekiela246@gmail.com> a écrit :
>
>
> At the moment, ::class is just a preprocessor macro. It is not part of the
> runtime.
This is not true in general. For example
static::class is not resolvable at
compile-time.
(In fact, many years ago, when I played with that new feature, I almost filed a bug report saying
that static::class is not supposed to work, since it is not resolvable at
compile-time.)
(Additionally, since PHP 8, it is also possible to write $object::class, see: https://wiki.php.net/rfc/class_name_literal_on_object
<https://wiki.php.net/rfc/class_name_literal_on_object>.
But static::class worked since 5.5.)
—Claude