Re: [RFC] Allow ::class on objects
| From: | Nicolas Grekas | Date: | Thu, 09 Jan 2020 20:48:57 +0000 |
| Subject: | Re: [RFC] Allow ::class on objects | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-108075@lists.php.net to get a copy of this message | ||
> > $fooClass = Foo::class;
> > echo $foo::class; // TypeError b/c string?
>
> Yes, at least per the current proposal. Whether to allow this is listed as
> an open question.
>
I missed that part!
If it could return
string, that'd be super useful!
We have tons of lines of code that look like: is_object($foo) ?
get_class($foo) : gettype($foo)
Getting rid of them would be very sweet !
Nicolas