Hi Sebastian,

Sebastian Bergmann wrote:
Is it intentional that the DOUBLE_COLON operator can be used on a
variable that contains a reference to an object?

I assume so. It wouldn't be the only place that accepts either a class name or an object of that class.

I think that using :: on a variable that contains an object should not
"fall back" to a static access on the object's class. Instead the
runtime should error out.

What do you think?

I would oppose this; I think it would make PHP less consistent, and as Rowan noted, it's useful for accessing constants of the appropriate class associated to an object.

Thanks!
--
Andrea Faulds
https://ajf.me/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to