Re: Callable typehint
| From: | Chris Stockton | Date: | Mon, 06 Jun 2011 22:52:57 +0000 |
| Subject: | Re: Callable typehint | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-53097@lists.php.net to get a copy of this message | ||
Hello,
On Mon, Jun 6, 2011 at 3:51 PM, Chris Stockton
<chrisstocktonaz@gmail.com> wrote:
> Hello,
>
> On Mon, Jun 6, 2011 at 12:41 PM, Hannes Magnusson
> <hannes.magnusson@gmail.com> wrote:
>> Hi
>>
>> As quickly mentioned in the '$arr = array('Hello', 'world');
>> $arr();'
>> thread[1], we are hitting the need for a callable typehint.
>>
>
> This brings a clear and concise enhancement to PHP which I would
> benefit from .I have been watching our API provide more and more
> functions with callbacks as arguments and it would be nice to have a
> specific type for those to clean up the is_callable error handling.
>
> It is my opinion that comparing it to previous type hinting proposals
> is like comparing apples and oranges. I think it falls in align
> justification wise between Class Name and Array type hints.
>
> I.E.
> function test1(StdClass $p) ..
> function test2(Closure $p) ... <== doesn't this seem more justified
> then "Array" given the argument of previous type hinting proposals?
> function test3(Array $arr)
>
> +1 from me
>
> -Chris
>
s/Closure/Callable/g