1
0
Fork 0

Merge branch 'master' into jens1o-keywords

pull/396/head
Felix Becker 2017-06-10 18:29:59 +02:00 committed by GitHub
commit 755505a5c1
61 changed files with 368 additions and 72 deletions

View File

@ -0,0 +1,11 @@
<?php
class FooClass {
public function foo(): FooClass {
return $this;
}
}
$fc = new FooClass();
$foo = $fc->foo();
$foo->

View File

@ -0,0 +1,12 @@
<?php
class FooClass {
public static function staticFoo(): FooClass {
return new FooClass();
}
public function bar() { }
}
$foo = FooClass::staticFoo();
$foo->

View File

@ -105,3 +105,15 @@ class ChildClass extends TestClass {}
define('TEST_DEFINE_CONSTANT', false); define('TEST_DEFINE_CONSTANT', false);
print TEST_DEFINE_CONSTANT ? 'true' : 'false'; print TEST_DEFINE_CONSTANT ? 'true' : 'false';
/**
* Neither this class nor its members are referenced anywhere
*/
class UnusedClass
{
public $unusedProperty;
public function unusedMethod()
{
}
}

View File

@ -623,6 +623,16 @@ class DefinitionResolver
} }
} }
// MEMBER CALL EXPRESSION/SCOPED PROPERTY CALL EXPRESSION
// The type of the member/scoped property call expression is the type of the method, so resolve the
// type of the callable expression.
if ($expr instanceof Node\Expression\CallExpression && (
$expr->callableExpression instanceof Node\Expression\MemberAccessExpression ||
$expr->callableExpression instanceof Node\Expression\ScopedPropertyAccessExpression)
) {
return $this->resolveExpressionNodeToType($expr->callableExpression);
}
// MEMBER ACCESS EXPRESSION // MEMBER ACCESS EXPRESSION
if ($expr instanceof Node\Expression\MemberAccessExpression) { if ($expr instanceof Node\Expression\MemberAccessExpression) {
if ($expr->memberName instanceof Node\Expression) { if ($expr->memberName instanceof Node\Expression) {

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 27 PHP files parsed') !== false) { } else if (preg_match('/All \d+ PHP files parsed/', $msg->body->params->message)) {
$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 27 PHP files parsed') !== false) { } else if (preg_match('/All \d+ PHP files parsed/', $msg->body->params->message)) {
$promise->fulfill(); $promise->fulfill();
} }
} }

View File

@ -85,6 +85,9 @@ abstract class ServerTestCase extends TestCase
'TestClass::staticTestMethod()' => new Location($globalSymbolsUri, new Range(new Position(46, 4), new Position(49, 5))), 'TestClass::staticTestMethod()' => new Location($globalSymbolsUri, new Range(new Position(46, 4), new Position(49, 5))),
'TestClass::testMethod()' => new Location($globalSymbolsUri, new Range(new Position(57, 4), new Position(60, 5))), 'TestClass::testMethod()' => new Location($globalSymbolsUri, new Range(new Position(57, 4), new Position(60, 5))),
'test_function()' => new Location($globalSymbolsUri, new Range(new Position(78, 0), new Position(81, 1))), 'test_function()' => new Location($globalSymbolsUri, new Range(new Position(78, 0), new Position(81, 1))),
'UnusedClass' => new Location($globalSymbolsUri, new Range(new Position(111, 0), new Position(118, 1))),
'UnusedClass::unusedProperty' => new Location($globalSymbolsUri, new Range(new Position(113,11), new Position(113, 26))),
'UnusedClass::unusedMethod' => new Location($globalSymbolsUri, new Range(new Position(115, 4), new Position(117, 5))),
'whatever()' => new Location($globalReferencesUri, new Range(new Position(21, 0), new Position(23, 1))), 'whatever()' => new Location($globalReferencesUri, new Range(new Position(21, 0), new Position(23, 1))),
// Namespaced // Namespaced

View File

