54 throw new \InvalidArgumentException(
'Not a valid callable');
57 if (!self::$patched) {
58 self::$patched =
true;
61 if (version_compare(PHP_VERSION,
'5.6.0',
'>=') &&
62 function_exists(
'runkit_method_redefine')) {
63 runkit_method_redefine(
67 'return call_user_func_array($this->callableObj, $args);' 79 $this->callableObj = $callable;
99 foreach ($args as &$arg) {
102 return call_user_func_array($this->callableObj, $newArgs);
108 return call_user_func_array($this->callableObj, func_get_args());
120 $parts = explode(
'::', $this->representation);
123 if (count($parts) == 1) {
124 return new \ReflectionFunction($this->callableObj);
128 if (!is_array($this->callableObj)) {
129 $callable = array($this->callableObj, $parts[1]);
133 return new \ReflectionMethod($callable[0], $callable[1]);
$callableObj
Inner callable object, as used by PHP.
static $patched
Work-around for __invoke() with references in PHP 5.6.0+.
Interface for something that can be called.
$representation
Human representation of the inner callable.
Class used to represent anything that is callable.