On Mon, Apr 27, 2015 at 7:18 AM, S.A.N <ua.san.a...@gmail.com> wrote: > Now this code causes an error PHP 5-7. > > PHP Parse: > Syntax error, unexpected 'class' (T_CLASS), expecting identifier > (T_STRING) or variable (T_VARIABLE) or '{' or '$' > > Do not want to use get_class($object)
Why not? Seriously, why not? ::class was added because there was no easy way to get from the symbol class name to the string representation of it (you couldn't pass it to a function, etc since it would look like a constant). So ::class is a purely compile time construct to turn a literal classname into a string representation. However, if you have a variable, there already is a way to do that at runtime: get_class. What's the problem with that where we need to further support arbitrary syntax? Note: I'm not saying we shouldn't add support. I'm just saying that it's not the same situation as with Bar::class... Anthony -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php