- var_dump: documentation ( source)
<?php
class MyMethod extends \ReflectionMethod {
public function hasPrototype() {
try {
parent::getPrototype();
return true;
}
catch (\ReflectionException $e) {
return false;
}
}
public function getPrototype() {
return $this->hasPrototype() ? parent::getPrototype() : "Method {$this->getName()} does not have a prototype";
}
}
trait TestTrait
{
public function getKernel()
{
}
}
class BaseTest
{
public function getKernel()
{
}
}
class Test extends BaseTest
{
use TestTrait;
}
$refl = new MyMethod('Test', 'getKernel');
var_dump($refl->getPrototype());
var_dump($refl->getPrototype()->getPrototype()->getPrototype()->getPrototype()->getPrototype()->getPrototype()->getPrototype()->getPrototype()->getPrototype()->getPrototype()->getPrototype());