1
0
Fork 0

Merge branch 'master' into newStatic

pull/405/head
Felix Becker 2017-06-13 16:00:40 +02:00 committed by GitHub
commit ec9bdf9ab8
66 changed files with 403 additions and 100 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);
print TEST_DEFINE_CONSTANT ? 'true' : 'false';
/**
* Neither this class nor its members are referenced anywhere
*/
class UnusedClass
{
public $unusedProperty;
public function unusedMethod()
{
}
}

View File

@ -49,6 +49,7 @@ class CompletionProvider
'eval',
'exit',
'extends',
'false',
'final',
'finally',
'for',
@ -67,6 +68,7 @@ class CompletionProvider
'list',
'namespace',
'new',
'null',
'or',
'print',
'private',
@ -79,6 +81,7 @@ class CompletionProvider
'switch',
'throw',
'trait',
'true',
'try',
'unset',
'use',

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
if ($expr instanceof Node\Expression\MemberAccessExpression) {
if ($expr->memberName instanceof Node\Expression) {

View File

@ -22,7 +22,11 @@ class FileSystemFilesFinder implements FilesFinder
return coroutine(function () use ($glob) {
$uris = [];
foreach (new GlobIterator($glob) as $path) {
// Exclude any directories that also match the glob pattern
if (!is_dir($path)) {
$uris[] = pathToUri($path);
}
yield timeout();
}
return $uris;

View File

@ -56,9 +56,9 @@ class PhpDocument
/**
* The AST of the document
*
* @var Node
* @var Node\SourceFileNode
*/
private $stmts;
private $sourceFileNode;
/**
* Map from fully qualified name (FQN) to Definition
@ -172,7 +172,7 @@ class PhpDocument
$this->index->addReferenceUri($fqn, $this->uri);
}
$this->stmts = $treeAnalyzer->getStmts();
$this->sourceFileNode = $treeAnalyzer->getSourceFileNode();
}
/**
@ -221,11 +221,11 @@ class PhpDocument
/**
* Returns the AST of the document
*
* @return Node | null
* @return Node\SourceFileNode|null
*/
public function getStmts()
public function getSourceFileNode()
{
return $this->stmts;
return $this->sourceFileNode;
}
/**
@ -236,12 +236,12 @@ class PhpDocument
*/
public function getNodeAtPosition(Position $position)
{
if ($this->stmts === null) {
if ($this->sourceFileNode === null) {
return null;
}
$offset = $position->toOffset($this->stmts->getFileContents());
$node = $this->stmts->getDescendantNodeAtPosition($offset);
$offset = $position->toOffset($this->sourceFileNode->getFileContents());
$node = $this->sourceFileNode->getDescendantNodeAtPosition($offset);
if ($node !== null && $node->getStart() > $offset) {
return null;
}

View File

@ -15,8 +15,8 @@ class TreeAnalyzer
/** @var PhpParser\Parser */
private $parser;
/** @var Node */
private $stmts;
/** @var Node\SourceFileNode */
private $sourceFileNode;
/** @var Diagnostic[] */
private $diagnostics;
@ -46,17 +46,17 @@ class TreeAnalyzer
$this->docBlockFactory = $docBlockFactory;
$this->definitionResolver = $definitionResolver;
$this->content = $content;
$this->stmts = $this->parser->parseSourceFile($content, $uri);
$this->sourceFileNode = $this->parser->parseSourceFile($content, $uri);
// TODO - docblock errors
$this->collectDefinitionsAndReferences($this->stmts);
$this->collectDefinitionsAndReferences($this->sourceFileNode);
}
private function collectDefinitionsAndReferences(Node $stmts)
private function collectDefinitionsAndReferences(Node $sourceFileNode)
{
foreach ($stmts::CHILD_NAMES as $name) {
$node = $stmts->$name;
foreach ($sourceFileNode::CHILD_NAMES as $name) {
$node = $sourceFileNode->$name;
if ($node === null) {
continue;
@ -200,10 +200,10 @@ class TreeAnalyzer
}
/**
* @return Node[]
* @return Node\SourceFileNode
*/
public function getStmts()
public function getSourceFileNode()
{
return $this->stmts;
return $this->sourceFileNode;
}
}

View File

@ -14,11 +14,11 @@ class DefinitionResolverTest extends TestCase
{
$parser = new PhpParser\Parser;
$doc = new MockPhpDocument;
$stmts = $parser->parseSourceFile("<?php\ndefine('TEST_DEFINE', true);", $doc->getUri());
$sourceFileNode = $parser->parseSourceFile("<?php\ndefine('TEST_DEFINE', true);", $doc->getUri());
$index = new Index;
$definitionResolver = new DefinitionResolver($index);
$def = $definitionResolver->createDefinitionFromNode($stmts->statementList[1]->expression, '\TEST_DEFINE');
$def = $definitionResolver->createDefinitionFromNode($sourceFileNode->statementList[1]->expression, '\TEST_DEFINE');
$this->assertInstanceOf(\phpDocumentor\Reflection\Types\Boolean::class, $def->type);
}
@ -27,11 +27,11 @@ class DefinitionResolverTest extends TestCase
{
$parser = new PhpParser\Parser;
$doc = new MockPhpDocument;
$stmts = $parser->parseSourceFile("<?php\ndefine('TEST_DEFINE', true);", $doc->getUri());
$sourceFileNode = $parser->parseSourceFile("<?php\ndefine('TEST_DEFINE', true);", $doc->getUri());
$index = new Index;
$definitionResolver = new DefinitionResolver($index);
$type = $definitionResolver->getTypeFromNode($stmts->statementList[1]->expression);
$type = $definitionResolver->getTypeFromNode($sourceFileNode->statementList[1]->expression);
$this->assertInstanceOf(\phpDocumentor\Reflection\Types\Boolean::class, $type);
}
@ -41,11 +41,11 @@ class DefinitionResolverTest extends TestCase
// define('XXX') (only one argument) must not introduce a new symbol
$parser = new PhpParser\Parser;
$doc = new MockPhpDocument;
$stmts = $parser->parseSourceFile("<?php\ndefine('TEST_DEFINE');", $doc->getUri());
$sourceFileNode = $parser->parseSourceFile("<?php\ndefine('TEST_DEFINE');", $doc->getUri());
$index = new Index;
$definitionResolver = new DefinitionResolver($index);
$fqn = $definitionResolver->getDefinedFqn($stmts->statementList[1]->expression);
$fqn = $definitionResolver->getDefinedFqn($sourceFileNode->statementList[1]->expression);
$this->assertNull($fqn);
}
@ -54,11 +54,11 @@ class DefinitionResolverTest extends TestCase
{
$parser = new PhpParser\Parser;
$doc = new MockPhpDocument;
$stmts = $parser->parseSourceFile("<?php\ndefine('TEST_DEFINE', true);", $doc->getUri());
$sourceFileNode = $parser->parseSourceFile("<?php\ndefine('TEST_DEFINE', true);", $doc->getUri());
$index = new Index;
$definitionResolver = new DefinitionResolver($index);
$fqn = $definitionResolver->getDefinedFqn($stmts->statementList[1]->expression);
$fqn = $definitionResolver->getDefinedFqn($sourceFileNode->statementList[1]->expression);
$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->params->type === MessageType::ERROR) {
$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();
}
}
@ -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 27 PHP files parsed') !== false) {
} else if (preg_match('/All \d+ PHP files parsed/', $msg->body->params->message)) {
$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::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))),
'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))),
// Namespaced

View File

@ -499,6 +499,50 @@ class CompletionTest extends TestCase
], 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)
{
foreach ($subsetList->items as $expectedItem) {

View File

@ -159,4 +159,43 @@ class GlobalTest extends ServerTestCase
)->wait();
$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
$result = $this->workspace->symbol('')->wait();
$referencesUri = pathToUri(realpath(__DIR__ . '/../../../fixtures/references.php'));
// @codingStandardsIgnoreStart
$this->assertEquals([
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('ChildClass', SymbolKind::CLASS_, $this->getDefinitionLocation('ChildClass'), ''),
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('SecondTestNamespace', SymbolKind::NAMESPACE, $this->getDefinitionLocation('SecondTestNamespace'), '')
new SymbolInformation('SecondTestNamespace', SymbolKind::NAMESPACE, $this->getDefinitionLocation('SecondTestNamespace'), ''),
], $result);
// @codingStandardsIgnoreEnd
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -61,7 +61,7 @@
},
"containerName": "MyNamespace\\ParseErrorsTest"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "public function setAccount(AccountInterface $account)",
"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"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function b() {",
"documentation": null
@ -121,7 +121,7 @@
},
"containerName": "MyNamespace2\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function a () {",
"documentation": null

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -60,7 +60,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function a () {",
"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"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Integer",
"type__tostring": "int",
"type": {},
"declarationLine": "public $hi;",
"documentation": null
@ -52,7 +52,7 @@
},
"containerName": "B"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function a () {",
"documentation": null

View File

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