Re: Callable type
| From: | Johannes Schlüter | Date: | Sun, 10 Jul 2011 19:02:27 +0000 |
| Subject: | Re: Callable type | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-53802@lists.php.net to get a copy of this message | ||
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.
johannes