Re: [RFC] Allow ::class on objects
| From: | Stanislav Malyshev | Date: | Tue, 14 Jan 2020 19:47:56 +0000 |
| Subject: | Re: [RFC] Allow ::class on objects | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-108129@lists.php.net to get a copy of this message | ||
Hi!
> If it could return
string, that'd be super useful!
Would it? There's no class "string". So for all purposes other than
printing out, that would be a pretty big footgun.
> 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 !
It could be useful to have generic function for describing objects, but
that's not what ::class should be doing. It should not return things
which aren't classes.
--
Stas Malyshev
smalyshev@gmail.com