Mantis - Quercus
Viewing Issue Advanced Details
5827 minor always 11-18-14 01:56 11-18-14 01:56
maxnoe  
 
normal  
new 4.0.36  
open  
none    
none  
0005827: ReflectionMethod alternative constructor not supported
According to the php.net documentation, two constructors are supported for ReflectionMethod:

  public ReflectionMethod::__construct ( mixed $class , string $name )

and

  public ReflectionMethod::__construct ( string $class_method )

Only the first one works.
== Steps to reproduce
Run the following code (http://3v4l.org/QoTPn): [^]

  <?php

  class AClass {
    static function aFunction() {
      $method = new \ReflectionMethod(__METHOD__);
      echo $method->getName();
    }
  }

  AClass::aFunction();

== Expected
aFunction

== Actual
Warning: function '__construct' has 2 required arguments, but only 1 were provided

== Additional info
The equivalent form works fine:
$method = new \ReflectionMethod(__CLASS__, __FUNCTION__);

There are no notes attached to this issue.