@ -499,6 +499,50 @@ class CompletionTest extends TestCase
], true), $items); ], true), $items);
} }
public function testMethodReturnType()
{
$completionUri = pathToUri(__DIR__ . '/../../../fixtures/completion/method_return_type.php');
$this->loader->open($completionUri, file_get_contents($completionUri));
$items = $this->textDocument->completion(
new TextDocumentIdentifier($completionUri),
new Position(10, 6)
)->wait();
$this->assertCompletionsListSubset(new CompletionList([
new CompletionItem(
'foo',
CompletionItemKind::METHOD,
'\FooClass',
null,
null,
null,
null,
null
)
], true), $items);
}
public function testStaticMethodReturnType()
{
$completionUri = pathToUri(__DIR__ . '/../../../fixtures/completion/static_method_return_type.php');
$this->loader->open($completionUri, file_get_contents($completionUri));
$items = $this->textDocument->completion(
new TextDocumentIdentifier($completionUri),
new Position(11, 6)
)->wait();
$this->assertCompletionsListSubset(new CompletionList([
new CompletionItem(
'bar',
CompletionItemKind::METHOD,
'mixed',
null,
null,
null,
null,
null
)
], true), $items);
}
private function assertCompletionsListSubset(CompletionList $subsetList, CompletionList $list) private function assertCompletionsListSubset(CompletionList $subsetList, CompletionList $list)
{ {
foreach ($subsetList->items as $expectedItem) { foreach ($subsetList->items as $expectedItem) {

View File

@ -159,4 +159,43 @@ class GlobalTest extends ServerTestCase
)->wait(); )->wait();
$this->assertEquals($this->getReferenceLocations('TestClass'), $result); $this->assertEquals($this->getReferenceLocations('TestClass'), $result);
} }
public function testReferencesForUnusedClass()
{
// class UnusedClass
// Get references for UnusedClass
$symbolsUri = pathToUri(realpath(__DIR__ . '/../../../../fixtures/global_symbols.php'));
$result = $this->textDocument->references(
new ReferenceContext,
new TextDocumentIdentifier($symbolsUri),
new Position(111, 10)
)->wait();
$this->assertEquals([], $result);
}
public function testReferencesForUnusedProperty()
{
// public $unusedProperty
// Get references for unusedProperty
$symbolsUri = pathToUri(realpath(__DIR__ . '/../../../../fixtures/global_symbols.php'));
$result = $this->textDocument->references(
new ReferenceContext,
new TextDocumentIdentifier($symbolsUri),
new Position(113, 18)
)->wait();
$this->assertEquals([], $result);
}
public function testReferencesForUnusedMethod()
{
// public function unusedMethod()
// Get references for unusedMethod
$symbolsUri = pathToUri(realpath(__DIR__ . '/../../../../fixtures/global_symbols.php'));
$result = $this->textDocument->references(
new ReferenceContext,
new TextDocumentIdentifier($symbolsUri),
new Position(115, 26)
)->wait();
$this->assertEquals([], $result);
}
} }

View File

@ -27,6 +27,7 @@ class SymbolTest extends ServerTestCase
// Request symbols // Request symbols
$result = $this->workspace->symbol('')->wait(); $result = $this->workspace->symbol('')->wait();
$referencesUri = pathToUri(realpath(__DIR__ . '/../../../fixtures/references.php')); $referencesUri = pathToUri(realpath(__DIR__ . '/../../../fixtures/references.php'));
// @codingStandardsIgnoreStart // @codingStandardsIgnoreStart
$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))), ''),
@ -59,9 +60,12 @@ class SymbolTest extends ServerTestCase
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('TEST_DEFINE_CONSTANT', SymbolKind::CONSTANT, $this->getDefinitionLocation('TEST_DEFINE_CONSTANT'), ''), new SymbolInformation('TEST_DEFINE_CONSTANT', SymbolKind::CONSTANT, $this->getDefinitionLocation('TEST_DEFINE_CONSTANT'), ''),
new SymbolInformation('UnusedClass', SymbolKind::CLASS_, $this->getDefinitionLocation('UnusedClass'), ''),
new SymbolInformation('unusedProperty', SymbolKind::PROPERTY, $this->getDefinitionLocation('UnusedClass::unusedProperty'), 'UnusedClass'),
new SymbolInformation('unusedMethod', SymbolKind::METHOD, $this->getDefinitionLocation('UnusedClass::unusedMethod'), 'UnusedClass'),
new SymbolInformation('whatever', SymbolKind::FUNCTION, $this->getDefinitionLocation('whatever()'), ''), 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
} }

View File

@ -64,12 +64,7 @@ class ValidationTest extends TestCase
try { try {
$this->assertEquals($expectedValues['definitions'], $actualValues['definitions']); $this->assertEquals($expectedValues['definitions'], $actualValues['definitions']);
try {
$this->assertArraySubset((array)$expectedValues['references'], (array)$actualValues['references'], false, 'references don\'t match.');
} catch (\Throwable $e) {
$this->assertEquals((array)$expectedValues['references'], (array)$actualValues['references'], 'references don\'t match.'); $this->assertEquals((array)$expectedValues['references'], (array)$actualValues['references'], 'references don\'t match.');
}
} catch (\Throwable $e) { } catch (\Throwable $e) {
$outputFile = getExpectedValuesFile($testCaseFile); $outputFile = getExpectedValuesFile($testCaseFile);
file_put_contents($outputFile, json_encode($actualValues, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); file_put_contents($outputFile, json_encode($actualValues, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES));
@ -137,8 +132,7 @@ class ValidationTest extends TestCase
} elseif ($propertyName === 'extends') { } elseif ($propertyName === 'extends') {
$definition->$propertyName = $definition->$propertyName ?? []; $definition->$propertyName = $definition->$propertyName ?? [];
} elseif ($propertyName === 'type' && $definition->type !== null) { } elseif ($propertyName === 'type' && $definition->type !== null) {
// Class info is not captured by json_encode. It's important for 'type'. $defsForAssert[$fqn]['type__tostring'] = (string)$definition->type;
$defsForAssert[$fqn]['type__class'] = get_class($definition->type);
} }
$defsForAssert[$fqn][$propertyName] = $definition->$propertyName; $defsForAssert[$fqn][$propertyName] = $definition->$propertyName;

View File

@ -6,6 +6,12 @@
"self": [ "self": [
"./WithReturnTypehints.php" "./WithReturnTypehints.php"
], ],
"Fixtures\\Prophecy\\__CLASS__": [
"./WithReturnTypehints.php"
],
"__CLASS__": [
"./WithReturnTypehints.php"
],
"parent": [ "parent": [
"./WithReturnTypehints.php" "./WithReturnTypehints.php"
] ]
@ -63,7 +69,7 @@
}, },
"containerName": "Fixtures\\Prophecy\\WithReturnTypehints" "containerName": "Fixtures\\Prophecy\\WithReturnTypehints"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Object_", "type__tostring": "\\self",
"type": {}, "type": {},
"declarationLine": "public function getSelf(): self {", "declarationLine": "public function getSelf(): self {",
"documentation": null "documentation": null
@ -82,7 +88,7 @@
}, },
"containerName": "Fixtures\\Prophecy\\WithReturnTypehints" "containerName": "Fixtures\\Prophecy\\WithReturnTypehints"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\String_", "type__tostring": "string",
"type": {}, "type": {},
"declarationLine": "public function getName(): string {", "declarationLine": "public function getName(): string {",
"documentation": null "documentation": null
@ -101,7 +107,7 @@
}, },
"containerName": "Fixtures\\Prophecy\\WithReturnTypehints" "containerName": "Fixtures\\Prophecy\\WithReturnTypehints"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Object_", "type__tostring": "\\parent",
"type": {}, "type": {},
"declarationLine": "public function getParent(): parent {", "declarationLine": "public function getParent(): parent {",
"documentation": null "documentation": null

View File

@ -33,7 +33,7 @@
}, },
"containerName": "A" "containerName": "A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Array_", "type__tostring": "string[]",
"type": {}, "type": {},
"declarationLine": "protected $foo;", "declarationLine": "protected $foo;",
"documentation": null "documentation": null

View File

