🚀 Support constants
parent
546660f957
commit
a98746663a
|
@ -28,7 +28,7 @@
|
|||
},
|
||||
"require": {
|
||||
"php": ">=7.0",
|
||||
"nikic/php-parser": "^3.0.4",
|
||||
"nikic/php-parser": "^3.0.5",
|
||||
"phpdocumentor/reflection-docblock": "^3.0",
|
||||
"sabre/event": "^5.0",
|
||||
"felixfbecker/advanced-json-rpc": "^2.0",
|
||||
|
|
|
@ -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();
|
||||
}
|
|
@ -98,3 +98,10 @@ new class {
|
|||
};
|
||||
|
||||
class ChildClass extends TestClass {}
|
||||
|
||||
/**
|
||||
* Lorem ipsum dolor sit amet, consectetur.
|
||||
*/
|
||||
define('TEST_PROPERTY', false);
|
||||
|
||||
print TEST_PROPERTY ? 'true' : 'false';
|
||||
|
|
|
@ -98,3 +98,8 @@ new class {
|
|||
};
|
||||
|
||||
class ChildClass extends TestClass {}
|
||||
|
||||
class Example {
|
||||
public function __construct() {}
|
||||
public function __destruct() {}
|
||||
}
|
||||
|
|
|
@ -11,4 +11,7 @@
|
|||
<directory>./src</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<php>
|
||||
<ini name="memory_limit" value="256M"/>
|
||||
</php>
|
||||
</phpunit>
|
||||
|
|
|
@ -89,8 +89,15 @@ class DefinitionResolver
|
|||
} else {
|
||||
$docBlock = $node->getAttribute('docBlock');
|
||||
if ($docBlock !== null) {
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -439,7 +446,7 @@ class DefinitionResolver
|
|||
// Cannot get type for dynamic function call
|
||||
return new Types\Mixed;
|
||||
}
|
||||
$fqn = (string)($expr->getAttribute('namespacedName') ?? $expr->name);
|
||||
$fqn = (string)($expr->getAttribute('namespacedName') ?? $expr->name) . '()';
|
||||
$def = $this->index->getDefinition($fqn, true);
|
||||
if ($def !== null) {
|
||||
return $def->type;
|
||||
|
@ -725,10 +732,12 @@ class DefinitionResolver
|
|||
// Use @param tag
|
||||
foreach ($docBlock->getTagsByName('param') as $paramTag) {
|
||||
if ($paramTag->getVariableName() === $node->name) {
|
||||
if ($paramTag->getType() === null) {
|
||||
$type = $paramTag->getType();
|
||||
|
||||
if ($type === null) {
|
||||
break;
|
||||
}
|
||||
return $paramTag->getType();
|
||||
return $type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -752,6 +761,41 @@ class DefinitionResolver
|
|||
}
|
||||
return $type ?? new Types\Mixed;
|
||||
}
|
||||
|
||||
if ($node instanceof Node\Var_) {
|
||||
$docBlock = $node->getAttribute('docBlock');
|
||||
if ($docBlock !== null) {
|
||||
// use @var tag
|
||||
foreach($docBlock->getTagsByName('var') as $varTag) {
|
||||
$type = $varTag->getType();
|
||||
|
||||
if($type === null) {
|
||||
break;
|
||||
}
|
||||
return $type;
|
||||
}
|
||||
}
|
||||
$type = null;
|
||||
if ($node->type !== null) {
|
||||
// Use PHP7 return type hint
|
||||
if (is_string($node->type)) {
|
||||
// Resolve a string like "bool" to a type object
|
||||
$type = $this->typeResolver->resolve($node->type);
|
||||
} else {
|
||||
$type = new Types\Object_(new Fqsen('\\' . (string)$node->type));
|
||||
}
|
||||
}
|
||||
if ($node->default !== null) {
|
||||
$defaultType = $this->resolveExpressionNodeToType($node->default);
|
||||
if (isset($type) && !is_a($type, get_class($defaultType))) {
|
||||
$type = new Types\Compound([$type, $defaultType]);
|
||||
} else {
|
||||
$type = $defaultType;
|
||||
}
|
||||
}
|
||||
return $type ?? new Types\Mixed;
|
||||
}
|
||||
|
||||
if ($node instanceof Node\FunctionLike) {
|
||||
// Functions/methods
|
||||
$docBlock = $node->getAttribute('docBlock');
|
||||
|
@ -875,6 +919,11 @@ class DefinitionResolver
|
|||
}
|
||||
return (string)$class->namespacedName . '::' . $node->name;
|
||||
}
|
||||
} else if ($node instanceof Node\Expr\FuncCall && $node->name instanceof Node\Name && strtolower((string)$node->name) === 'define') {
|
||||
if (!isset($node->args[0]) || !($node->args[0]->value instanceof Node\Scalar\String_)) {
|
||||
return null;
|
||||
}
|
||||
return (string)$node->args[0]->value->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ class Index implements ReadableIndex, \Serializable
|
|||
* Registers a definition
|
||||
*
|
||||
* @param string $fqn The fully qualified name of the symbol
|
||||
* @param string $definition The Definition object
|
||||
* @param Definition $definition The Definition object
|
||||
* @return void
|
||||
*/
|
||||
public function setDefinition(string $fqn, Definition $definition)
|
||||
|
|
|
@ -50,9 +50,18 @@ class SymbolInformation
|
|||
{
|
||||
$parent = $node->getAttribute('parentNode');
|
||||
$symbol = new self;
|
||||
if ($node instanceof Node\Stmt\Class_) {
|
||||
$symbol->kind = SymbolKind::CLASS_;
|
||||
} else if ($node instanceof Node\Stmt\Trait_) {
|
||||
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_
|
||||
) {
|
||||
// constants with define() like
|
||||
// define('TEST_PROPERTY', true);
|
||||
$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_;
|
||||
} else if ($node instanceof Node\Stmt\Interface_) {
|
||||
$symbol->kind = SymbolKind::INTERFACE;
|
||||
|
@ -60,6 +69,8 @@ class SymbolInformation
|
|||
$symbol->kind = SymbolKind::NAMESPACE;
|
||||
} else if ($node instanceof Node\Stmt\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) {
|
||||
$symbol->kind = SymbolKind::METHOD;
|
||||
} else if ($node instanceof Node\Stmt\PropertyProperty) {
|
||||
|
|
|
@ -57,7 +57,7 @@ class LanguageServerTest extends TestCase
|
|||
if ($msg->body->method === 'window/logMessage' && $promise->state === Promise::PENDING) {
|
||||
if ($msg->body->params->type === MessageType::ERROR) {
|
||||
$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();
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ class LanguageServerTest extends TestCase
|
|||
if ($promise->state === Promise::PENDING) {
|
||||
$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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,10 @@ class DefinitionCollectorTest extends TestCase
|
|||
'TestNamespace\\TestTrait',
|
||||
'TestNamespace\\TestInterface',
|
||||
'TestNamespace\\test_function()',
|
||||
'TestNamespace\\ChildClass'
|
||||
'TestNamespace\\ChildClass',
|
||||
'TestNamespace\\Example',
|
||||
'TestNamespace\\Example->__construct()',
|
||||
'TestNamespace\\Example->__destruct()'
|
||||
], array_keys($defNodes));
|
||||
$this->assertInstanceOf(Node\Const_::class, $defNodes['TestNamespace\\TEST_CONST']);
|
||||
$this->assertInstanceOf(Node\Stmt\Class_::class, $defNodes['TestNamespace\\TestClass']);
|
||||
|
@ -63,6 +66,9 @@ class DefinitionCollectorTest extends TestCase
|
|||
$this->assertInstanceOf(Node\Stmt\Interface_::class, $defNodes['TestNamespace\\TestInterface']);
|
||||
$this->assertInstanceOf(Node\Stmt\Function_::class, $defNodes['TestNamespace\\test_function()']);
|
||||
$this->assertInstanceOf(Node\Stmt\Class_::class, $defNodes['TestNamespace\\ChildClass']);
|
||||
$this->assertInstanceOf(Node\Stmt\Class_::class, $defNodes['TestNamespace\\Example']);
|
||||
$this->assertInstanceOf(Node\Stmt\ClassMethod::class, $defNodes['TestNamespace\\Example->__construct()']);
|
||||
$this->assertInstanceOf(Node\Stmt\ClassMethod::class, $defNodes['TestNamespace\\Example->__destruct()']);
|
||||
}
|
||||
|
||||
public function testDoesNotCollectReferences()
|
||||
|
|
|
@ -72,6 +72,7 @@ abstract class ServerTestCase extends TestCase
|
|||
$this->definitionLocations = [
|
||||
|
||||
// Global
|
||||
'TEST_PROPERTY' => new Location($globalSymbolsUri, new Range(new Position(104, 0), new Position(104, 30))),
|
||||
'TEST_CONST' => new Location($globalSymbolsUri, new Range(new Position( 9, 6), new Position( 9, 22))),
|
||||
'TestClass' => new Location($globalSymbolsUri, new Range(new Position(20, 0), new Position(61, 1))),
|
||||
'ChildClass' => new Location($globalSymbolsUri, new Range(new Position(99, 0), new Position(99, 37))),
|
||||
|
@ -99,7 +100,10 @@ abstract class ServerTestCase extends TestCase
|
|||
'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\\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 = [
|
||||
|
@ -160,6 +164,9 @@ abstract class ServerTestCase extends TestCase
|
|||
],
|
||||
|
||||
// Global
|
||||
'TEST_PROPERTY' => [
|
||||
0 => new Location($globalSymbolsUri, new Range(new Position(106, 6), new Position(106, 19)))
|
||||
],
|
||||
'TEST_CONST' => [
|
||||
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)))
|
||||
|
|
|
@ -160,7 +160,12 @@ class CompletionTest extends TestCase
|
|||
'TestClass',
|
||||
CompletionItemKind::CLASS_,
|
||||
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,
|
||||
'\TestClass'
|
||||
|
@ -179,7 +184,12 @@ class CompletionTest extends TestCase
|
|||
'TestClass',
|
||||
CompletionItemKind::CLASS_,
|
||||
'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,
|
||||
'TestClass'
|
||||
|
@ -193,6 +203,15 @@ class CompletionTest extends TestCase
|
|||
null,
|
||||
'\TestNamespace\ChildClass'
|
||||
),
|
||||
new CompletionItem(
|
||||
'Example',
|
||||
CompletionItemKind::CLASS_,
|
||||
'TestNamespace',
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
'\TestNamespace\Example'
|
||||
)
|
||||
], true), $items);
|
||||
}
|
||||
|
||||
|
@ -209,7 +228,12 @@ class CompletionTest extends TestCase
|
|||
'TestClass',
|
||||
CompletionItemKind::CLASS_,
|
||||
'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.'
|
||||
)
|
||||
], true), $items);
|
||||
}
|
||||
|
@ -347,7 +371,12 @@ class CompletionTest extends TestCase
|
|||
'TestClass',
|
||||
CompletionItemKind::CLASS_,
|
||||
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,
|
||||
'TestClass'
|
||||
|
|
|
@ -30,6 +30,9 @@ class DocumentSymbolTest extends ServerTestCase
|
|||
new SymbolInformation('TestInterface', SymbolKind::INTERFACE, $this->getDefinitionLocation('TestNamespace\\TestInterface'), '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('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);
|
||||
// @codingStandardsIgnoreEnd
|
||||
}
|
||||
|
|
|
@ -22,7 +22,12 @@ class HoverTest extends ServerTestCase
|
|||
)->wait();
|
||||
$this->assertEquals(new Hover([
|
||||
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.'
|
||||
], $reference->range), $result);
|
||||
}
|
||||
|
||||
|
@ -37,7 +42,12 @@ class HoverTest extends ServerTestCase
|
|||
)->wait();
|
||||
$this->assertEquals(new Hover([
|
||||
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.'
|
||||
], $definition->range), $result);
|
||||
}
|
||||
|
||||
|
@ -146,6 +156,21 @@ class HoverTest extends ServerTestCase
|
|||
], $reference->range), $result);
|
||||
}
|
||||
|
||||
public function testHoverForGlobalConstant()
|
||||
{
|
||||
// print TEST_PROPERTY ? 'true' : 'false';
|
||||
// Get hover for TEST_PROPERTY
|
||||
$reference = $this->getReferenceLocations('TEST_PROPERTY')[0];
|
||||
$result = $this->textDocument->hover(
|
||||
new TextDocumentIdentifier($reference->uri),
|
||||
$reference->range->end
|
||||
)->wait();
|
||||
$this->assertEquals(new Hover([
|
||||
new MarkedString('php', "<?php\n\\define('TEST_PROPERTY', \\false);"),
|
||||
'Lorem ipsum dolor sit amet, consectetur.'
|
||||
], $reference->range), $result);
|
||||
}
|
||||
|
||||
public function testHoverForVariable()
|
||||
{
|
||||
// echo $var;
|
||||
|
@ -181,7 +206,12 @@ class HoverTest extends ServerTestCase
|
|||
$result = $this->textDocument->hover(new TextDocumentIdentifier($uri), new Position(59, 11))->wait();
|
||||
$this->assertEquals(new Hover([
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,9 @@ class SymbolTest extends ServerTestCase
|
|||
new SymbolInformation('TestInterface', SymbolKind::INTERFACE, $this->getDefinitionLocation('TestNamespace\\TestInterface'), '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('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
|
||||
new SymbolInformation('TEST_CONST', SymbolKind::CONSTANT, $this->getDefinitionLocation('TEST_CONST'), ''),
|
||||
|
@ -55,6 +58,7 @@ class SymbolTest extends ServerTestCase
|
|||
new SymbolInformation('TestInterface', SymbolKind::INTERFACE, $this->getDefinitionLocation('TestInterface'), ''),
|
||||
new SymbolInformation('test_function', SymbolKind::FUNCTION, $this->getDefinitionLocation('test_function()'), ''),
|
||||
new SymbolInformation('ChildClass', SymbolKind::CLASS_, $this->getDefinitionLocation('ChildClass'), ''),
|
||||
new SymbolInformation('define', SymbolKind::CONSTANT, $this->getDefinitionLocation('TEST_PROPERTY'), ''),
|
||||
new SymbolInformation('whatever', SymbolKind::FUNCTION, $this->getDefinitionLocation('whatever()'), ''),
|
||||
|
||||
new SymbolInformation('SecondTestNamespace', SymbolKind::NAMESPACE, $this->getDefinitionLocation('SecondTestNamespace'), '')
|
||||
|
|
Loading…
Reference in New Issue