Example #1
0
 /**
  * Creates an instance of the ReflectionFunctionAbstract from a CallableObject.
  *
  * @param CallableObject $callable An instance of CallableObject.
  *
  * @return \ReflectionFunctionAbstract|null The created instance of the ReflectionFunctionAbstract.
  */
 protected function createReflection(CallableObject $callable)
 {
     $reflection = null;
     if ($callable->isFunction() || $callable->isClosure()) {
         $reflection = new ReflectionFunction($callable->get());
     }
     if ($callable->isInstanceMethod() || $callable->isClassMethod()) {
         /** @var string|object[] $rawCallable */
         $rawCallable = $callable->get();
         $reflection = new ReflectionMethod($rawCallable[0], $rawCallable[1]);
     }
     return $reflection;
 }