Re: PR 659 / #60687: directly call a callable
| From: | Sebastian Krebs | Date: | Thu, 15 May 2014 18:17:09 +0000 |
| Subject: | Re: PR 659 / #60687: directly call a callable | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-74231@lists.php.net to get a copy of this message | ||
2014-05-15 20:11 GMT+02:00 Marc Bennewitz <php@marc-bennewitz.de>:
> Hi list
>
> Since the hype-hint "callable" is out it doesn't catch if the callable
> argument is directly callable - so currently using "call_user_func[_array]"
> is a requirement.
>
> @see http://3v4l.org/OYAgk
>
> class MyClass {
> public static function test() {
> var_dump(__METHOD__);
> }
> }
>
> function call(callable $f) {
> $f();
> }
>
> call('MyClass::test');
>
> I have created a PR to make this one possible and would very like to see
> this one fixed from PHP-5.6 down to PHP-5.4 were the callable type-hint was
> added.
>
> Is there something I have to do ?
> (I'll be not available after the next week for 3 month)
Hi
I've fixed it :)
http://3v4l.org/et7MX
<?php
class MyClass {
public static function test() {
var_dump(__METHOD__);
}
}
function call(callable $f) {
$f();
}
call(['MyClass','test']);
Regards,
Sebastian
>
>
> Marc
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
github.com/KingCrunch