Fixed local variable detection and containerName generation in SymbolFinder.
parent
28d6cc6e85
commit
05fb3cfb86
|
@ -68,7 +68,7 @@ class SymbolFinder extends NodeVisitorAbstract
|
||||||
array_push($this->nameStack, (string)$node->name);
|
array_push($this->nameStack, (string)$node->name);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($node instanceof Stmt\ClassMethod) {
|
if ($node instanceof Node\Stmt\ClassMethod) {
|
||||||
array_push($this->nameStack, $containerName . '::' . (string)$node->name);
|
array_push($this->nameStack, $containerName . '::' . (string)$node->name);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -86,7 +86,7 @@ class SymbolFinder extends NodeVisitorAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we enter a method or function, increase the function counter
|
// 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++;
|
$this->functionCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ class SymbolFinder extends NodeVisitorAbstract
|
||||||
array_pop($this->nameStack);
|
array_pop($this->nameStack);
|
||||||
|
|
||||||
// if we leave a method or function, decrease the function counter
|
// 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--;
|
$this->functionCount--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ class TextDocumentTest extends TestCase
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'containerName' => null
|
'containerName' => 'TestNamespace'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'testProperty',
|
'name' => 'testProperty',
|
||||||
|
@ -78,7 +78,7 @@ class TextDocumentTest extends TestCase
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'containerName' => 'TestClass'
|
'containerName' => 'TestNamespace\\TestClass'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'testMethod',
|
'name' => 'testMethod',
|
||||||
|
@ -96,7 +96,7 @@ class TextDocumentTest extends TestCase
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'containerName' => 'TestClass'
|
'containerName' => 'TestNamespace\\TestClass'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'TestTrait',
|
'name' => 'TestTrait',
|
||||||
|
@ -114,7 +114,7 @@ class TextDocumentTest extends TestCase
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'containerName' => null
|
'containerName' => 'TestNamespace'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'TestInterface',
|
'name' => 'TestInterface',
|
||||||
|
@ -132,7 +132,7 @@ class TextDocumentTest extends TestCase
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'containerName' => null
|
'containerName' => 'TestNamespace'
|
||||||
]
|
]
|
||||||
], json_decode(json_encode($result), true));
|
], json_decode(json_encode($result), true));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue