1
0
Fork 0

Merge remote-tracking branch 'upstream/master' into tolerant

pull/357/head
roblou 2017-05-19 11:25:26 -07:00
commit 552d99e95c
22 changed files with 422 additions and 86 deletions

View File

@ -180,7 +180,7 @@ Example:
- [VS Code PHP IntelliSense](https://github.com/felixfbecker/vscode-php-intellisense) - [VS Code PHP IntelliSense](https://github.com/felixfbecker/vscode-php-intellisense)
- [Eclipse Che](https://eclipse.org/che/) - [Eclipse Che](https://eclipse.org/che/)
- [Eclipse IDE (LSP4E-PHP)](https://github.com/eclipselabs/lsp4e-php) - [Eclipse IDE (LSP4E-PHP)](https://github.com/eclipselabs/lsp4e-php)
- [Neovim (nvim-cm-php-language-server)](https://github.com/roxma/nvim-cm-php-language-server) - NeoVim: [LanguageServer-php-neovim](https://github.com/roxma/LanguageServer-php-neovim) with [LanguageClient neovim](https://github.com/autozimu/LanguageClient-neovim)
## Contributing ## Contributing

View File

@ -28,7 +28,7 @@
}, },
"require": { "require": {
"php": ">=7.0", "php": ">=7.0",
"nikic/php-parser": "^3.0.4", "nikic/php-parser": "^3.0.5",
"phpdocumentor/reflection-docblock": "^3.0", "phpdocumentor/reflection-docblock": "^3.0",
"sabre/event": "^5.0", "sabre/event": "^5.0",
"felixfbecker/advanced-json-rpc": "^2.0", "felixfbecker/advanced-json-rpc": "^2.0",

View File

@ -0,0 +1,23 @@
<?php
namespace HELLO {
/**
* Does something really cool!
*/
function world() {
}
\HE
}
namespace {
/**
* Lorem ipsum dolor sit amet.
*/
define('HELLO', true);
HELLO\world();
}

View File

@ -98,3 +98,10 @@ new class {
}; };
class ChildClass extends TestClass {} class ChildClass extends TestClass {}
/**
* Lorem ipsum dolor sit amet, consectetur.
*/
define('TEST_DEFINE_CONSTANT', false);
print TEST_DEFINE_CONSTANT ? 'true' : 'false';

View File

@ -98,3 +98,8 @@ new class {
}; };
class ChildClass extends TestClass {} class ChildClass extends TestClass {}
class Example {
public function __construct() {}
public function __destruct() {}
}

View File

@ -12,6 +12,6 @@
</whitelist> </whitelist>
</filter> </filter>
<php> <php>
<ini name="memory_limit" value="1500M"/> <ini name="memory_limit" value="256M"/>
</php> </php>
</phpunit> </phpunit>

View File

@ -89,7 +89,14 @@ class DefinitionResolver
} else { } else {
$docBlock = $node->getAttribute('docBlock'); $docBlock = $node->getAttribute('docBlock');
if ($docBlock !== null) { if ($docBlock !== null) {
return $docBlock->getSummary(); // check wether we have a description, when true, add a new paragraph
// with the description
$description = $docBlock->getDescription()->render();
if (empty($description)) {
return $docBlock->getSummary();
}
return $docBlock->getSummary() . "\n\n" . $description;
} }
} }
} }
@ -416,7 +423,7 @@ class DefinitionResolver
// Cannot get type for dynamic function call // Cannot get type for dynamic function call
return new Types\Mixed; return new Types\Mixed;
} }
$fqn = (string)($expr->getAttribute('namespacedName') ?? $expr->name); $fqn = (string)($expr->getAttribute('namespacedName') ?? $expr->name) . '()';
$def = $this->index->getDefinition($fqn, true); $def = $this->index->getDefinition($fqn, true);
if ($def !== null) { if ($def !== null) {
return $def->type; return $def->type;
@ -698,6 +705,19 @@ class DefinitionResolver
*/ */
public function getTypeFromNode($node) public function getTypeFromNode($node)
{ {
if (
$node instanceof Node\Expr\FuncCall
&& $node->name instanceof Node\Name
&& strtolower((string)$node->name) === 'define'
&& isset($node->args[0])
&& $node->args[0]->value instanceof Node\Scalar\String_
&& isset($node->args[1])
) {
// constants with define() like
// define('TEST_DEFINE_CONSTANT', false);
return $this->resolveExpressionNodeToType($node->args[1]->value);
}
if ($node instanceof Node\Param) { if ($node instanceof Node\Param) {
// Parameters // Parameters
$docBlock = $node->getAttribute('parentNode')->getAttribute('docBlock'); $docBlock = $node->getAttribute('parentNode')->getAttribute('docBlock');
@ -856,6 +876,16 @@ class DefinitionResolver
} }
return (string)$class->namespacedName . '::' . $node->name; return (string)$class->namespacedName . '::' . $node->name;
} }
} else if (
$node instanceof Node\Expr\FuncCall
&& $node->name instanceof Node\Name
&& strtolower((string)$node->name) === 'define'
&& isset($node->args[0])
&& $node->args[0]->value instanceof Node\Scalar\String_
&& isset($node->args[1])
) {
return (string)$node->args[0]->value->value;
} }
return null;
} }
} }

View File

@ -117,7 +117,7 @@ class Index implements ReadableIndex, \Serializable
* Registers a definition * Registers a definition
* *
* @param string $fqn The fully qualified name of the symbol * @param string $fqn The fully qualified name of the symbol
* @param string $definition The Definition object * @param Definition $definition The Definition object
* @return void * @return void
*/ */
public function setDefinition(string $fqn, Definition $definition) public function setDefinition(string $fqn, Definition $definition)

View File

