Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MethodReflection getBody() is incomplete #96

Open
titrxw opened this issue Sep 3, 2021 · 1 comment
Open

MethodReflection getBody() is incomplete #96

titrxw opened this issue Sep 3, 2021 · 1 comment
Labels
Bug Something isn't working

Comments

@titrxw
Copy link

titrxw commented Sep 3, 2021

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 ”

@Ocramius
Copy link
Member

Ocramius commented Sep 3, 2021

Fairly sure that we should just deprecate that whole method: token-based parsing is a mess, and there are better tools for that nowadays.

@Ocramius Ocramius added the Bug Something isn't working label Sep 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants