diff --git a/fixtures/completion/method_return_type.php b/fixtures/completion/method_return_type.php new file mode 100644 index 00000000..b168f65f --- /dev/null +++ b/fixtures/completion/method_return_type.php @@ -0,0 +1,11 @@ +foo(); +$foo-> \ No newline at end of file diff --git a/fixtures/completion/static_method_return_type.php b/fixtures/completion/static_method_return_type.php new file mode 100644 index 00000000..06cafdd0 --- /dev/null +++ b/fixtures/completion/static_method_return_type.php @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/src/DefinitionResolver.php b/src/DefinitionResolver.php index cf2f8a69..32defaba 100644 --- a/src/DefinitionResolver.php +++ b/src/DefinitionResolver.php @@ -623,6 +623,16 @@ public function resolveExpressionNodeToType($expr) } } + // 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) { diff --git a/tests/LanguageServerTest.php b/tests/LanguageServerTest.php index fb52ef64..5d034517 100644 --- a/tests/LanguageServerTest.php +++ b/tests/LanguageServerTest.php @@ -57,7 +57,7 @@ public function testIndexingWithDirectFileAccess() 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 @@ public function testIndexingWithFilesAndContentRequests() 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(); } } diff --git a/tests/Server/TextDocument/CompletionTest.php b/tests/Server/TextDocument/CompletionTest.php index 03ba3d86..923acc1c 100644 --- a/tests/Server/TextDocument/CompletionTest.php +++ b/tests/Server/TextDocument/CompletionTest.php @@ -499,6 +499,50 @@ public function testBarePhp() ], 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) { diff --git a/tests/Validation/ValidationTest.php b/tests/Validation/ValidationTest.php index 8fa74427..3fc74296 100644 --- a/tests/Validation/ValidationTest.php +++ b/tests/Validation/ValidationTest.php @@ -132,8 +132,7 @@ private function getTestValuesFromDefs($definitions): array } 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; diff --git a/tests/Validation/cases/WithReturnTypehints.php.expected.json b/tests/Validation/cases/WithReturnTypehints.php.expected.json index 166786aa..271c2038 100644 --- a/tests/Validation/cases/WithReturnTypehints.php.expected.json +++ b/tests/Validation/cases/WithReturnTypehints.php.expected.json @@ -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 diff --git a/tests/Validation/cases/arrayValueShouldBeBoolean.php.expected.json b/tests/Validation/cases/arrayValueShouldBeBoolean.php.expected.json index c9b02d02..1bb66e18 100644 --- a/tests/Validation/cases/arrayValueShouldBeBoolean.php.expected.json +++ b/tests/Validation/cases/arrayValueShouldBeBoolean.php.expected.json @@ -33,7 +33,7 @@ }, "containerName": "A" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Array_", + "type__tostring": "string[]", "type": {}, "declarationLine": "protected $foo;", "documentation": null diff --git a/tests/Validation/cases/classDefinition1.php.expected.json b/tests/Validation/cases/classDefinition1.php.expected.json index aad36bbd..5167a4cc 100644 --- a/tests/Validation/cases/classDefinition1.php.expected.json +++ b/tests/Validation/cases/classDefinition1.php.expected.json @@ -58,7 +58,7 @@ }, "containerName": "TestNamespace\\A" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Integer", + "type__tostring": "int", "type": {}, "declarationLine": "public $a;", "documentation": null diff --git a/tests/Validation/cases/classProperty1.php.expected.json b/tests/Validation/cases/classProperty1.php.expected.json index 671c0193..05d90c18 100644 --- a/tests/Validation/cases/classProperty1.php.expected.json +++ b/tests/Validation/cases/classProperty1.php.expected.json @@ -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 diff --git a/tests/Validation/cases/constants.php.expected.json b/tests/Validation/cases/constants.php.expected.json index eef5cdd2..ba80e258 100644 --- a/tests/Validation/cases/constants.php.expected.json +++ b/tests/Validation/cases/constants.php.expected.json @@ -58,7 +58,7 @@ }, "containerName": "MyNamespace\\A" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__tostring": "mixed", "type": {}, "declarationLine": "public static function suite()", "documentation": null diff --git a/tests/Validation/cases/constants2.php.expected.json b/tests/Validation/cases/constants2.php.expected.json index 6ecb2a6a..e08408ea 100644 --- a/tests/Validation/cases/constants2.php.expected.json +++ b/tests/Validation/cases/constants2.php.expected.json @@ -58,7 +58,7 @@ }, "containerName": "MyNamespace\\A" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__tostring": "mixed", "type": {}, "declarationLine": "public static function suite()", "documentation": null diff --git a/tests/Validation/cases/constants3.php.expected.json b/tests/Validation/cases/constants3.php.expected.json index d49903c7..dbbb9590 100644 --- a/tests/Validation/cases/constants3.php.expected.json +++ b/tests/Validation/cases/constants3.php.expected.json @@ -58,7 +58,7 @@ }, "containerName": "MyNamespace\\A" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__tostring": "mixed", "type": {}, "declarationLine": "public static function suite()", "documentation": null diff --git a/tests/Validation/cases/constants4.php.expected.json b/tests/Validation/cases/constants4.php.expected.json index 2c01864f..24523a82 100644 --- a/tests/Validation/cases/constants4.php.expected.json +++ b/tests/Validation/cases/constants4.php.expected.json @@ -58,7 +58,7 @@ }, "containerName": "MyNamespace\\A" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__tostring": "mixed", "type": {}, "declarationLine": "public function suite()", "documentation": null diff --git a/tests/Validation/cases/constants5.php.expected.json b/tests/Validation/cases/constants5.php.expected.json index a0876b5c..14981653 100644 --- a/tests/Validation/cases/constants5.php.expected.json +++ b/tests/Validation/cases/constants5.php.expected.json @@ -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 diff --git a/tests/Validation/cases/constantsInFunctionParamDefault.php.expected.json b/tests/Validation/cases/constantsInFunctionParamDefault.php.expected.json index 98aa7cda..3ff0ca16 100644 --- a/tests/Validation/cases/constantsInFunctionParamDefault.php.expected.json +++ b/tests/Validation/cases/constantsInFunctionParamDefault.php.expected.json @@ -37,7 +37,7 @@ }, "containerName": "A" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__tostring": "mixed", "type": {}, "declarationLine": "function b ($a = MY_CONSTANT);", "documentation": null diff --git a/tests/Validation/cases/magicConsts.php.expected.json b/tests/Validation/cases/magicConsts.php.expected.json index 6641af3c..74cf36b8 100644 --- a/tests/Validation/cases/magicConsts.php.expected.json +++ b/tests/Validation/cases/magicConsts.php.expected.json @@ -37,7 +37,7 @@ }, "containerName": "A" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Array_", + "type__tostring": "\\__CLASS__[]", "type": {}, "declarationLine": "private static $deprecationsTriggered;", "documentation": null diff --git a/tests/Validation/cases/memberAccess1.php.expected.json b/tests/Validation/cases/memberAccess1.php.expected.json index ff4868b8..efe4d3a5 100644 --- a/tests/Validation/cases/memberAccess1.php.expected.json +++ b/tests/Validation/cases/memberAccess1.php.expected.json @@ -58,7 +58,7 @@ }, "containerName": "MyNamespace\\A" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__tostring": "mixed", "type": {}, "declarationLine": "static function a() {", "documentation": null diff --git a/tests/Validation/cases/memberAccess2.php.expected.json b/tests/Validation/cases/memberAccess2.php.expected.json index a6707d00..1725a5b3 100644 --- a/tests/Validation/cases/memberAccess2.php.expected.json +++ b/tests/Validation/cases/memberAccess2.php.expected.json @@ -58,7 +58,7 @@ }, "containerName": "MyNamespace\\A" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__tostring": "mixed", "type": {}, "declarationLine": "static function a() {", "documentation": null diff --git a/tests/Validation/cases/memberAccess3.php.expected.json b/tests/Validation/cases/memberAccess3.php.expected.json index df58d1ee..9b1b4ee5 100644 --- a/tests/Validation/cases/memberAccess3.php.expected.json +++ b/tests/Validation/cases/memberAccess3.php.expected.json @@ -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 diff --git a/tests/Validation/cases/memberAccess4.php.expected.json b/tests/Validation/cases/memberAccess4.php.expected.json index 1cfabb38..3e26d727 100644 --- a/tests/Validation/cases/memberAccess4.php.expected.json +++ b/tests/Validation/cases/memberAccess4.php.expected.json @@ -64,7 +64,7 @@ }, "containerName": "MyNamespace\\A" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__tostring": "mixed", "type": {}, "declarationLine": "public function testRequest()", "documentation": null diff --git a/tests/Validation/cases/memberAccess5.php.expected.json b/tests/Validation/cases/memberAccess5.php.expected.json index 5023cd62..c7158b67 100644 --- a/tests/Validation/cases/memberAccess5.php.expected.json +++ b/tests/Validation/cases/memberAccess5.php.expected.json @@ -55,7 +55,7 @@ }, "containerName": "MyNamespace\\ParseErrorsTest" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__tostring": "mixed", "type": {}, "declarationLine": "public function setUp()", "documentation": null diff --git a/tests/Validation/cases/memberCall1.php.expected.json b/tests/Validation/cases/memberCall1.php.expected.json index 4cf2cd8b..bd31b2fb 100644 --- a/tests/Validation/cases/memberCall1.php.expected.json +++ b/tests/Validation/cases/memberCall1.php.expected.json @@ -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 diff --git a/tests/Validation/cases/methodReturnType.php b/tests/Validation/cases/methodReturnType.php new file mode 100644 index 00000000..b4b937df --- /dev/null +++ b/tests/Validation/cases/methodReturnType.php @@ -0,0 +1,7 @@ +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 + } + } +} \ No newline at end of file diff --git a/tests/Validation/cases/multipleNamespaces.php.expected.json b/tests/Validation/cases/multipleNamespaces.php.expected.json index 2ed59de6..3533e8c9 100644 --- a/tests/Validation/cases/multipleNamespaces.php.expected.json +++ b/tests/Validation/cases/multipleNamespaces.php.expected.json @@ -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 diff --git a/tests/Validation/cases/multiplePreceedingComments.php.expected.json b/tests/Validation/cases/multiplePreceedingComments.php.expected.json index ca97671c..c331b5e4 100644 --- a/tests/Validation/cases/multiplePreceedingComments.php.expected.json +++ b/tests/Validation/cases/multiplePreceedingComments.php.expected.json @@ -33,7 +33,7 @@ }, "containerName": "Foo" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Object_", + "type__tostring": "\\Iterator", "type": {}, "declarationLine": "public function fn()", "documentation": "Foo" diff --git a/tests/Validation/cases/nameToken.php.expected.json b/tests/Validation/cases/nameToken.php.expected.json index 1bd944de..af73f789 100644 --- a/tests/Validation/cases/nameToken.php.expected.json +++ b/tests/Validation/cases/nameToken.php.expected.json @@ -33,7 +33,7 @@ }, "containerName": "A" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__tostring": "mixed", "type": {}, "declarationLine": "function b() {", "documentation": null diff --git a/tests/Validation/cases/objectCreation.php.expected.json b/tests/Validation/cases/objectCreation.php.expected.json index cea03439..a0e8f72d 100644 --- a/tests/Validation/cases/objectCreation.php.expected.json +++ b/tests/Validation/cases/objectCreation.php.expected.json @@ -55,7 +55,7 @@ }, "containerName": "MyNamespace\\A" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__tostring": "mixed", "type": {}, "declarationLine": "function a () {", "documentation": null diff --git a/tests/Validation/cases/objectCreation2.php.expected.json b/tests/Validation/cases/objectCreation2.php.expected.json index 7f856b14..0119bf7a 100644 --- a/tests/Validation/cases/objectCreation2.php.expected.json +++ b/tests/Validation/cases/objectCreation2.php.expected.json @@ -76,7 +76,7 @@ }, "containerName": "MyNamespace\\A" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__tostring": "mixed", "type": {}, "declarationLine": "function a () {", "documentation": null diff --git a/tests/Validation/cases/objectCreation3.php.expected.json b/tests/Validation/cases/objectCreation3.php.expected.json index c6dcab90..75cc011b 100644 --- a/tests/Validation/cases/objectCreation3.php.expected.json +++ b/tests/Validation/cases/objectCreation3.php.expected.json @@ -37,7 +37,7 @@ }, "containerName": "A" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__tostring": "mixed", "type": {}, "declarationLine": "function a () {", "documentation": null diff --git a/tests/Validation/cases/param1.php.expected.json b/tests/Validation/cases/param1.php.expected.json index adbe0022..ee952f3c 100644 --- a/tests/Validation/cases/param1.php.expected.json +++ b/tests/Validation/cases/param1.php.expected.json @@ -37,7 +37,7 @@ }, "containerName": "MyNamespace" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__tostring": "mixed", "type": {}, "declarationLine": "function init(Hi $view)", "documentation": null diff --git a/tests/Validation/cases/parent1.php.expected.json b/tests/Validation/cases/parent1.php.expected.json index 3391cd42..961b35b2 100644 --- a/tests/Validation/cases/parent1.php.expected.json +++ b/tests/Validation/cases/parent1.php.expected.json @@ -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 diff --git a/tests/Validation/cases/parent3.php.expected.json b/tests/Validation/cases/parent3.php.expected.json index 2c4915d5..e2cf2c6b 100644 --- a/tests/Validation/cases/parent3.php.expected.json +++ b/tests/Validation/cases/parent3.php.expected.json @@ -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 diff --git a/tests/Validation/cases/propertyName1.php.expected.json b/tests/Validation/cases/propertyName1.php.expected.json index 8032ecc1..0a37c206 100644 --- a/tests/Validation/cases/propertyName1.php.expected.json +++ b/tests/Validation/cases/propertyName1.php.expected.json @@ -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." diff --git a/tests/Validation/cases/propertyName2.php.expected.json b/tests/Validation/cases/propertyName2.php.expected.json index a70c515c..9cba9453 100644 --- a/tests/Validation/cases/propertyName2.php.expected.json +++ b/tests/Validation/cases/propertyName2.php.expected.json @@ -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." diff --git a/tests/Validation/cases/returnType.php.expected.json b/tests/Validation/cases/returnType.php.expected.json index 9515a6b0..6ddca7e1 100644 --- a/tests/Validation/cases/returnType.php.expected.json +++ b/tests/Validation/cases/returnType.php.expected.json @@ -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." diff --git a/tests/Validation/cases/scopedPropertyAccess.php.expected.json b/tests/Validation/cases/scopedPropertyAccess.php.expected.json index 6797a0ed..3eeda77b 100644 --- a/tests/Validation/cases/scopedPropertyAccess.php.expected.json +++ b/tests/Validation/cases/scopedPropertyAccess.php.expected.json @@ -58,7 +58,7 @@ }, "containerName": "MyNamespace\\A" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__tostring": "mixed", "type": {}, "declarationLine": "static function a() {", "documentation": null diff --git a/tests/Validation/cases/scopedPropertyAccess3.php.expected.json b/tests/Validation/cases/scopedPropertyAccess3.php.expected.json index d29387a2..81cbfb62 100644 --- a/tests/Validation/cases/scopedPropertyAccess3.php.expected.json +++ b/tests/Validation/cases/scopedPropertyAccess3.php.expected.json @@ -40,7 +40,7 @@ }, "containerName": "A" }, - "type__class": "phpDocumentor\\Reflection\\Types\\String_", + "type__tostring": "string", "type": {}, "declarationLine": "static $a;", "documentation": null diff --git a/tests/Validation/cases/scopedPropertyAccess5.php.expected.json b/tests/Validation/cases/scopedPropertyAccess5.php.expected.json index ab1e2145..27f05098 100644 --- a/tests/Validation/cases/scopedPropertyAccess5.php.expected.json +++ b/tests/Validation/cases/scopedPropertyAccess5.php.expected.json @@ -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." diff --git a/tests/Validation/cases/self1.php.expected.json b/tests/Validation/cases/self1.php.expected.json index 6531b537..41525d84 100644 --- a/tests/Validation/cases/self1.php.expected.json +++ b/tests/Validation/cases/self1.php.expected.json @@ -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 diff --git a/tests/Validation/cases/self2.php.expected.json b/tests/Validation/cases/self2.php.expected.json index 8300de2d..eb31aba1 100644 --- a/tests/Validation/cases/self2.php.expected.json +++ b/tests/Validation/cases/self2.php.expected.json @@ -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 diff --git a/tests/Validation/cases/self3.php.expected.json b/tests/Validation/cases/self3.php.expected.json index 3d5d4ad6..f50b80cc 100644 --- a/tests/Validation/cases/self3.php.expected.json +++ b/tests/Validation/cases/self3.php.expected.json @@ -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 diff --git a/tests/Validation/cases/self4.php.expected.json b/tests/Validation/cases/self4.php.expected.json index 9a01912a..49460010 100644 --- a/tests/Validation/cases/self4.php.expected.json +++ b/tests/Validation/cases/self4.php.expected.json @@ -70,7 +70,7 @@ }, "containerName": "MyNamespace\\A" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__tostring": "mixed", "type": {}, "declarationLine": "public static function suite()", "documentation": null diff --git a/tests/Validation/cases/self5.php.expected.json b/tests/Validation/cases/self5.php.expected.json index 781cd249..e1c99af6 100644 --- a/tests/Validation/cases/self5.php.expected.json +++ b/tests/Validation/cases/self5.php.expected.json @@ -55,7 +55,7 @@ }, "containerName": "MyNamespace\\A" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__tostring": "mixed", "type": {}, "declarationLine": "public function typesProvider()", "documentation": null diff --git a/tests/Validation/cases/static1.php.expected.json b/tests/Validation/cases/static1.php.expected.json index b0323b26..ca492456 100644 --- a/tests/Validation/cases/static1.php.expected.json +++ b/tests/Validation/cases/static1.php.expected.json @@ -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 diff --git a/tests/Validation/cases/static2.php.expected.json b/tests/Validation/cases/static2.php.expected.json index c8d81fbc..06a0627e 100644 --- a/tests/Validation/cases/static2.php.expected.json +++ b/tests/Validation/cases/static2.php.expected.json @@ -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 diff --git a/tests/Validation/cases/static3.php.expected.json b/tests/Validation/cases/static3.php.expected.json index bb556bff..745bd56f 100644 --- a/tests/Validation/cases/static3.php.expected.json +++ b/tests/Validation/cases/static3.php.expected.json @@ -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 diff --git a/tests/Validation/cases/static4.php.expected.json b/tests/Validation/cases/static4.php.expected.json index 6a280285..67c677a8 100644 --- a/tests/Validation/cases/static4.php.expected.json +++ b/tests/Validation/cases/static4.php.expected.json @@ -60,7 +60,7 @@ }, "containerName": "MyNamespace\\A" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__tostring": "mixed", "type": {}, "declarationLine": "function a () {", "documentation": null diff --git a/tests/Validation/cases/staticMethodReturnType.php b/tests/Validation/cases/staticMethodReturnType.php new file mode 100644 index 00000000..325738ac --- /dev/null +++ b/tests/Validation/cases/staticMethodReturnType.php @@ -0,0 +1,9 @@ +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 + } + } +} \ No newline at end of file diff --git a/tests/Validation/cases/stringVariable.php.expected.json b/tests/Validation/cases/stringVariable.php.expected.json index 5ac910ba..982dba51 100644 --- a/tests/Validation/cases/stringVariable.php.expected.json +++ b/tests/Validation/cases/stringVariable.php.expected.json @@ -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 diff --git a/tests/Validation/cases/verifyFqsenOnClassProperty.php.expected.json b/tests/Validation/cases/verifyFqsenOnClassProperty.php.expected.json index f0727227..d40ef639 100644 --- a/tests/Validation/cases/verifyFqsenOnClassProperty.php.expected.json +++ b/tests/Validation/cases/verifyFqsenOnClassProperty.php.expected.json @@ -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