Fix variable type from method return value, add tests (#393)
							parent
							
								
									7b72b38fd9
								
							
						
					
					
						commit
						f10680e441
					
				| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
class FooClass {
 | 
			
		||||
    public function foo(): FooClass {
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$fc = new FooClass();
 | 
			
		||||
$foo = $fc->foo();
 | 
			
		||||
$foo->
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
class FooClass {
 | 
			
		||||
    public static function staticFoo(): FooClass {
 | 
			
		||||
        return new FooClass();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function bar() { }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$foo = FooClass::staticFoo();
 | 
			
		||||
$foo->
 | 
			
		||||
| 
						 | 
				
			
			@ -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) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -132,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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -69,7 +69,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "Fixtures\\Prophecy\\WithReturnTypehints"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Object_",
 | 
			
		||||
            "type__tostring": "\\self",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "public function getSelf(): self {",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			@ -88,7 +88,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "Fixtures\\Prophecy\\WithReturnTypehints"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\String_",
 | 
			
		||||
            "type__tostring": "string",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "public function getName(): string {",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			@ -107,7 +107,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "Fixtures\\Prophecy\\WithReturnTypehints"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Object_",
 | 
			
		||||
            "type__tostring": "\\parent",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "public function getParent(): parent {",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,7 +33,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "A"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Array_",
 | 
			
		||||
            "type__tostring": "string[]",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "protected $foo;",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,7 +58,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "TestNamespace\\A"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Integer",
 | 
			
		||||
            "type__tostring": "int",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "public $a;",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,7 +58,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "MyNamespace\\A"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
 | 
			
		||||
            "type__tostring": "mixed",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "public static function suite()",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,7 +58,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "MyNamespace\\A"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
 | 
			
		||||
            "type__tostring": "mixed",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "public static function suite()",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,7 +58,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "MyNamespace\\A"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
 | 
			
		||||
            "type__tostring": "mixed",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "public static function suite()",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,7 +58,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "MyNamespace\\A"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
 | 
			
		||||
            "type__tostring": "mixed",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "public function suite()",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,7 +37,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "A"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
 | 
			
		||||
            "type__tostring": "mixed",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "function b ($a = MY_CONSTANT);",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,7 +37,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "A"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Array_",
 | 
			
		||||
            "type__tostring": "\\__CLASS__[]",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "private static $deprecationsTriggered;",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,7 +58,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "MyNamespace\\A"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
 | 
			
		||||
            "type__tostring": "mixed",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "static function a() {",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,7 +58,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "MyNamespace\\A"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
 | 
			
		||||
            "type__tostring": "mixed",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "static function a() {",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -64,7 +64,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "MyNamespace\\A"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
 | 
			
		||||
            "type__tostring": "mixed",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "public function testRequest()",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,7 +55,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "MyNamespace\\ParseErrorsTest"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
 | 
			
		||||
            "type__tostring": "mixed",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "public function setUp()",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
class FooClass {
 | 
			
		||||
    public function foo(): FooClass {
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,7 +33,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "Foo"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Object_",
 | 
			
		||||
            "type__tostring": "\\Iterator",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "public function fn()",
 | 
			
		||||
            "documentation": "Foo"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,7 +33,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "A"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
 | 
			
		||||
            "type__tostring": "mixed",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "function b() {",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,7 +55,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "MyNamespace\\A"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
 | 
			
		||||
            "type__tostring": "mixed",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "function a () {",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -76,7 +76,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "MyNamespace\\A"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
 | 
			
		||||
            "type__tostring": "mixed",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "function a () {",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,7 +37,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "A"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
 | 
			
		||||
            "type__tostring": "mixed",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "function a () {",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,7 +37,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "MyNamespace"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
 | 
			
		||||
            "type__tostring": "mixed",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "function init(Hi $view)",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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."
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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."
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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."
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,7 +58,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "MyNamespace\\A"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
 | 
			
		||||
            "type__tostring": "mixed",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "static function a() {",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,7 +40,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "A"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\String_",
 | 
			
		||||
            "type__tostring": "string",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "static $a;",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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."
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -70,7 +70,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "MyNamespace\\A"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
 | 
			
		||||
            "type__tostring": "mixed",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "public static function suite()",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,7 +55,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "MyNamespace\\A"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
 | 
			
		||||
            "type__tostring": "mixed",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "public function typesProvider()",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -60,7 +60,7 @@
 | 
			
		|||
                },
 | 
			
		||||
                "containerName": "MyNamespace\\A"
 | 
			
		||||
            },
 | 
			
		||||
            "type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
 | 
			
		||||
            "type__tostring": "mixed",
 | 
			
		||||
            "type": {},
 | 
			
		||||
            "declarationLine": "function a () {",
 | 
			
		||||
            "documentation": null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
class FooClass {
 | 
			
		||||
    public static function staticFoo(): FooClass {
 | 
			
		||||
        return new FooClass();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function bar() { }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue