On 13/07/2014 17:36, Andrea Faulds wrote:
On 13 Jul 2014, at 17:29, Rowan Collins <rowan.coll...@gmail.com> wrote:

It's an interesting thought, but we currently have the object keyword for that 
particular use case. In some languages, having a base object is useful because 
functionality can be defined there, but PHP provides no way of altering 
existing classes, limiting that use too.
There’s no such type hint though:

$ php -r 'function foo(object $x) {} foo(new StdClass);’
PHP Catchable fatal error:  Argument 1 passed to foo() must be an instance of 
object, instance of stdClass given, called in Command line code on line 1 and 
defined in Command line code on line 1

Perhaps one should be added? Not in this RFC though, obviously.

Oops, my bad, I thought that existed already! :|

--
Rowan Collins
[IMSoP]


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

Reply via email to