@ -248,6 +248,7 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher
} }
if ($this->workspace === null) { if ($this->workspace === null) {
$this->workspace = new Server\Workspace( $this->workspace = new Server\Workspace(
$this->client,
$this->projectIndex, $this->projectIndex,
$dependenciesIndex, $dependenciesIndex,
$sourceIndex, $sourceIndex,

View File

@ -20,4 +20,14 @@ class FileEvent
* @var int * @var int
*/ */
public $type; public $type;
/**
* @param string $uri
* @param int $type
*/
public function __construct(string $uri, int $type)
{
$this->uri = $uri;
$this->type = $type;
}
} }

View File

@ -50,9 +50,20 @@ class SymbolInformation
{ {
$parent = $node->getAttribute('parentNode'); $parent = $node->getAttribute('parentNode');
$symbol = new self; $symbol = new self;
if ($node instanceof Node\Stmt\Class_) {
$symbol->kind = SymbolKind::CLASS_; if (
} else if ($node instanceof Node\Stmt\Trait_) { $node instanceof Node\Expr\FuncCall
&& $node->name instanceof Node\Name
&& strtolower((string)$node->name) === 'define'
&& isset($node->args[0])
&& $node->args[0]->value instanceof Node\Scalar\String_
&& isset($node->args[1])
) {
// constants with define() like
// define('TEST_DEFINE_CONSTANT', false);
$symbol->kind = SymbolKind::CONSTANT;
$symbol->name = (string)$node->args[0]->value->value;
} else if ($node instanceof Node\Stmt\Class_ || $node instanceof Node\Stmt\Trait_) {
$symbol->kind = SymbolKind::CLASS_; $symbol->kind = SymbolKind::CLASS_;
} else if ($node instanceof Node\Stmt\Interface_) { } else if ($node instanceof Node\Stmt\Interface_) {
$symbol->kind = SymbolKind::INTERFACE; $symbol->kind = SymbolKind::INTERFACE;
@ -60,6 +71,8 @@ class SymbolInformation
$symbol->kind = SymbolKind::NAMESPACE; $symbol->kind = SymbolKind::NAMESPACE;
} else if ($node instanceof Node\Stmt\Function_) { } else if ($node instanceof Node\Stmt\Function_) {
$symbol->kind = SymbolKind::FUNCTION; $symbol->kind = SymbolKind::FUNCTION;
} else if ($node instanceof Node\Stmt\ClassMethod && ($node->name === '__construct' || $node->name === '__destruct')) {
$symbol->kind = SymbolKind::CONSTRUCTOR;
} else if ($node instanceof Node\Stmt\ClassMethod) { } else if ($node instanceof Node\Stmt\ClassMethod) {
$symbol->kind = SymbolKind::METHOD; $symbol->kind = SymbolKind::METHOD;
} else if ($node instanceof Node\Stmt\PropertyProperty) { } else if ($node instanceof Node\Stmt\PropertyProperty) {
@ -78,17 +91,21 @@ class SymbolInformation
} else { } else {
return null; return null;
} }
if ($node instanceof Node\Name) {
$symbol->name = (string)$node; if (!isset($symbol->name)) {
} else if ($node instanceof Node\Expr\Assign || $node instanceof Node\Expr\AssignOp) { if ($node instanceof Node\Name) {
$symbol->name = $node->var->name; $symbol->name = (string)$node;
} else if ($node instanceof Node\Expr\ClosureUse) { } else if ($node instanceof Node\Expr\Assign || $node instanceof Node\Expr\AssignOp) {
$symbol->name = $node->var; $symbol->name = $node->var->name;
} else if (isset($node->name)) { } else if ($node instanceof Node\Expr\ClosureUse) {
$symbol->name = (string)$node->name; $symbol->name = $node->var;
} else { } else if (isset($node->name)) {
return null; $symbol->name = (string)$node->name;
} else {
return null;
}
} }
$symbol->location = Location::fromNode($node); $symbol->location = Location::fromNode($node);
if ($fqn !== null) { if ($fqn !== null) {
$parts = preg_split('/(::|->|\\\\)/', $fqn); $parts = preg_split('/(::|->|\\\\)/', $fqn);

View File

@ -5,7 +5,15 @@ namespace LanguageServer\Server;
use LanguageServer\{LanguageClient, Project, PhpDocumentLoader}; use LanguageServer\{LanguageClient, Project, PhpDocumentLoader};
use LanguageServer\Index\{ProjectIndex, DependenciesIndex, Index}; use LanguageServer\Index\{ProjectIndex, DependenciesIndex, Index};
use LanguageServer\Protocol\{SymbolInformation, SymbolDescriptor, ReferenceInformation, DependencyReference, Location}; use LanguageServer\Protocol\{
FileChangeType,
FileEvent,
SymbolInformation,
SymbolDescriptor,
ReferenceInformation,
DependencyReference,
Location
};
use Sabre\Event\Promise; use Sabre\Event\Promise;
use function Sabre\Event\coroutine; use function Sabre\Event\coroutine;
use function LanguageServer\{waitForEvent, getPackageName}; use function LanguageServer\{waitForEvent, getPackageName};
@ -15,6 +23,11 @@ use function LanguageServer\{waitForEvent, getPackageName};
*/ */
class Workspace class Workspace
{ {
/**
* @var LanguageClient
*/
public $client;
/** /**
* The symbol index for the workspace * The symbol index for the workspace
* *
@ -43,14 +56,16 @@ class Workspace
public $documentLoader; public $documentLoader;
/** /**
* @param LanguageClient $client LanguageClient instance used to signal updated results
* @param ProjectIndex $index Index that is searched on a workspace/symbol request * @param ProjectIndex $index Index that is searched on a workspace/symbol request
* @param DependenciesIndex $dependenciesIndex Index that is used on a workspace/xreferences request * @param DependenciesIndex $dependenciesIndex Index that is used on a workspace/xreferences request
* @param DependenciesIndex $sourceIndex Index that is used on a workspace/xreferences request * @param DependenciesIndex $sourceIndex Index that is used on a workspace/xreferences request
* @param \stdClass $composerLock The parsed composer.lock of the project, if any * @param \stdClass $composerLock The parsed composer.lock of the project, if any
* @param PhpDocumentLoader $documentLoader PhpDocumentLoader instance to load documents * @param PhpDocumentLoader $documentLoader PhpDocumentLoader instance to load documents
*/ */
public function __construct(ProjectIndex $index, DependenciesIndex $dependenciesIndex, Index $sourceIndex, \stdClass $composerLock = null, PhpDocumentLoader $documentLoader, \stdClass $composerJson = null) public function __construct(LanguageClient $client, ProjectIndex $index, DependenciesIndex $dependenciesIndex, Index $sourceIndex, \stdClass $composerLock = null, PhpDocumentLoader $documentLoader, \stdClass $composerJson = null)
{ {
$this->client = $client;
$this->sourceIndex = $sourceIndex; $this->sourceIndex = $sourceIndex;
$this->index = $index; $this->index = $index;
$this->dependenciesIndex = $dependenciesIndex; $this->dependenciesIndex = $dependenciesIndex;
@ -82,6 +97,21 @@ class Workspace
}); });
} }
/**
* The watched files notification is sent from the client to the server when the client detects changes to files watched by the language client.
*
* @param FileEvent[] $changes
* @return void
*/
public function didChangeWatchedFiles(array $changes)
{
foreach ($changes as $change) {
if ($change->type === FileChangeType::DELETED) {
$this->client->textDocument->publishDiagnostics($change->uri, []);
}
}
}
/** /**
* The workspace references request is sent from the client to the server to locate project-wide references to a symbol given its description / metadata. * The workspace references request is sent from the client to the server to locate project-wide references to a symbol given its description / metadata.
* *

View File

@ -0,0 +1,64 @@
<?php
declare(strict_types = 1);
namespace LanguageServer\Tests;
use PHPUnit\Framework\TestCase;
use LanguageServer\Index\Index;
use LanguageServer\{DefinitionResolver, Parser};
class DefinitionResolverTest extends TestCase
{
public function testCreateDefinitionFromNode()
{
$parser = new Parser;
$stmts = $parser->parse("<?php\ndefine('TEST_DEFINE', true);");
$stmts[0]->setAttribute('ownerDocument', new MockPhpDocument);
$index = new Index;
$definitionResolver = new DefinitionResolver($index);
$def = $definitionResolver->createDefinitionFromNode($stmts[0], '\TEST_DEFINE');
$this->assertInstanceOf(\phpDocumentor\Reflection\Types\Boolean::class, $def->type);
}
public function testGetTypeFromNode()
{
$parser = new Parser;
$stmts = $parser->parse("<?php\ndefine('TEST_DEFINE', true);");
$stmts[0]->setAttribute('ownerDocument', new MockPhpDocument);
$index = new Index;
$definitionResolver = new DefinitionResolver($index);
$type = $definitionResolver->getTypeFromNode($stmts[0]);
$this->assertInstanceOf(\phpDocumentor\Reflection\Types\Boolean::class, $type);
}
public function testGetDefinedFqnForIncompleteDefine()
{
// define('XXX') (only one argument) must not introduce a new symbol
$parser = new Parser;
$stmts = $parser->parse("<?php\ndefine('TEST_DEFINE');");
$stmts[0]->setAttribute('ownerDocument', new MockPhpDocument);
$index = new Index;
$definitionResolver = new DefinitionResolver($index);
$fqn = $definitionResolver->getDefinedFqn($stmts[0]);
$this->assertNull($fqn);
}
public function testGetDefinedFqnForDefine()
{
$parser = new Parser;
$stmts = $parser->parse("<?php\ndefine('TEST_DEFINE', true);");
$stmts[0]->setAttribute('ownerDocument', new MockPhpDocument);
$index = new Index;
$definitionResolver = new DefinitionResolver($index);
$fqn = $definitionResolver->getDefinedFqn($stmts[0]);
$this->assertEquals('TEST_DEFINE', $fqn);
}
}

View File

@ -57,7 +57,7 @@ class LanguageServerTest extends TestCase
if ($msg->body->method === 'window/logMessage' && $promise->state === Promise::PENDING) { if ($msg->body->method === 'window/logMessage' && $promise->state === Promise::PENDING) {
if ($msg->body->params->type === MessageType::ERROR) { if ($msg->body->params->type === MessageType::ERROR) {
$promise->reject(new Exception($msg->body->params->message)); $promise->reject(new Exception($msg->body->params->message));
} else if (strpos($msg->body->params->message, 'All 26 PHP files parsed') !== false) { } else if (strpos($msg->body->params->message, 'All 27 PHP files parsed') !== false) {
$promise->fulfill(); $promise->fulfill();
} }
} }
@ -103,7 +103,7 @@ class LanguageServerTest extends TestCase
if ($promise->state === Promise::PENDING) { if ($promise->state === Promise::PENDING) {
$promise->reject(new Exception($msg->body->params->message)); $promise->reject(new Exception($msg->body->params->message));
} }
} else if (strpos($msg->body->params->message, 'All 26 PHP files parsed') !== false) { } else if (strpos($msg->body->params->message, 'All 27 PHP files parsed') !== false) {
$promise->fulfill(); $promise->fulfill();
} }
} }

20
tests/MockPhpDocument.php Normal file
View File

@ -0,0 +1,20 @@
<?php
declare(strict_types = 1);
namespace LanguageServer\Tests;
/**
* A fake document for tests
*/
class MockPhpDocument
{
/**
* Returns fake uri
*
* @return string
*/
public function getUri()
{
return 'file:///whatever';
}
}

View File

@ -32,10 +32,12 @@ class DefinitionCollectorTest extends TestCase
'TestNamespace\\TestTrait', 'TestNamespace\\TestTrait',
'TestNamespace\\TestInterface', 'TestNamespace\\TestInterface',
'TestNamespace\\test_function()', 'TestNamespace\\test_function()',
'TestNamespace\\ChildClass' 'TestNamespace\\ChildClass',
'TestNamespace\\Example',
'TestNamespace\\Example->__construct()',
'TestNamespace\\Example->__destruct()'
], array_keys($defNodes)); ], array_keys($defNodes));
$this->assertInstanceOf(Tolerant\Node\ConstElement::class, $defNodes['TestNamespace\\TEST_CONST']); $this->assertInstanceOf(Tolerant\Node\ConstElement::class, $defNodes['TestNamespace\\TEST_CONST']);
$this->assertInstanceOf(Tolerant\Node\Statement\ClassDeclaration::class, $defNodes['TestNamespace\\TestClass']); $this->assertInstanceOf(Tolerant\Node\Statement\ClassDeclaration::class, $defNodes['TestNamespace\\TestClass']);
$this->assertInstanceOf(Tolerant\Node\ConstElement::class, $defNodes['TestNamespace\\TestClass::TEST_CLASS_CONST']); $this->assertInstanceOf(Tolerant\Node\ConstElement::class, $defNodes['TestNamespace\\TestClass::TEST_CLASS_CONST']);
@ -48,6 +50,9 @@ class DefinitionCollectorTest extends TestCase
$this->assertInstanceOf(Tolerant\Node\Statement\InterfaceDeclaration::class, $defNodes['TestNamespace\\TestInterface']); $this->assertInstanceOf(Tolerant\Node\Statement\InterfaceDeclaration::class, $defNodes['TestNamespace\\TestInterface']);
$this->assertInstanceOf(Tolerant\Node\Statement\FunctionDeclaration::class, $defNodes['TestNamespace\\test_function()']); $this->assertInstanceOf(Tolerant\Node\Statement\FunctionDeclaration::class, $defNodes['TestNamespace\\test_function()']);
$this->assertInstanceOf(Tolerant\Node\Statement\ClassDeclaration::class, $defNodes['TestNamespace\\ChildClass']); $this->assertInstanceOf(Tolerant\Node\Statement\ClassDeclaration::class, $defNodes['TestNamespace\\ChildClass']);
$this->assertInstanceOf(Tolerant\Node\Statement\Class_::class, $defNodes['TestNamespace\\Example']);
$this->assertInstanceOf(Tolerant\Node\Statement\ClassMethod::class, $defNodes['TestNamespace\\Example->__construct()']);
$this->assertInstanceOf(Tolerant\Node\Statement\ClassMethod::class, $defNodes['TestNamespace\\Example->__destruct()']);
} }
public function testDoesNotCollectReferences() public function testDoesNotCollectReferences()

View File

@ -55,7 +55,7 @@ abstract class ServerTestCase extends TestCase
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream); $client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
$this->documentLoader = new PhpDocumentLoader(new FileSystemContentRetriever, $projectIndex, $definitionResolver); $this->documentLoader = new PhpDocumentLoader(new FileSystemContentRetriever, $projectIndex, $definitionResolver);
$this->textDocument = new Server\TextDocument($this->documentLoader, $definitionResolver, $client, $projectIndex); $this->textDocument = new Server\TextDocument($this->documentLoader, $definitionResolver, $client, $projectIndex);
$this->workspace = new Server\Workspace($projectIndex, $dependenciesIndex, $sourceIndex, null, $this->documentLoader); $this->workspace = new Server\Workspace($client, $projectIndex, $dependenciesIndex, $sourceIndex, null, $this->documentLoader);
$globalSymbolsUri = pathToUri(realpath(__DIR__ . '/../../fixtures/global_symbols.php')); $globalSymbolsUri = pathToUri(realpath(__DIR__ . '/../../fixtures/global_symbols.php'));
$globalReferencesUri = pathToUri(realpath(__DIR__ . '/../../fixtures/global_references.php')); $globalReferencesUri = pathToUri(realpath(__DIR__ . '/../../fixtures/global_references.php'));
@ -73,18 +73,19 @@ abstract class ServerTestCase extends TestCase
$this->definitionLocations = [ $this->definitionLocations = [
// Global // Global
'TEST_CONST' => new Location($globalSymbolsUri, new Range(new Position( 9, 6), new Position( 9, 22))), 'TEST_DEFINE_CONSTANT' => new Location($globalSymbolsUri, new Range(new Position(104, 0), new Position(104, 37))),
'TestClass' => new Location($globalSymbolsUri, new Range(new Position(20, 0), new Position(61, 1))), 'TEST_CONST' => new Location($globalSymbolsUri, new Range(new Position( 9, 6), new Position( 9, 22))),
'ChildClass' => new Location($globalSymbolsUri, new Range(new Position(99, 0), new Position(99, 37))), 'TestClass' => new Location($globalSymbolsUri, new Range(new Position(20, 0), new Position(61, 1))),
'TestTrait' => new Location($globalSymbolsUri, new Range(new Position(63, 0), new Position(66, 1))), 'ChildClass' => new Location($globalSymbolsUri, new Range(new Position(99, 0), new Position(99, 37))),
'TestInterface' => new Location($globalSymbolsUri, new Range(new Position(68, 0), new Position(71, 1))), 'TestTrait' => new Location($globalSymbolsUri, new Range(new Position(63, 0), new Position(66, 1))),
'TestClass::TEST_CLASS_CONST' => new Location($globalSymbolsUri, new Range(new Position(27, 10), new Position(27, 32))), 'TestInterface' => new Location($globalSymbolsUri, new Range(new Position(68, 0), new Position(71, 1))),
'TestClass::testProperty' => new Location($globalSymbolsUri, new Range(new Position(41, 11), new Position(41, 24))), 'TestClass::TEST_CLASS_CONST' => new Location($globalSymbolsUri, new Range(new Position(27, 10), new Position(27, 32))),
'TestClass::staticTestProperty' => new Location($globalSymbolsUri, new Range(new Position(34, 18), new Position(34, 37))), 'TestClass::testProperty' => new Location($globalSymbolsUri, new Range(new Position(41, 11), new Position(41, 24))),
'TestClass::staticTestMethod()' => new Location($globalSymbolsUri, new Range(new Position(46, 4), new Position(49, 5))), 'TestClass::staticTestProperty' => new Location($globalSymbolsUri, new Range(new Position(34, 18), new Position(34, 37))),
'TestClass::testMethod()' => new Location($globalSymbolsUri, new Range(new Position(57, 4), new Position(60, 5))), 'TestClass::staticTestMethod()' => new Location($globalSymbolsUri, new Range(new Position(46, 4), new Position(49, 5))),
'test_function()' => new Location($globalSymbolsUri, new Range(new Position(78, 0), new Position(81, 1))), 'TestClass::testMethod()' => new Location($globalSymbolsUri, new Range(new Position(57, 4), new Position(60, 5))),
'whatever()' => new Location($globalReferencesUri, new Range(new Position(21, 0), new Position(23, 1))), 'test_function()' => new Location($globalSymbolsUri, new Range(new Position(78, 0), new Position(81, 1))),
'whatever()' => new Location($globalReferencesUri, new Range(new Position(21, 0), new Position(23, 1))),
// Namespaced // Namespaced
'TestNamespace' => new Location($symbolsUri, new Range(new Position( 2, 0), new Position( 2, 24))), 'TestNamespace' => new Location($symbolsUri, new Range(new Position( 2, 0), new Position( 2, 24))),
@ -95,12 +96,15 @@ abstract class ServerTestCase extends TestCase
'TestNamespace\\TestTrait' => new Location($symbolsUri, new Range(new Position(63, 0), new Position(66, 1))), 'TestNamespace\\TestTrait' => new Location($symbolsUri, new Range(new Position(63, 0), new Position(66, 1))),
'TestNamespace\\TestInterface' => new Location($symbolsUri, new Range(new Position(68, 0), new Position(71, 1))), 'TestNamespace\\TestInterface' => new Location($symbolsUri, new Range(new Position(68, 0), new Position(71, 1))),
'TestNamespace\\TestClass::TEST_CLASS_CONST' => new Location($symbolsUri, new Range(new Position(27, 10), new Position(27, 32))), 'TestNamespace\\TestClass::TEST_CLASS_CONST' => new Location($symbolsUri, new Range(new Position(27, 10), new Position(27, 32))),
'TestNamespace\\TestClass::testProperty' => new Location($symbolsUri, new Range(new Position(41, 11), new Position(41, 24))), 'TestNamespace\\TestClass::testProperty' => new Location($symbolsUri, new Range(new Position(41, 11), new Position(41, 24))),
'TestNamespace\\TestClass::staticTestProperty' => new Location($symbolsUri, new Range(new Position(34, 18), new Position(34, 37))), 'TestNamespace\\TestClass::staticTestProperty' => new Location($symbolsUri, new Range(new Position(34, 18), new Position(34, 37))),
'TestNamespace\\TestClass::staticTestMethod()' => new Location($symbolsUri, new Range(new Position(46, 4), new Position(49, 5))), 'TestNamespace\\TestClass::staticTestMethod()' => new Location($symbolsUri, new Range(new Position(46, 4), new Position(49, 5))),
'TestNamespace\\TestClass::testMethod()' => new Location($symbolsUri, new Range(new Position(57, 4), new Position(60, 5))), 'TestNamespace\\TestClass::testMethod()' => new Location($symbolsUri, new Range(new Position(57, 4), new Position(60, 5))),
'TestNamespace\\test_function()' => new Location($symbolsUri, new Range(new Position(78, 0), new Position(81, 1))), 'TestNamespace\\test_function()' => new Location($symbolsUri, new Range(new Position(78, 0), new Position(81, 1))),
'TestNamespace\\whatever()' => new Location($referencesUri, new Range(new Position(21, 0), new Position(23, 1))) 'TestNamespace\\whatever()' => new Location($referencesUri, new Range(new Position(21, 0), new Position(23, 1))),
'TestNamespace\\Example' => new Location($symbolsUri, new Range(new Position(101, 0), new Position(104, 1))),
'TestNamespace\\Example::__construct' => new Location($symbolsUri, new Range(new Position(102, 4), new Position(102, 36))),
'TestNamespace\\Example::__destruct' => new Location($symbolsUri, new Range(new Position(103, 4), new Position(103, 35)))
]; ];
$this->referenceLocations = [ $this->referenceLocations = [
@ -161,6 +165,9 @@ abstract class ServerTestCase extends TestCase
], ],
// Global // Global
'TEST_DEFINE_CONSTANT' => [
0 => new Location($globalSymbolsUri, new Range(new Position(106, 6), new Position(106, 26)))
],
'TEST_CONST' => [ 'TEST_CONST' => [
0 => new Location($referencesUri, new Range(new Position(29, 5), new Position(29, 15))), 0 => new Location($referencesUri, new Range(new Position(29, 5), new Position(29, 15))),
1 => new Location($globalReferencesUri, new Range(new Position(29, 5), new Position(29, 15))) 1 => new Location($globalReferencesUri, new Range(new Position(29, 5), new Position(29, 15)))

View File

@ -161,7 +161,12 @@ class CompletionTest extends TestCase
'TestClass', 'TestClass',
CompletionItemKind::CLASS_, CompletionItemKind::CLASS_,
null, null,
'Pariatur ut laborum tempor voluptate consequat ea deserunt.', 'Pariatur ut laborum tempor voluptate consequat ea deserunt.' . "\n\n" .
'Deserunt enim minim sunt sint ea nisi. Deserunt excepteur tempor id nostrud' . "\n" .
'laboris commodo ad commodo velit mollit qui non officia id. Nulla duis veniam' . "\n" .
'veniam officia deserunt et non dolore mollit ea quis eiusmod sit non. Occaecat' . "\n" .
'consequat sunt culpa exercitation pariatur id reprehenderit nisi incididunt Lorem' . "\n" .
'sint. Officia culpa pariatur laborum nostrud cupidatat consequat mollit.',
null, null,
null, null,
'\TestClass' '\TestClass'
@ -180,7 +185,12 @@ class CompletionTest extends TestCase
'TestClass', 'TestClass',
CompletionItemKind::CLASS_, CompletionItemKind::CLASS_,
'TestNamespace', 'TestNamespace',
'Pariatur ut laborum tempor voluptate consequat ea deserunt.', 'Pariatur ut laborum tempor voluptate consequat ea deserunt.' . "\n\n" .
'Deserunt enim minim sunt sint ea nisi. Deserunt excepteur tempor id nostrud' . "\n" .
'laboris commodo ad commodo velit mollit qui non officia id. Nulla duis veniam' . "\n" .
'veniam officia deserunt et non dolore mollit ea quis eiusmod sit non. Occaecat' . "\n" .
'consequat sunt culpa exercitation pariatur id reprehenderit nisi incididunt Lorem' . "\n" .
'sint. Officia culpa pariatur laborum nostrud cupidatat consequat mollit.',
null, null,
null, null,
'TestClass' 'TestClass'
@ -194,6 +204,15 @@ class CompletionTest extends TestCase
null, null,
'\TestNamespace\ChildClass' '\TestNamespace\ChildClass'
), ),
new CompletionItem(
'Example',
CompletionItemKind::CLASS_,
'TestNamespace',
null,
null,
null,
'\TestNamespace\Example'
)
], true), $items); ], true), $items);
} }
@ -210,7 +229,12 @@ class CompletionTest extends TestCase
'TestClass', 'TestClass',
CompletionItemKind::CLASS_, CompletionItemKind::CLASS_,
'TestNamespace', 'TestNamespace',
'Pariatur ut laborum tempor voluptate consequat ea deserunt.', 'Pariatur ut laborum tempor voluptate consequat ea deserunt.' . "\n\n" .
'Deserunt enim minim sunt sint ea nisi. Deserunt excepteur tempor id nostrud' . "\n" .
'laboris commodo ad commodo velit mollit qui non officia id. Nulla duis veniam' . "\n" .
'veniam officia deserunt et non dolore mollit ea quis eiusmod sit non. Occaecat' . "\n" .
'consequat sunt culpa exercitation pariatur id reprehenderit nisi incididunt Lorem' . "\n" .
'sint. Officia culpa pariatur laborum nostrud cupidatat consequat mollit.',
null, null,
null, null,
'TestClass' 'TestClass'
@ -351,7 +375,12 @@ class CompletionTest extends TestCase
'TestClass', 'TestClass',
CompletionItemKind::CLASS_, CompletionItemKind::CLASS_,
null, null,
'Pariatur ut laborum tempor voluptate consequat ea deserunt.', 'Pariatur ut laborum tempor voluptate consequat ea deserunt.' . "\n\n" .
'Deserunt enim minim sunt sint ea nisi. Deserunt excepteur tempor id nostrud' . "\n" .
'laboris commodo ad commodo velit mollit qui non officia id. Nulla duis veniam' . "\n" .
'veniam officia deserunt et non dolore mollit ea quis eiusmod sit non. Occaecat' . "\n" .
'consequat sunt culpa exercitation pariatur id reprehenderit nisi incididunt Lorem' . "\n" .
'sint. Officia culpa pariatur laborum nostrud cupidatat consequat mollit.',
null, null,
null, null,
'TestClass' 'TestClass'

