Open titrxw opened 3 years ago
https://github.com/laminas/laminas-code/blob/17fd2af36804f3f61788573cb70196454d6ee1d8/src/Reflection/MethodReflection.php#L230
class Test { public static function instance() { $instance = new static(); /** * @var static $instance */ return $instance; } } $reflectionClass = new \ReflectionClass(Test::class); $refectionMethod = $reflectionClass->getMethod('instance'); $methodReflection = new MethodReflection($refectionMethod->getDeclaringClass()->getName(), $refectionMethod->getName()); echo $methodReflection->getBody();
The output is “$instance = new ”
Fairly sure that we should just deprecate that whole method: token-based parsing is a mess, and there are better tools for that nowadays.
https://github.com/laminas/laminas-code/blob/17fd2af36804f3f61788573cb70196454d6ee1d8/src/Reflection/MethodReflection.php#L230
The output is “$instance = new ”