- var_dump: documentation ( source)
<?php
namespace Name\Space;
class Foo
{
public static function bar()
{
}
}
function foo()
{
return $this;
}
$reflection2 = new \ReflectionFunction((new \ReflectionMethod(__NAMESPACE__ . '\\Foo', 'bar'))->getClosure()->bindTo(new \stdClass(),
__NAMESPACE__ .'\\foo'));
//$reflection = new \ReflectionMethod('Name\\Space\\Foo', 'bar');
//$closure = $reflection->getClosure(null);
//$reflection2 = new \ReflectionFunction($closure);
var_dump((string)$reflection2);
/* echo PHP_EOL;
echo PHP_EOL;
$ReflectionClass = get_class($reflection2);
$ReflectionCeption = new \ReflectionClass($ReflectionClass);
foreach ($ReflectionCeption->getMethods(\ReflectionMethod::IS_PUBLIC) as $Method) {
if(!$Method->isStatic() && $Method->getNumberOfParameters() === 0) {
echo sprintf('%s::%s(): ', $ReflectionClass, $Method->name);
var_dump($Method->invoke($reflection2));
echo PHP_EOL;
}
}*/