View File

@ -18,18 +18,21 @@ class DocumentSymbolTest extends ServerTestCase
$result = $this->textDocument->documentSymbol(new TextDocumentIdentifier($uri))->wait(); $result = $this->textDocument->documentSymbol(new TextDocumentIdentifier($uri))->wait();
// @codingStandardsIgnoreStart // @codingStandardsIgnoreStart
$this->assertEquals([ $this->assertEquals([
new SymbolInformation('TestNamespace', SymbolKind::NAMESPACE, $this->getDefinitionLocation('TestNamespace'), ''), new SymbolInformation('TestNamespace', SymbolKind::NAMESPACE, $this->getDefinitionLocation('TestNamespace'), ''),
new SymbolInformation('TEST_CONST', SymbolKind::CONSTANT, $this->getDefinitionLocation('TestNamespace\\TEST_CONST'), 'TestNamespace'), new SymbolInformation('TEST_CONST', SymbolKind::CONSTANT, $this->getDefinitionLocation('TestNamespace\\TEST_CONST'), 'TestNamespace'),
new SymbolInformation('TestClass', SymbolKind::CLASS_, $this->getDefinitionLocation('TestNamespace\\TestClass'), 'TestNamespace'), new SymbolInformation('TestClass', SymbolKind::CLASS_, $this->getDefinitionLocation('TestNamespace\\TestClass'), 'TestNamespace'),
new SymbolInformation('TEST_CLASS_CONST', SymbolKind::CONSTANT, $this->getDefinitionLocation('TestNamespace\\TestClass::TEST_CLASS_CONST'), 'TestNamespace\\TestClass'), new SymbolInformation('TEST_CLASS_CONST', SymbolKind::CONSTANT, $this->getDefinitionLocation('TestNamespace\\TestClass::TEST_CLASS_CONST'), 'TestNamespace\\TestClass'),
new SymbolInformation('staticTestProperty', SymbolKind::PROPERTY, $this->getDefinitionLocation('TestNamespace\\TestClass::staticTestProperty'), 'TestNamespace\\TestClass'), new SymbolInformation('staticTestProperty', SymbolKind::PROPERTY, $this->getDefinitionLocation('TestNamespace\\TestClass::staticTestProperty'), 'TestNamespace\\TestClass'),
new SymbolInformation('testProperty', SymbolKind::PROPERTY, $this->getDefinitionLocation('TestNamespace\\TestClass::testProperty'), 'TestNamespace\\TestClass'), new SymbolInformation('testProperty', SymbolKind::PROPERTY, $this->getDefinitionLocation('TestNamespace\\TestClass::testProperty'), 'TestNamespace\\TestClass'),
new SymbolInformation('staticTestMethod', SymbolKind::METHOD, $this->getDefinitionLocation('TestNamespace\\TestClass::staticTestMethod()'), 'TestNamespace\\TestClass'), new SymbolInformation('staticTestMethod', SymbolKind::METHOD, $this->getDefinitionLocation('TestNamespace\\TestClass::staticTestMethod()'), 'TestNamespace\\TestClass'),
new SymbolInformation('testMethod', SymbolKind::METHOD, $this->getDefinitionLocation('TestNamespace\\TestClass::testMethod()'), 'TestNamespace\\TestClass'), new SymbolInformation('testMethod', SymbolKind::METHOD, $this->getDefinitionLocation('TestNamespace\\TestClass::testMethod()'), 'TestNamespace\\TestClass'),
new SymbolInformation('TestTrait', SymbolKind::CLASS_, $this->getDefinitionLocation('TestNamespace\\TestTrait'), 'TestNamespace'), new SymbolInformation('TestTrait', SymbolKind::CLASS_, $this->getDefinitionLocation('TestNamespace\\TestTrait'), 'TestNamespace'),
new SymbolInformation('TestInterface', SymbolKind::INTERFACE, $this->getDefinitionLocation('TestNamespace\\TestInterface'), 'TestNamespace'), new SymbolInformation('TestInterface', SymbolKind::INTERFACE, $this->getDefinitionLocation('TestNamespace\\TestInterface'), 'TestNamespace'),
new SymbolInformation('test_function', SymbolKind::FUNCTION, $this->getDefinitionLocation('TestNamespace\\test_function()'), 'TestNamespace'), new SymbolInformation('test_function', SymbolKind::FUNCTION, $this->getDefinitionLocation('TestNamespace\\test_function()'), 'TestNamespace'),
new SymbolInformation('ChildClass', SymbolKind::CLASS_, $this->getDefinitionLocation('TestNamespace\\ChildClass'), 'TestNamespace'), new SymbolInformation('ChildClass', SymbolKind::CLASS_, $this->getDefinitionLocation('TestNamespace\\ChildClass'), 'TestNamespace'),
new SymbolInformation('Example', SymbolKind::CLASS_, $this->getDefinitionLocation('TestNamespace\\Example'), 'TestNamespace'),
new SymbolInformation('__construct', SymbolKind::CONSTRUCTOR, $this->getDefinitionLocation('TestNamespace\\Example::__construct'), 'TestNamespace\\Example'),
new SymbolInformation('__destruct', SymbolKind::CONSTRUCTOR, $this->getDefinitionLocation('TestNamespace\\Example::__destruct'), 'TestNamespace\\Example')
], $result); ], $result);
// @codingStandardsIgnoreEnd // @codingStandardsIgnoreEnd
} }

