Skip to content

Commit

Permalink
Allow reflection helper to invoke static methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddieajau authored and LouisLandry committed Mar 8, 2012
1 parent ce24558 commit c963a30
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/core/reflection/reflection.php
Expand Up @@ -72,14 +72,16 @@ public static function invoke($object, $methodName)
// Remove the method name from the argument list.
array_shift($args);
array_shift($args);
array_unshift($args, $object);
// array_unshift($args, $object);

$refl = new ReflectionClass($object);

$method = $refl->getMethod($methodName);
$method = new ReflectionMethod($object, $methodName);
$method->setAccessible(true);

return call_user_func_array(array($method, 'invoke'), $args);
$result = $method->invokeArgs(is_object($object) ? $object : null, $args);

return $result;

// return call_user_func_array(array($method, 'invoke'), $args);
}

/**
Expand Down

0 comments on commit c963a30

Please sign in to comment.