php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #62689 get_callable_name function to avoid is_callable with callable type hint
Submitted: 2012-07-29 14:35 UTC Modified: 2020-09-17 14:32 UTC
Votes:3
Avg. Score:4.0 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: franssen dot roland at gmail dot com Assigned:
Status: Suspended Package: Unknown/Other Function
PHP Version: 5.4.5 OS: Ubuntu
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: franssen dot roland at gmail dot com
New email:
PHP Version: OS:

 

 [2012-07-29 14:35 UTC] 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);
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-04-14 14:37 UTC] 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.
 [2020-09-17 14:32 UTC] cmb@php.net
-Status: Open +Status: Suspended
 [2020-09-17 14:32 UTC] cmb@php.net
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>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 00:01:29 2024 UTC