3 ms·
Literally only object as new typehint, not the classname of the object? This doesn't really help much. https://wiki.php.net/rfc/object-typehint https://wiki.php
by rurban 9y ago
Literally only object as new typehint, not the classname of the object? This doesn't really help much.
https://wiki.php.net/rfc/object-typehint https://wiki.php.net/rfc/object-typehint
Looks like they went back into perl-mode
- TazeTSchnitzel 9y agoI actually have a patch and draft RFC for a classname type declaration, but I'm not sure whether to do anything with it.
- deleted 9y ago[deleted]
- pgl 9y agoYou can do this in methods by putting the class name before the argument.
- tylerjwilk00 9y agoClass based type hinting has already been available since 2004 with 5.0 [1] This release adds support for the general standard object type. [1] http://php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration http://php.net/manual/en/functions.arguments.php#functions.a...
- rurban 9y agoOk, that makes sense. Thanks
- Belphemur 9y agoYou can already type name your classes and even primitive type. You don't have only "object".
- Can_Not 9y agoPreviously you could only specify class names and interfaces, now you can specify object (any object of any class, including StdClass). Mostly only a way to type hint "not array or any scalars". The class names has been around a while and is usually way more useful.