Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Reflection\MethodReflection::extractMethodContents stumbles over a static keyword #168

Closed
downace opened this issue May 22, 2019 · 1 comment
Assignees

Comments

@downace
Copy link

downace commented May 22, 2019

When static keyword is present in method body, extractMethodContents ignores it and everything after.

Reproducible with [email protected]

Reproduction:

class X {
    public function method() {
        var_dump(static::class);
    }
}

$method = new \Zend\Code\Reflection\MethodReflection(X::class, 'method');

(new X)->method();
var_dump($method->getBody());

Output:

string(1) "X"
string(18) "
        var_dump("

self works fine, but it is not suitable in some cases.

@Ocramius
Copy link
Member

Closing due to #91 - we're deprecating all of this stuff, so I strongly endorse moving to https://github.com/Roave/BetterReflection for any method body introspection you may want to perform.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants