Re: Re: Opinions / Votes Needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux