1
0
Fork 0

Fixed local variable detection and containerName generation in SymbolFinder.

pull/31/head
Stephan Unverwerth 2016-09-22 23:35:06 +02:00
parent 28d6cc6e85
commit 05fb3cfb86
2 changed files with 8 additions and 8 deletions

View File

@ -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--;
}
}

View File

@ -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));
}