@ -58,7 +58,7 @@
}, },
"containerName": "TestNamespace\\A" "containerName": "TestNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Integer", "type__tostring": "int",
"type": {}, "type": {},
"declarationLine": "public $a;", "declarationLine": "public $a;",
"documentation": null "documentation": null

View File

@ -58,7 +58,7 @@
}, },
"containerName": "TestNamespace\\TestClass" "containerName": "TestNamespace\\TestClass"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "public $testProperty;", "declarationLine": "public $testProperty;",
"documentation": null "documentation": null
@ -77,7 +77,7 @@
}, },
"containerName": "TestNamespace\\TestClass" "containerName": "TestNamespace\\TestClass"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "public function testMethod($testParameter)", "declarationLine": "public function testMethod($testParameter)",
"documentation": null "documentation": null

View File

@ -58,7 +58,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "public static function suite()", "declarationLine": "public static function suite()",
"documentation": null "documentation": null

View File

@ -58,7 +58,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "public static function suite()", "declarationLine": "public static function suite()",
"documentation": null "documentation": null

View File

@ -58,7 +58,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "public static function suite()", "declarationLine": "public static function suite()",
"documentation": null "documentation": null

View File

@ -58,7 +58,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "public function suite()", "declarationLine": "public function suite()",
"documentation": null "documentation": null

View File

@ -55,7 +55,7 @@
}, },
"containerName": "MyNamespace\\Mbstring" "containerName": "MyNamespace\\Mbstring"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Object_", "type__tostring": "\\MyNamespace\\PHP_INT_MAX",
"type": {}, "type": {},
"declarationLine": "const MB_CASE_FOLD = PHP_INT_MAX;", "declarationLine": "const MB_CASE_FOLD = PHP_INT_MAX;",
"documentation": null "documentation": null

View File

@ -37,7 +37,7 @@
}, },
"containerName": "A" "containerName": "A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function b ($a = MY_CONSTANT);", "declarationLine": "function b ($a = MY_CONSTANT);",
"documentation": null "documentation": null

View File

