Req #62689 [Opn]: get_callable_name function to avoid is_callable with callable type hint
| From: | cmb@php.net | Date: | Tue, 14 Apr 2015 14:37:44 +0000 |
| Subject: | Req #62689 [Opn]: get_callable_name function to avoid is_callable with callable type hint | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-192044@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62689&edit=1
ID: 62689
Updated by: cmb@php.net
Reported by: franssen dot roland at gmail dot com
Summary: get_callable_name function to avoid is_callable with
callable type hint
Status: Open
Type: Feature/Change Request
Package: Unknown/Other Function
Operating System: Ubuntu
PHP Version: 5.4.5
Block user comment: N
Private report: N
New Comment:
Using is_callable() to get the name can be simplified:
is_callable($bar, true, $name);
vs.
$name = get_callable_name($bar);
That's not much of a difference. And of course, it is possible to
to write the desired function in userland code.
Previous Comments:
------------------------------------------------------------------------
[2012-07-29 14:35:47] franssen dot roland at gmail dot com
Description:
------------
Currently the callable name can only be fetched using is_callable and a 3rd argument. However this
doesnt seem appropriate when using callable type hints..
get_callable_name (just like get_resource_type) would be in place imho.
Test script:
---------------
<?php
function foo(callable $bar) {
$name = null;
$name = is_callable($bar, true, $name);
// vs
$name = get_callable_name($bar);
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62689&edit=1