facebookarchive / pfff

Tools for code analysis, visualizations, or style-preserving source transformation.
http://github.com/facebook/pfff/wiki/Main
Other
2.44k stars 204 forks source link

sgrep cannot identify calls to a static method within the same class #128

Closed sjparkinson closed 7 years ago

sjparkinson commented 9 years ago

I have the following situation:

class A
{
    public static function methodOne() {}

    public function methodTwo() {
        self::methodOne();
    }
}

I was somewhat expecting sgrep -e 'A::methodOne()' . to identify the call to methodOne in class A, but it did not.

Is this perhaps something worth implementing?

sgrep version: 0.29

aryx commented 9 years ago

It would be nice indeed, but sgrep works mostly at a local syntactical level. To be able to resolve static calls requires more global analysis, because there could be another file b.php with class B extends A { .... self::methodOne() } that actually should also be considered a static call to A::methodOne.