diff --git a/fixtures/completion/method_return_type.php b/fixtures/completion/method_return_type.php new file mode 100644 index 0000000..b168f65 --- /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 0000000..06cafdd --- /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 cf2f8a6..32defab 100644 --- a/src/DefinitionResolver.php +++ b/src/DefinitionResolver.php @@ -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) { diff --git a/tests/LanguageServerTest.php b/tests/LanguageServerTest.php index fb52ef6..5d03451 100644 --- a/tests/LanguageServerTest.php +++ b/tests/LanguageServerTest.php @@ -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(); } } diff --git a/tests/Server/TextDocument/CompletionTest.php b/tests/Server/TextDocument/CompletionTest.php index 03ba3d8..923acc1 100644 --- a/tests/Server/TextDocument/CompletionTest.php +++ b/tests/Server/TextDocument/CompletionTest.php @@ -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) { diff --git a/tests/Validation/ValidationTest.php b/tests/Validation/ValidationTest.php index 8fa7442..3fc7429 100644 --- a/tests/Validation/ValidationTest.php +++ b/tests/Validation/ValidationTest.php @@ -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; diff --git a/tests/Validation/cases/WithReturnTypehints.php.expected.json b/tests/Validation/cases/WithReturnTypehints.php.expected.json index 166786a..271c203 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 c9b02d0..1bb66e1 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 aad36bb..5167a4c 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 671c019..05d90c1 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 eef5cdd..ba80e25 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 6ecb2a6..e08408e 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 d49903c..dbbb959 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 2c01864..24523a8 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 a0876b5..1498165 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 98aa7cd..3ff0ca1 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 6641af3..74cf36b 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 ff4868b..efe4d3a 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 a6707d0..1725a5b 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 df58d1e..9b1b4ee 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 1cfabb3..3e26d72 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 5023cd6..c7158b6 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 4cf2cd8..bd31b2f 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 0000000..b4b937d --- /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 2ed59de..3533e8c 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 ca97671..c331b5e 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 1bd944d..af73f78 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 cea0343..a0e8f72 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 7f856b1..0119bf7 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 c6dcab9..75cc011 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 adbe002..ee952f3 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 3391cd4..961b35b 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 2c4915d..e2cf2c6 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 8032ecc..0a37c20 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 a70c515..9cba945 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 9515a6b..6ddca7e 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 6797a0e..3eeda77 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 d29387a..81cbfb6 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 ab1e214..27f0509 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 6531b53..41525d8 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 8300de2..eb31aba 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 3d5d4ad..f50b80c 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 9a01912..4946001 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 781cd24..e1c99af 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 b0323b2..ca49245 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 c8d81fb..06a0627 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 bb556bf..745bd56 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 6a28028..67c677a 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 0000000..325738a --- /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 5ac910b..982dba5 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 f072722..d40ef63 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