Exemplo n.º 1
0
 public function __construct(CallableObject $callable, $parameter)
 {
     $rawCallable = $callable->get();
     if ($callable->isInstanceMethod() || $callable->isClassMethod()) {
         $object = $rawCallable[0];
         $method = $rawCallable[1];
         $rawCallable = [$object, $method];
     }
     $this->parameter = new ReflectionParameter($rawCallable, $parameter);
 }
Exemplo n.º 2
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;
 }