Re: Add support $object::class
| From: | S.A.N | Date: | Thu, 07 May 2015 15:14:44 +0000 |
| Subject: | Re: Add support $object::class | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-86133@lists.php.net to get a copy of this message | ||
> $object is not guaranteed to be an object, it could be anything (int,
> string, etc) or nothing (null). using ::class for a variable, I'd argue,
> makes for less consistency. What would the replacement be for non-object
> variables? An error, exception, or false, or string type? At least in
> "Bar::class", you'll always get a string representation of what the fully
> qualified class name resolves to.
$scalar::class === gettype($scalar)
$object::class === get_class($object)
> That said, the argument could be made that since static::class, self::class,
> and parent::class fall into the same category of potential runtime
> resolutions that $object::class too should be supported.
+1