1
0
Fork 0

Add more symbols to symbol test

* constants
* static properties
* static methods
pull/49/head
Felix Becker 2016-10-08 13:14:42 +02:00
parent 063c7f9ad2
commit 658a27f5a5
3 changed files with 92 additions and 11 deletions

View File

@ -2,10 +2,19 @@
namespace TestNamespace;
const TEST_CONST = 123;
class TestClass
{
const TEST_CLASS_CONST = 123;
public static $staticTestProperty;
public $testProperty;
public static function staticTestMethod()
{
}
public function testMethod($testParameter)
{
$testVariable = 123;

View File

@ -59,7 +59,7 @@ class SymbolFinder extends NodeVisitorAbstract
public function enterNode(Node $node)
{
$this->nodeStack[] = $node;
$containerName = end($this->nameStack);
$containerName = empty($this->nameStack) ? null : end($this->nameStack);
// If we enter a named node, push its name onto name stack.
// Else push the current name onto stack.

View File

@ -44,6 +44,24 @@ class TextDocumentTest extends TestCase
],
'containerName' => null
],
[
'name' => 'TEST_CONST',
'kind' => SymbolKind::CONSTANT,
'location' => [
'uri' => 'whatever',
'range' => [
'start' => [
'line' => 4,
'character' => 6
],
'end' => [
'line' => 4,
'character' => 22
]
]
],
'containerName' => 'TestNamespace'
],
[
'name' => 'TestClass',
'kind' => SymbolKind::CLASS_,
@ -51,17 +69,53 @@ class TextDocumentTest extends TestCase
'uri' => 'whatever',
'range' => [
'start' => [
'line' => 4,
'line' => 6,
'character' => 0
],
'end' => [
'line' => 12,
'line' => 21,
'character' => 1
]
]
],
'containerName' => 'TestNamespace'
],
[
'name' => 'TEST_CLASS_CONST',
'kind' => SymbolKind::CONSTANT,
'location' => [
'uri' => 'whatever',
'range' => [
'start' => [
'line' => 8,
'character' => 10
],
'end' => [
'line' => 8,
'character' => 32
]
]
],
'containerName' => 'TestNamespace\\TestClass'
],
[
'name' => 'staticTestProperty',
'kind' => SymbolKind::PROPERTY,
'location' => [
'uri' => 'whatever',
'range' => [
'start' => [
'line' => 9,
'character' => 18
],
'end' => [
'line' => 9,
'character' => 37
]
]
],
'containerName' => 'TestNamespace\\TestClass'
],
[
'name' => 'testProperty',
'kind' => SymbolKind::PROPERTY,
@ -69,17 +123,35 @@ class TextDocumentTest extends TestCase
'uri' => 'whatever',
'range' => [
'start' => [
'line' => 6,
'line' => 10,
'character' => 11
],
'end' => [
'line' => 6,
'line' => 10,
'character' => 24
]
]
],
'containerName' => 'TestNamespace\\TestClass'
],
[
'name' => 'staticTestMethod',
'kind' => SymbolKind::METHOD,
'location' => [
'uri' => 'whatever',
'range' => [
'start' => [
'line' => 12,
'character' => 4
],
'end' => [
'line' => 15,
'character' => 5
]
]
],
'containerName' => 'TestNamespace\\TestClass'
],
[
'name' => 'testMethod',
'kind' => SymbolKind::METHOD,
@ -87,11 +159,11 @@ class TextDocumentTest extends TestCase
'uri' => 'whatever',
'range' => [
'start' => [
'line' => 8,
'line' => 17,
'character' => 4
],
'end' => [
'line' => 11,
'line' => 20,
'character' => 5
]
]
@ -105,11 +177,11 @@ class TextDocumentTest extends TestCase
'uri' => 'whatever',
'range' => [
'start' => [
'line' => 14,
'line' => 23,
'character' => 0
],
'end' => [
'line' => 17,
'line' => 26,
'character' => 1
]
]
@ -123,11 +195,11 @@ class TextDocumentTest extends TestCase
'uri' => 'whatever',
'range' => [
'start' => [
'line' => 19,
'line' => 28,
'character' => 0
],
'end' => [
'line' => 22,
'line' => 31,
'character' => 1
]
]