View File

@ -21,8 +21,18 @@ class HoverTest extends ServerTestCase
$reference->range->start $reference->range->start
)->wait(); )->wait();
$this->assertEquals(new Hover([ $this->assertEquals(new Hover([
<<<<<<< HEAD
new MarkedString('php', "<?php\nclass TestClass implements TestInterface"), new MarkedString('php', "<?php\nclass TestClass implements TestInterface"),
'Pariatur ut laborum tempor voluptate consequat ea deserunt.' 'Pariatur ut laborum tempor voluptate consequat ea deserunt.'
=======
new MarkedString('php', "<?php\nclass TestClass implements \\TestInterface"),
'Pariatur ut laborum tempor voluptate consequat ea deserunt.' . "\n\n" .
'Deserunt enim minim sunt sint ea nisi. Deserunt excepteur tempor id nostrud' . "\n" .
'laboris commodo ad commodo velit mollit qui non officia id. Nulla duis veniam' . "\n" .
'veniam officia deserunt et non dolore mollit ea quis eiusmod sit non. Occaecat' . "\n" .
'consequat sunt culpa exercitation pariatur id reprehenderit nisi incididunt Lorem' . "\n" .
'sint. Officia culpa pariatur laborum nostrud cupidatat consequat mollit.'
>>>>>>> upstream/master
], $reference->range), $result); ], $reference->range), $result);
} }
@ -36,8 +46,18 @@ class HoverTest extends ServerTestCase
$definition->range->start $definition->range->start
)->wait(); )->wait();
$this->assertEquals(new Hover([ $this->assertEquals(new Hover([
<<<<<<< HEAD
new MarkedString('php', "<?php\nclass TestClass implements TestInterface"), new MarkedString('php', "<?php\nclass TestClass implements TestInterface"),
'Pariatur ut laborum tempor voluptate consequat ea deserunt.' 'Pariatur ut laborum tempor voluptate consequat ea deserunt.'
=======
new MarkedString('php', "<?php\nclass TestClass implements \\TestInterface"),
'Pariatur ut laborum tempor voluptate consequat ea deserunt.' . "\n\n" .
'Deserunt enim minim sunt sint ea nisi. Deserunt excepteur tempor id nostrud' . "\n" .
'laboris commodo ad commodo velit mollit qui non officia id. Nulla duis veniam' . "\n" .
'veniam officia deserunt et non dolore mollit ea quis eiusmod sit non. Occaecat' . "\n" .
'consequat sunt culpa exercitation pariatur id reprehenderit nisi incididunt Lorem' . "\n" .
'sint. Officia culpa pariatur laborum nostrud cupidatat consequat mollit.'
>>>>>>> upstream/master
], $definition->range), $result); ], $definition->range), $result);
} }
@ -146,6 +166,21 @@ class HoverTest extends ServerTestCase
], $reference->range), $result); ], $reference->range), $result);
} }
public function testHoverForGlobalConstant()
{
// print TEST_DEFINE_CONSTANT ? 'true' : 'false';
// Get hover for TEST_DEFINE_CONSTANT
$reference = $this->getReferenceLocations('TEST_DEFINE_CONSTANT')[0];
$result = $this->textDocument->hover(
new TextDocumentIdentifier($reference->uri),
$reference->range->end
)->wait();
$this->assertEquals(new Hover([
new MarkedString('php', "<?php\n\\define('TEST_DEFINE_CONSTANT', \\false);"),
'Lorem ipsum dolor sit amet, consectetur.'
], $reference->range), $result);
}
public function testHoverForVariable() public function testHoverForVariable()
{ {
// echo $var; // echo $var;
@ -181,7 +216,12 @@ class HoverTest extends ServerTestCase
$result = $this->textDocument->hover(new TextDocumentIdentifier($uri), new Position(59, 11))->wait(); $result = $this->textDocument->hover(new TextDocumentIdentifier($uri), new Position(59, 11))->wait();
$this->assertEquals(new Hover([ $this->assertEquals(new Hover([
new MarkedString('php', "<?php\nclass TestClass implements TestInterface"), new MarkedString('php', "<?php\nclass TestClass implements TestInterface"),
'Pariatur ut laborum tempor voluptate consequat ea deserunt.' 'Pariatur ut laborum tempor voluptate consequat ea deserunt.' . "\n\n" .
'Deserunt enim minim sunt sint ea nisi. Deserunt excepteur tempor id nostrud' . "\n" .
'laboris commodo ad commodo velit mollit qui non officia id. Nulla duis veniam' . "\n" .
'veniam officia deserunt et non dolore mollit ea quis eiusmod sit non. Occaecat' . "\n" .
'consequat sunt culpa exercitation pariatur id reprehenderit nisi incididunt Lorem' . "\n" .
'sint. Officia culpa pariatur laborum nostrud cupidatat consequat mollit.'
], new Range(new Position(59, 8), new Position(59, 13))), $result); ], new Range(new Position(59, 8), new Position(59, 13))), $result);
} }
} }

