Nathan Rixham schreef:
> Jochem Maas wrote:
>> Nathan Rixham schreef:

...

>> try this snippet on for size:
>>
>> function test(stdClass $o) { var_dump($o); } $o = (object)1; test($o);
> 
> ahh.. you miss the point, request: "I want to type hint that my function
> can accept objects of any type, but not primatives/array"

didn't miss your point, I complete misunderstood php functionality, for
some reason I was under the impression that every object was a derivative
of stdClass ... silly me.

do think this item on your wish list is a good idea, you should be
able to typehint 'object' ... and given tat we can already typehint
'array' I see no reason that other scalar types shouldn't be typehint-able.

note that 'array' is a valid typehint (can't remember which version that
came in exactly):

php -r ' function foo(array $r) { var_dump($r); } $r = array(); foo($r);'






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to