Req #62689 [Opn->Sus]: get_callable_name function to avoid is_callable with callable type hint

From: Date: Thu, 17 Sep 2020 14:32:05 +0000
Subject: Req #62689 [Opn->Sus]: 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-229051@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 +Status: Suspended 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: If you're still interested in having get_callable_name(), please forward this request to the internals mailing list[1], since this feature needs to be discussed (besides that it's trivial to implement the function in userland, the name wouldn't fit to our naming scheme). Thanks! For the time being, I'm suspending this ticket. [1] <https://www.php.net/mailing-lists.php#internals> Previous Comments: ------------------------------------------------------------------------ [2015-04-14 14:37:44] cmb@php.net 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. ------------------------------------------------------------------------ [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

« previous php.bugs (#229051) next »