@ -1,5 +1,9 @@
{ {
"references": [], "references": {
"MyNamespace\\Exception": [
"./exceptions1.php"
]
},
"definitions": { "definitions": {
"MyNamespace": { "MyNamespace": {
"fqn": "MyNamespace", "fqn": "MyNamespace",

View File

@ -3,6 +3,9 @@
"LanguageServer": [ "LanguageServer": [
"./functionUse2.php" "./functionUse2.php"
], ],
"LanguageServer\\pathToUri()": [
"./functionUse2.php"
],
"LanguageServer\\timeout()": [ "LanguageServer\\timeout()": [
"./functionUse2.php" "./functionUse2.php"
] ]

View File

@ -1,5 +1,12 @@
{ {
"references": [], "references": {
"B\\__FILE__": [
"./magicConstantsShouldBeGlobal.php"
],
"__FILE__": [
"./magicConstantsShouldBeGlobal.php"
]
},
"definitions": { "definitions": {
"B": { "B": {
"fqn": "B", "fqn": "B",

View File

@ -1,5 +1,9 @@
{ {
"references": [], "references": {
"__CLASS__": [
"./magicConsts.php"
]
},
"definitions": { "definitions": {
"A": { "A": {
"fqn": "A", "fqn": "A",
@ -33,7 +37,7 @@
}, },
"containerName": "A" "containerName": "A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Array_", "type__tostring": "\\__CLASS__[]",
"type": {}, "type": {},
"declarationLine": "private static $deprecationsTriggered;", "declarationLine": "private static $deprecationsTriggered;",
"documentation": null "documentation": null

View File

@ -58,7 +58,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "static function a() {", "declarationLine": "static function a() {",
"documentation": null "documentation": null

View File

@ -58,7 +58,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "static function a() {", "declarationLine": "static function a() {",
"documentation": null "documentation": null

View File

@ -73,7 +73,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "public static function getInitializer(ClassLoader $loader)", "declarationLine": "public static function getInitializer(ClassLoader $loader)",
"documentation": null "documentation": null

View File

@ -64,7 +64,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "public function testRequest()", "declarationLine": "public function testRequest()",
"documentation": null "documentation": null

View File

@ -1,5 +1,9 @@
{ {
"references": [], "references": {
"MyNamespace\\ParseErrorsTest->args": [
"./memberAccess5.php"
]
},
"definitions": { "definitions": {
"MyNamespace": { "MyNamespace": {
"fqn": "MyNamespace", "fqn": "MyNamespace",
@ -51,7 +55,7 @@
}, },
"containerName": "MyNamespace\\ParseErrorsTest" "containerName": "MyNamespace\\ParseErrorsTest"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "public function setUp()", "declarationLine": "public function setUp()",
"documentation": null "documentation": null

View File

@ -61,7 +61,7 @@
}, },
"containerName": "MyNamespace\\ParseErrorsTest" "containerName": "MyNamespace\\ParseErrorsTest"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "public function setAccount(AccountInterface $account)", "declarationLine": "public function setAccount(AccountInterface $account)",
"documentation": null "documentation": null

View File

@ -0,0 +1,7 @@
<?php
class FooClass {
public function foo(): FooClass {
return $this;
}
}

View File

@ -0,0 +1,46 @@
{
"references": {
"FooClass": [
"./methodReturnType.php"
]
},
"definitions": {
"FooClass": {
"fqn": "FooClass",
"extends": [],
"isGlobal": true,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
"name": "FooClass",
"kind": 5,
"location": {
"uri": "./methodReturnType.php"
},
"containerName": ""
},
"type": null,
"declarationLine": "class FooClass {",
"documentation": null
},
"FooClass->foo()": {
"fqn": "FooClass->foo()",
"extends": [],
"isGlobal": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
"name": "foo",
"kind": 6,
"location": {
"uri": "./methodReturnType.php"
},
"containerName": "FooClass"
},
"type__tostring": "\\FooClass",
"type": {},
"declarationLine": "public function foo(): FooClass {",
"documentation": null
}
}
}

View File

@ -64,7 +64,7 @@
}, },
"containerName": "MyNamespace1\\B" "containerName": "MyNamespace1\\B"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function b() {", "declarationLine": "function b() {",
"documentation": null "documentation": null
@ -121,7 +121,7 @@
}, },
"containerName": "MyNamespace2\\A" "containerName": "MyNamespace2\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function a () {", "declarationLine": "function a () {",
"documentation": null "documentation": null

View File

@ -33,7 +33,7 @@
}, },
"containerName": "Foo" "containerName": "Foo"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Object_", "type__tostring": "\\Iterator",
"type": {}, "type": {},
"declarationLine": "public function fn()", "declarationLine": "public function fn()",
"documentation": "Foo" "documentation": "Foo"

View File

@ -33,7 +33,7 @@
}, },
"containerName": "A" "containerName": "A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function b() {", "declarationLine": "function b() {",
"documentation": null "documentation": null

View File

@ -2,6 +2,12 @@
"references": { "references": {
"LanguageServer": [ "LanguageServer": [
"./namespaces8.php" "./namespaces8.php"
],
"LanguageServer\\pathToUri()": [
"./namespaces8.php"
],
"LanguageServer\\uriToPath()": [
"./namespaces8.php"
] ]
}, },
"definitions": { "definitions": {

View File

@ -55,7 +55,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function a () {", "declarationLine": "function a () {",
"documentation": null "documentation": null

View File

@ -76,7 +76,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function a () {", "declarationLine": "function a () {",
"documentation": null "documentation": null

View File

@ -37,7 +37,7 @@
}, },
"containerName": "A" "containerName": "A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function a () {", "declarationLine": "function a () {",
"documentation": null "documentation": null

View File

@ -37,7 +37,7 @@
}, },
"containerName": "MyNamespace" "containerName": "MyNamespace"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function init(Hi $view)", "declarationLine": "function init(Hi $view)",
"documentation": null "documentation": null

View File

@ -58,7 +58,7 @@
}, },
"containerName": "MyNamespace\\B" "containerName": "MyNamespace\\B"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function b() {", "declarationLine": "function b() {",
"documentation": null "documentation": null
@ -97,7 +97,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function a () {", "declarationLine": "function a () {",
"documentation": null "documentation": null

View File

@ -61,7 +61,7 @@
}, },
"containerName": "MyNamespace\\B" "containerName": "MyNamespace\\B"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function b() {", "declarationLine": "function b() {",
"documentation": null "documentation": null
@ -100,7 +100,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function a () {", "declarationLine": "function a () {",
"documentation": null "documentation": null

View File

@ -33,7 +33,7 @@
}, },
"containerName": "MyClass" "containerName": "MyClass"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\String_", "type__tostring": "string",
"type": {}, "type": {},
"declarationLine": "protected $mainPropertyName;", "declarationLine": "protected $mainPropertyName;",
"documentation": "The name of the main property, or NULL if there is none." "documentation": "The name of the main property, or NULL if there is none."

View File

@ -33,7 +33,7 @@
}, },
"containerName": "MyClass" "containerName": "MyClass"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\String_", "type__tostring": "string",
"type": {}, "type": {},
"declarationLine": "protected $mainPropertyName;", "declarationLine": "protected $mainPropertyName;",
"documentation": "The name of the main property, or NULL if there is none." "documentation": "The name of the main property, or NULL if there is none."

View File

@ -40,7 +40,7 @@
}, },
"containerName": "TestNamespace" "containerName": "TestNamespace"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Object_", "type__tostring": "\\TestNamespace\\TestClass",
"type": {}, "type": {},
"declarationLine": "function whatever(TestClass $param): TestClass2 {", "declarationLine": "function whatever(TestClass $param): TestClass2 {",
"documentation": "Aute duis elit reprehenderit tempor cillum proident anim laborum eu laboris reprehenderit ea incididunt." "documentation": "Aute duis elit reprehenderit tempor cillum proident anim laborum eu laboris reprehenderit ea incididunt."

View File

@ -58,7 +58,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "static function a() {", "declarationLine": "static function a() {",
"documentation": null "documentation": null

View File

@ -40,7 +40,7 @@
}, },
"containerName": "A" "containerName": "A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\String_", "type__tostring": "string",
"type": {}, "type": {},
"declarationLine": "static $a;", "declarationLine": "static $a;",
"documentation": null "documentation": null

View File

@ -46,7 +46,7 @@
}, },
"containerName": "TestClass" "containerName": "TestClass"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Array_", "type__tostring": "\\TestClass[]",
"type": {}, "type": {},
"declarationLine": "public static $testProperty;", "declarationLine": "public static $testProperty;",
"documentation": "Lorem excepteur officia sit anim velit veniam enim." "documentation": "Lorem excepteur officia sit anim velit veniam enim."

View File

@ -61,7 +61,7 @@
}, },
"containerName": "MyNamespace\\B" "containerName": "MyNamespace\\B"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function b() {", "declarationLine": "function b() {",
"documentation": null "documentation": null
@ -100,7 +100,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function a () {", "declarationLine": "function a () {",
"documentation": null "documentation": null

View File

@ -61,7 +61,7 @@
}, },
"containerName": "MyNamespace\\B" "containerName": "MyNamespace\\B"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function b() {", "declarationLine": "function b() {",
"documentation": null "documentation": null
@ -100,7 +100,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function a () {", "declarationLine": "function a () {",
"documentation": null "documentation": null

View File

@ -61,7 +61,7 @@
}, },
"containerName": "MyNamespace\\B" "containerName": "MyNamespace\\B"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function b() {", "declarationLine": "function b() {",
"documentation": null "documentation": null
@ -100,7 +100,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function a () {", "declarationLine": "function a () {",
"documentation": null "documentation": null

View File

@ -6,6 +6,12 @@
"MyNamespace\\A->addTestFile()": [ "MyNamespace\\A->addTestFile()": [
"./self4.php" "./self4.php"
], ],
"MyNamespace\\__DIR__": [
"./self4.php"
],
"__DIR__": [
"./self4.php"
],
"MyNamespace\\DS": [ "MyNamespace\\DS": [
"./self4.php" "./self4.php"
], ],
@ -64,7 +70,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "public static function suite()", "declarationLine": "public static function suite()",
"documentation": null "documentation": null

View File

@ -55,7 +55,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "public function typesProvider()", "declarationLine": "public function typesProvider()",
"documentation": null "documentation": null

View File

@ -61,7 +61,7 @@
}, },
"containerName": "MyNamespace\\B" "containerName": "MyNamespace\\B"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function b() {", "declarationLine": "function b() {",
"documentation": null "documentation": null
@ -100,7 +100,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function a () {", "declarationLine": "function a () {",
"documentation": null "documentation": null

View File

@ -61,7 +61,7 @@
}, },
"containerName": "MyNamespace\\B" "containerName": "MyNamespace\\B"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function b() {", "declarationLine": "function b() {",
"documentation": null "documentation": null
@ -100,7 +100,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function a () {", "declarationLine": "function a () {",
"documentation": null "documentation": null

View File

@ -61,7 +61,7 @@
}, },
"containerName": "MyNamespace\\B" "containerName": "MyNamespace\\B"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function b() {", "declarationLine": "function b() {",
"documentation": null "documentation": null
@ -100,7 +100,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function a () {", "declarationLine": "function a () {",
"documentation": null "documentation": null

View File

@ -60,7 +60,7 @@
}, },
"containerName": "MyNamespace\\A" "containerName": "MyNamespace\\A"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function a () {", "declarationLine": "function a () {",
"documentation": null "documentation": null

View File

@ -0,0 +1,9 @@
<?php
class FooClass {
public static function staticFoo(): FooClass {
return new FooClass();
}
public function bar() { }
}

View File

@ -0,0 +1,65 @@
{
"references": {
"FooClass": [
"./staticMethodReturnType.php"
]
},
"definitions": {
"FooClass": {
"fqn": "FooClass",
"extends": [],
"isGlobal": true,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
"name": "FooClass",
"kind": 5,
"location": {
"uri": "./staticMethodReturnType.php"
},
"containerName": ""
},
"type": null,
"declarationLine": "class FooClass {",
"documentation": null
},
"FooClass::staticFoo()": {
"fqn": "FooClass::staticFoo()",
"extends": [],
"isGlobal": false,
"isStatic": true,
"canBeInstantiated": false,
"symbolInformation": {
"name": "staticFoo",
"kind": 6,
"location": {
"uri": "./staticMethodReturnType.php"
},
"containerName": "FooClass"
},
"type__tostring": "\\FooClass",
"type": {},
"declarationLine": "public static function staticFoo(): FooClass {",
"documentation": null
},
"FooClass->bar()": {
"fqn": "FooClass->bar()",
"extends": [],
"isGlobal": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
"name": "bar",
"kind": 6,
"location": {
"uri": "./staticMethodReturnType.php"
},
"containerName": "FooClass"
},
"type__tostring": "mixed",
"type": {},
"declarationLine": "public function bar() { }",
"documentation": null
}
}
}

View File

@ -33,7 +33,7 @@
}, },
"containerName": "B" "containerName": "B"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Integer", "type__tostring": "int",
"type": {}, "type": {},
"declarationLine": "public $hi;", "declarationLine": "public $hi;",
"documentation": null "documentation": null
@ -52,7 +52,7 @@
}, },
"containerName": "B" "containerName": "B"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "function a () {", "declarationLine": "function a () {",
"documentation": null "documentation": null

View File

@ -40,7 +40,7 @@
}, },
"containerName": "Foo" "containerName": "Foo"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Object_", "type__tostring": "\\",
"type": {}, "type": {},
"declarationLine": "protected $bar;", "declarationLine": "protected $bar;",
"documentation": null "documentation": null
@ -59,7 +59,7 @@
}, },
"containerName": "Foo" "containerName": "Foo"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__tostring": "mixed",
"type": {}, "type": {},
"declarationLine": "public function foo () {", "declarationLine": "public function foo () {",
"documentation": null "documentation": null