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: 2015-04-14 14:37 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: Open Package: Unknown/Other Function
PHP Version: 5.4.5 OS: Ubuntu
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [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.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Dec 09 04:01:25 2019 UTC