View File

@ -0,0 +1,41 @@
<?php
declare(strict_types = 1);
namespace LanguageServer\Tests\Server\Workspace;
use LanguageServer\ContentRetriever\FileSystemContentRetriever;
use LanguageServer\{DefinitionResolver, LanguageClient, PhpDocumentLoader, Server};
use LanguageServer\Index\{DependenciesIndex, Index, ProjectIndex};
use LanguageServer\Protocol\{FileChangeType, FileEvent, Message};
use LanguageServer\Tests\MockProtocolStream;
use LanguageServer\Tests\Server\ServerTestCase;
use LanguageServer\Server\Workspace;
use Sabre\Event\Loop;
class DidChangeWatchedFilesTest extends ServerTestCase
{
public function testDeletingFileClearsAllDiagnostics()
{
$client = new LanguageClient(new MockProtocolStream(), $writer = new MockProtocolStream());
$projectIndex = new ProjectIndex($sourceIndex = new Index(), $dependenciesIndex = new DependenciesIndex());
$definitionResolver = new DefinitionResolver($projectIndex);
$loader = new PhpDocumentLoader(new FileSystemContentRetriever(), $projectIndex, $definitionResolver);
$workspace = new Server\Workspace($client, $projectIndex, $dependenciesIndex, $sourceIndex, null, $loader, null);
$fileEvent = new FileEvent('my uri', FileChangeType::DELETED);
$isDiagnosticsCleared = false;
$writer->on('message', function (Message $message) use ($fileEvent, &$isDiagnosticsCleared) {
if ($message->body->method === "textDocument/publishDiagnostics") {
$this->assertEquals($message->body->params->uri, $fileEvent->uri);
$this->assertEquals($message->body->params->diagnostics, []);
$isDiagnosticsCleared = true;
}
});
$workspace->didChangeWatchedFiles([$fileEvent]);
Loop\tick(true);
$this->assertTrue($isDiagnosticsCleared, "Deleting file should clear all diagnostics.");
}
}

