Re: Callable typehint
| From: | Derick Rethans | Date: | Mon, 06 Jun 2011 23:31:08 +0000 |
| Subject: | Re: Callable typehint | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-53110@lists.php.net to get a copy of this message | ||
On Mon, 6 Jun 2011, Matthew Weier O'Phinney wrote:
> The point, though, is that with such a typehint available, we can
> reduce boilerplate code like the following:
>
> public function addCallback($callback)
> {
> if (!is_callback($callback)) {
> throw new InvalidArgumentException();
> }
>
> The typehint makes this simpler:
>
> public function addCallback(callback $callback)
>
> which allows us to rely on PHP's native error handling. I, for one,
> would love to see this.
That's the same reason why I wanted scalar type hints....
cheers,
Derick
--
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug