From 4653f100a79f382c2652b613ae364d6ab2216769 Mon Sep 17 00:00:00 2001 From: Sara Itani Date: Mon, 6 Mar 2017 13:59:12 -0800 Subject: [PATCH] fix variableName symbol info, offsets in tests --- src/Protocol/TolerantSymbolInformation.php | 2 ++ tests/Server/ServerTestCase.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Protocol/TolerantSymbolInformation.php b/src/Protocol/TolerantSymbolInformation.php index 5450418..168d906 100644 --- a/src/Protocol/TolerantSymbolInformation.php +++ b/src/Protocol/TolerantSymbolInformation.php @@ -66,6 +66,8 @@ class TolerantSymbolInformation $symbol->name = $node->getName(); } else if (isset($node->name)) { $symbol->name = trim((string)$node->name->getText($node->getFileContents()), "$"); + } else if (isset($node->variableName)) { + $symbol->name = $node->variableName->getText($node); } else { return null; } diff --git a/tests/Server/ServerTestCase.php b/tests/Server/ServerTestCase.php index 93da08f..15d2338 100644 --- a/tests/Server/ServerTestCase.php +++ b/tests/Server/ServerTestCase.php @@ -149,7 +149,7 @@ abstract class ServerTestCase extends TestCase 1 => new Location($referencesUri, new Range(new Position(39, 0), new Position(39, 30))) // TestClass::$staticTestProperty[123]->testProperty; ], 'TestNamespace\\TestClass::staticTestMethod()' => [ - 0 => new Location($referencesUri, new Range(new Position( 7, 0), new Position( 7, 29))) + 0 => new Location($referencesUri, new Range(new Position( 7, 0), new Position( 7, 27))) ], 'TestNamespace\\TestClass::testMethod()' => [ 0 => new Location($referencesUri, new Range(new Position( 5, 0), new Position( 5, 18))), // $obj->testMethod(); @@ -181,7 +181,7 @@ abstract class ServerTestCase extends TestCase ], 'TestInterface' => [ 0 => new Location($globalSymbolsUri, new Range(new Position(20, 27), new Position(20, 40))), // class TestClass implements TestInterface - 1 => new Location($globalSymbolsUri, new Range(new Position(57, 48), new Position(57, 61))), // public function testMethod($testParameter): TestInterface + 1 => new Location($globalSymbolsUri, new Range(new Position(57, 49), new Position(57, 61))), // public function testMethod($testParameter) : TestInterface 2 => new Location($globalReferencesUri, new Range(new Position(33, 20), new Position(33, 33))) // if ($abc instanceof TestInterface) ], 'TestClass::TEST_CLASS_CONST' => [