View File

@ -31,33 +31,37 @@ class SymbolTest extends ServerTestCase
$this->assertEquals([ $this->assertEquals([
new SymbolInformation('TestNamespace', SymbolKind::NAMESPACE, new Location($referencesUri, new Range(new Position(2, 0), new Position(2, 24))), ''), new SymbolInformation('TestNamespace', SymbolKind::NAMESPACE, new Location($referencesUri, new Range(new Position(2, 0), new Position(2, 24))), ''),
// Namespaced // Namespaced
new SymbolInformation('TEST_CONST', SymbolKind::CONSTANT, $this->getDefinitionLocation('TestNamespace\\TEST_CONST'), 'TestNamespace'), new SymbolInformation('TEST_CONST', SymbolKind::CONSTANT, $this->getDefinitionLocation('TestNamespace\\TEST_CONST'), 'TestNamespace'),
new SymbolInformation('TestClass', SymbolKind::CLASS_, $this->getDefinitionLocation('TestNamespace\\TestClass'), 'TestNamespace'), new SymbolInformation('TestClass', SymbolKind::CLASS_, $this->getDefinitionLocation('TestNamespace\\TestClass'), 'TestNamespace'),
new SymbolInformation('TEST_CLASS_CONST', SymbolKind::CONSTANT, $this->getDefinitionLocation('TestNamespace\\TestClass::TEST_CLASS_CONST'), 'TestNamespace\\TestClass'), new SymbolInformation('TEST_CLASS_CONST', SymbolKind::CONSTANT, $this->getDefinitionLocation('TestNamespace\\TestClass::TEST_CLASS_CONST'), 'TestNamespace\\TestClass'),
new SymbolInformation('staticTestProperty', SymbolKind::PROPERTY, $this->getDefinitionLocation('TestNamespace\\TestClass::staticTestProperty'), 'TestNamespace\\TestClass'), new SymbolInformation('staticTestProperty', SymbolKind::PROPERTY, $this->getDefinitionLocation('TestNamespace\\TestClass::staticTestProperty'), 'TestNamespace\\TestClass'),
new SymbolInformation('testProperty', SymbolKind::PROPERTY, $this->getDefinitionLocation('TestNamespace\\TestClass::testProperty'), 'TestNamespace\\TestClass'), new SymbolInformation('testProperty', SymbolKind::PROPERTY, $this->getDefinitionLocation('TestNamespace\\TestClass::testProperty'), 'TestNamespace\\TestClass'),
new SymbolInformation('staticTestMethod', SymbolKind::METHOD, $this->getDefinitionLocation('TestNamespace\\TestClass::staticTestMethod()'), 'TestNamespace\\TestClass'), new SymbolInformation('staticTestMethod', SymbolKind::METHOD, $this->getDefinitionLocation('TestNamespace\\TestClass::staticTestMethod()'), 'TestNamespace\\TestClass'),
new SymbolInformation('testMethod', SymbolKind::METHOD, $this->getDefinitionLocation('TestNamespace\\TestClass::testMethod()'), 'TestNamespace\\TestClass'), new SymbolInformation('testMethod', SymbolKind::METHOD, $this->getDefinitionLocation('TestNamespace\\TestClass::testMethod()'), 'TestNamespace\\TestClass'),
new SymbolInformation('TestTrait', SymbolKind::CLASS_, $this->getDefinitionLocation('TestNamespace\\TestTrait'), 'TestNamespace'), new SymbolInformation('TestTrait', SymbolKind::CLASS_, $this->getDefinitionLocation('TestNamespace\\TestTrait'), 'TestNamespace'),
new SymbolInformation('TestInterface', SymbolKind::INTERFACE, $this->getDefinitionLocation('TestNamespace\\TestInterface'), 'TestNamespace'), new SymbolInformation('TestInterface', SymbolKind::INTERFACE, $this->getDefinitionLocation('TestNamespace\\TestInterface'), 'TestNamespace'),
new SymbolInformation('test_function', SymbolKind::FUNCTION, $this->getDefinitionLocation('TestNamespace\\test_function()'), 'TestNamespace'), new SymbolInformation('test_function', SymbolKind::FUNCTION, $this->getDefinitionLocation('TestNamespace\\test_function()'), 'TestNamespace'),
new SymbolInformation('ChildClass', SymbolKind::CLASS_, $this->getDefinitionLocation('TestNamespace\\ChildClass'), 'TestNamespace'), new SymbolInformation('ChildClass', SymbolKind::CLASS_, $this->getDefinitionLocation('TestNamespace\\ChildClass'), 'TestNamespace'),
new SymbolInformation('whatever', SymbolKind::FUNCTION, $this->getDefinitionLocation('TestNamespace\\whatever()'), 'TestNamespace'), new SymbolInformation('Example', SymbolKind::CLASS_, $this->getDefinitionLocation('TestNamespace\\Example'), 'TestNamespace'),
new SymbolInformation('__construct', SymbolKind::CONSTRUCTOR, $this->getDefinitionLocation('TestNamespace\\Example::__construct'), 'TestNamespace\\Example'),
new SymbolInformation('__destruct', SymbolKind::CONSTRUCTOR, $this->getDefinitionLocation('TestNamespace\\Example::__destruct'), 'TestNamespace\\Example'),
new SymbolInformation('whatever', SymbolKind::FUNCTION, $this->getDefinitionLocation('TestNamespace\\whatever()'), 'TestNamespace'),
// Global // Global
new SymbolInformation('TEST_CONST', SymbolKind::CONSTANT, $this->getDefinitionLocation('TEST_CONST'), ''), new SymbolInformation('TEST_CONST', SymbolKind::CONSTANT, $this->getDefinitionLocation('TEST_CONST'), ''),
new SymbolInformation('TestClass', SymbolKind::CLASS_, $this->getDefinitionLocation('TestClass'), ''), new SymbolInformation('TestClass', SymbolKind::CLASS_, $this->getDefinitionLocation('TestClass'), ''),
new SymbolInformation('TEST_CLASS_CONST', SymbolKind::CONSTANT, $this->getDefinitionLocation('TestClass::TEST_CLASS_CONST'), 'TestClass'), new SymbolInformation('TEST_CLASS_CONST', SymbolKind::CONSTANT, $this->getDefinitionLocation('TestClass::TEST_CLASS_CONST'), 'TestClass'),
new SymbolInformation('staticTestProperty', SymbolKind::PROPERTY, $this->getDefinitionLocation('TestClass::staticTestProperty'), 'TestClass'), new SymbolInformation('staticTestProperty', SymbolKind::PROPERTY, $this->getDefinitionLocation('TestClass::staticTestProperty'), 'TestClass'),
new SymbolInformation('testProperty', SymbolKind::PROPERTY, $this->getDefinitionLocation('TestClass::testProperty'), 'TestClass'), new SymbolInformation('testProperty', SymbolKind::PROPERTY, $this->getDefinitionLocation('TestClass::testProperty'), 'TestClass'),
new SymbolInformation('staticTestMethod', SymbolKind::METHOD, $this->getDefinitionLocation('TestClass::staticTestMethod()'), 'TestClass'), new SymbolInformation('staticTestMethod', SymbolKind::METHOD, $this->getDefinitionLocation('TestClass::staticTestMethod()'), 'TestClass'),
new SymbolInformation('testMethod', SymbolKind::METHOD, $this->getDefinitionLocation('TestClass::testMethod()'), 'TestClass'), new SymbolInformation('testMethod', SymbolKind::METHOD, $this->getDefinitionLocation('TestClass::testMethod()'), 'TestClass'),
new SymbolInformation('TestTrait', SymbolKind::CLASS_, $this->getDefinitionLocation('TestTrait'), ''), new SymbolInformation('TestTrait', SymbolKind::CLASS_, $this->getDefinitionLocation('TestTrait'), ''),
new SymbolInformation('TestInterface', SymbolKind::INTERFACE, $this->getDefinitionLocation('TestInterface'), ''), new SymbolInformation('TestInterface', SymbolKind::INTERFACE, $this->getDefinitionLocation('TestInterface'), ''),
new SymbolInformation('test_function', SymbolKind::FUNCTION, $this->getDefinitionLocation('test_function()'), ''), new SymbolInformation('test_function', SymbolKind::FUNCTION, $this->getDefinitionLocation('test_function()'), ''),
new SymbolInformation('ChildClass', SymbolKind::CLASS_, $this->getDefinitionLocation('ChildClass'), ''), new SymbolInformation('ChildClass', SymbolKind::CLASS_, $this->getDefinitionLocation('ChildClass'), ''),
new SymbolInformation('whatever', SymbolKind::FUNCTION, $this->getDefinitionLocation('whatever()'), ''), new SymbolInformation('TEST_DEFINE_CONSTANT', SymbolKind::CONSTANT, $this->getDefinitionLocation('TEST_DEFINE_CONSTANT'), ''),
new SymbolInformation('whatever', SymbolKind::FUNCTION, $this->getDefinitionLocation('whatever()'), ''),
new SymbolInformation('SecondTestNamespace', SymbolKind::NAMESPACE, $this->getDefinitionLocation('SecondTestNamespace'), '') new SymbolInformation('SecondTestNamespace', SymbolKind::NAMESPACE, $this->getDefinitionLocation('SecondTestNamespace'), '')
], $result); ], $result);
// @codingStandardsIgnoreEnd // @codingStandardsIgnoreEnd
} }