public function testInvokeArgsStaticForInvokedObject() { $reflectedCallable = new CallableReflection($this->getInvokedObject()); $this->assertSame(array(1, 2), $reflectedCallable->invokeArgsStatic(array('b' => 1, 'a' => 2))); }
/** * Executes a callable using dependency injection * * @param callable $call A callable to execute using dependency injection * @param mixed[] $arguments The arguments to pass to the callable * * @return mixed The return value of the callable */ public function call(callable $call, array $arguments = []) { $reflector = new CallableReflection($call); $method = $reflector->getReflector(); $values = $this->buildArguments($method, $arguments); //TODO Workaround for PHP5... if ($reflector->isStaticMethod()) { return $reflector->invokeArgsStatic($values); } return $call(...$values); }