2011/7/11 Hannes Magnusson <[email protected]>:
> 2011/7/10 Johannes Schlüter <[email protected]>:
>> Hi,
>>
>> On Wed, 2011-06-08 at 12:04 +0200, Johannes Schlüter wrote:
>>>
>>> Having the behavior cleared I wonder how useful it is in practical
>>> terms. A class type hint guarantees me I can do a specific call to
>>> methods defined in the class/interface. The proposed type hint tells
>>> me
>>> I can call it in some way. It won't ensure that the signature is
>>> compatible with what I expect.
>>>
>>> function foo(callable $cb) {
>>> $cb();
>>> }
>>> foo("strpos"); // This one in fact is illegal but won't be
>>> prevented
>>>
>>> But maybe this doesn't matter as type hints purely serve documentation
>>> (as E_RECOVERABLE are useless unless we make them Exceptions ...)
>>> while
>>> even for documentation purpose more information is needed.
>>
>> Any comments to this? - I didn't see an answer before the votes were
>> opened.
>>
>
> Voting is open on this? I don't think I ever had the time to integrate
> all the Q&A from this thread to the RFC.
The related vote is in the "Voting for 5.4 features" vote [1], which
asks "do we want to include this feature in 5.4 release?" (and oddly,
a preferred choice of callback/callable/neither). Voting on the RFC
itself, the implementation details and such, will obviously be your
call. Whether it makes sense to say "yes we want this in 5.4" before a
more general vote on the RFC itself ("yes, we want this"), I'm not
sure.
[1] https://wiki.php.net/todo/php54/vote
>
> If you typehint on Closure, you don't know if it takes 0 or 10
> parameters either.
> I don't think that is the point to know that either.
>
> -Hannes
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>