diff --git a/src/SymbolFinder.php b/src/SymbolFinder.php index 58fc695..e185d3e 100644 --- a/src/SymbolFinder.php +++ b/src/SymbolFinder.php @@ -68,7 +68,7 @@ class SymbolFinder extends NodeVisitorAbstract array_push($this->nameStack, (string)$node->name); } else { - if ($node instanceof Stmt\ClassMethod) { + if ($node instanceof Node\Stmt\ClassMethod) { array_push($this->nameStack, $containerName . '::' . (string)$node->name); } else { @@ -86,7 +86,7 @@ class SymbolFinder extends NodeVisitorAbstract } // if we enter a method or function, increase the function counter - if ($node instanceof Stmt\Function_ || $node instanceof Stmt\ClassMethod) { + if ($node instanceof Node\Stmt\Function_ || $node instanceof Node\Stmt\ClassMethod) { $this->functionCount++; } @@ -117,7 +117,7 @@ class SymbolFinder extends NodeVisitorAbstract array_pop($this->nameStack); // if we leave a method or function, decrease the function counter - if ($node instanceof Function_ || $node instanceof ClassMethod) { + if ($node instanceof Node\Stmt\Function_ || $node instanceof Node\Stmt\ClassMethod) { $this->functionCount--; } } diff --git a/tests/Server/TextDocumentTest.php b/tests/Server/TextDocumentTest.php index f227fe8..0be1e27 100644 --- a/tests/Server/TextDocumentTest.php +++ b/tests/Server/TextDocumentTest.php @@ -60,7 +60,7 @@ class TextDocumentTest extends TestCase ] ] ], - 'containerName' => null + 'containerName' => 'TestNamespace' ], [ 'name' => 'testProperty', @@ -78,7 +78,7 @@ class TextDocumentTest extends TestCase ] ] ], - 'containerName' => 'TestClass' + 'containerName' => 'TestNamespace\\TestClass' ], [ 'name' => 'testMethod', @@ -96,7 +96,7 @@ class TextDocumentTest extends TestCase ] ] ], - 'containerName' => 'TestClass' + 'containerName' => 'TestNamespace\\TestClass' ], [ 'name' => 'TestTrait', @@ -114,7 +114,7 @@ class TextDocumentTest extends TestCase ] ] ], - 'containerName' => null + 'containerName' => 'TestNamespace' ], [ 'name' => 'TestInterface', @@ -132,7 +132,7 @@ class TextDocumentTest extends TestCase ] ] ], - 'containerName' => null + 'containerName' => 'TestNamespace' ] ], json_decode(json_encode($result), true)); }