Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Return value of LanguageServer\DefinitionResolver::resolveExpressionNodeToType() must implement interface phpDocumentor\Reflection\Type, null returned #364

Closed
dantory opened this issue Apr 23, 2017 · 2 comments · Fixed by #363

Comments

@dantory
Copy link

dantory commented Apr 23, 2017

Stack Trace from VSCode

TypeError: Return value of LanguageServer\DefinitionResolver::resolveExpressionNodeToType() must implement interface phpDocumentor\Reflection\Type, null returned in /home/chazwize/.vscode/extensions/felixfbecker.php-intellisense-1.2.0/vendor/felixfbecker/language-server/src/DefinitionResolver.php:466
Stack trace:
#0 /home/chazwize/.vscode/extensions/felixfbecker.php-intellisense-1.2.0/vendor/felixfbecker/language-server/src/DefinitionResolver.php(811): LanguageServer\DefinitionResolver->resolveExpressionNodeToType(Object(PhpParser\Node\Expr\ConstFetch))
#1 /home/chazwize/.vscode/extensions/felixfbecker.php-intellisense-1.2.0/vendor/felixfbecker/language-server/src/DefinitionResolver.php(139): LanguageServer\DefinitionResolver->getTypeFromNode(Object(PhpParser\Node\Stmt\PropertyProperty))
#2 /home/chazwize/.vscode/extensions/felixfbecker.php-intellisense-1.2.0/vendor/felixfbecker/language-server/src/NodeVisitor/DefinitionCollector.php(45): LanguageServer\DefinitionResolver->createDefinitionFromNode(Object(PhpParser\Node\Stmt\PropertyProperty), 'VMoim->imageDir')
#3 /home/chazwize/.vscode/extensions/felixfbecker.php-intellisense-1.2.0/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(159): LanguageServer\NodeVisitor\DefinitionCollector->enterNode(Object(PhpParser\Node\Stmt\PropertyProperty))
#4 /home/chazwize/.vscode/extensions/felixfbecker.php-intellisense-1.2.0/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(101): PhpParser\NodeTraverser->traverseArray(Array)
#5 /home/chazwize/.vscode/extensions/felixfbecker.php-intellisense-1.2.0/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(171): PhpParser\NodeTraverser->traverseNode(Object(PhpParser\Node\Stmt\Property))
#6 /home/chazwize/.vscode/extensions/felixfbecker.php-intellisense-1.2.0/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(101): PhpParser\NodeTraverser->traverseArray(Array)
#7 /home/chazwize/.vscode/extensions/felixfbecker.php-intellisense-1.2.0/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(171): PhpParser\NodeTraverser->traverseNode(Object(PhpParser\Node\Stmt\Class_))
#8 /home/chazwize/.vscode/extensions/felixfbecker.php-intellisense-1.2.0/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(85): PhpParser\NodeTraverser->traverseArray(Array)
#9 /home/chazwize/.vscode/extensions/felixfbecker.php-intellisense-1.2.0/vendor/felixfbecker/language-server/src/PhpDocument.php(205): PhpParser\NodeTraverser->traverse(Array)
#10 /home/chazwize/.vscode/extensions/felixfbecker.php-intellisense-1.2.0/vendor/felixfbecker/language-server/src/PhpDocument.php(119): LanguageServer\PhpDocument->updateContent('__construct('file:///home/ch...', 'create('file:///home/ch...', 'LanguageServer\{closure}()
#14 /home/chazwize/.vscode/extensions/felixfbecker.php-intellisense-1.2.0/vendor/sabre/event/lib/coroutine.php(70): Generator->send('Sabre\Event\{closure}()
#17 /home/chazwize/.vscode/extensions/felixfbecker.php-intellisense-1.2.0/vendor/sabre/event/lib/Loop/Loop.php(215): Sabre\Event\Loop\Loop->runNextTicks()
#18 /home/chazwize/.vscode/extensions/felixfbecker.php-intellisense-1.2.0/vendor/sabre/event/lib/Loop/Loop.php(194): Sabre\Event\Loop\Loop->tick(true)
#19 /home/chazwize/.vscode/extensions/felixfbecker.php-intellisense-1.2.0/vendor/sabre/event/lib/Loop/functions.php(122): Sabre\Event\Loop\Loop->run()
#20 /home/chazwize/.vscode/extensions/felixfbecker.php-intellisense-1.2.0/vendor/felixfbecker/language-server/bin/php-language-server.php(102): Sabre\Event\Loop\run()
#21 {main}
@dantory dantory closed this as completed Apr 23, 2017
@dantory dantory reopened this Apr 24, 2017
@Ettemlevest
Copy link

Same issue for me:

VSCode v1.11.2
PHP Intellisense v1.2.0
Win 10 x64

TypeError: Return value of LanguageServer\DefinitionResolver::resolveExpressionNodeToType() must implement interface phpDocumentor\Reflection\Type, null returned in C:\Users\ettem\.vscode\extensions\felixfbecker.php-intellisense-1.2.0\vendor\felixfbecker\language-server\src\DefinitionResolver.php:466
Stack trace:
#0 C:\Users\ettem\.vscode\extensions\felixfbecker.php-intellisense-1.2.0\vendor\felixfbecker\language-server\src\DefinitionResolver.php(811): LanguageServer\DefinitionResolver->resolveExpressionNodeToType(Object(PhpParser\Node\Expr\ConstFetch))
#1 C:\Users\ettem\.vscode\extensions\felixfbecker.php-intellisense-1.2.0\vendor\felixfbecker\language-server\src\DefinitionResolver.php(139): LanguageServer\DefinitionResolver->getTypeFromNode(Object(PhpParser\Node\Stmt\PropertyProperty))
#2 C:\Users\ettem\.vscode\extensions\felixfbecker.php-intellisense-1.2.0\vendor\felixfbecker\language-server\src\NodeVisitor\DefinitionCollector.php(45): LanguageServer\DefinitionResolver->createDefinitionFromNode(Object(PhpParser\Node\Stmt\PropertyProperty), 'Mustache_Engine...')
#3 C:\Users\ettem\.vscode\extensions\felixfbecker.php-intellisense-1.2.0\vendor\nikic\php-parser\lib\PhpParser\NodeTraverser.php(159): LanguageServer\NodeVisitor\DefinitionCollector->enterNode(Object(PhpParser\Node\Stmt\PropertyProperty))
#4 C:\Users\ettem\.vscode\extensions\felixfbecker.php-intellisense-1.2.0\vendor\nikic\php-parser\lib\PhpParser\NodeTraverser.php(101): PhpParser\NodeTraverser->traverseArray(Array)
#5 C:\Users\ettem\.vscode\extensions\felixfbecker.php-intellisense-1.2.0\vendor\nikic\php-parser\lib\PhpParser\NodeTraverser.php(171): PhpParser\NodeTraverser->traverseNode(Object(PhpParser\Node\Stmt\Property))
#6 C:\Users\ettem\.vscode\extensions\felixfbecker.php-intellisense-1.2.0\vendor\nikic\php-parser\lib\PhpParser\NodeTraverser.php(101): PhpParser\NodeTraverser->traverseArray(Array)
#7 C:\Users\ettem\.vscode\extensions\felixfbecker.php-intellisense-1.2.0\vendor\nikic\php-parser\lib\PhpParser\NodeTraverser.php(171): PhpParser\NodeTraverser->traverseNode(Object(PhpParser\Node\Stmt\Class_))
#8 C:\Users\ettem\.vscode\extensions\felixfbecker.php-intellisense-1.2.0\vendor\nikic\php-parser\lib\PhpParser\NodeTraverser.php(85): PhpParser\NodeTraverser->traverseArray(Array)
#9 C:\Users\ettem\.vscode\extensions\felixfbecker.php-intellisense-1.2.0\vendor\felixfbecker\language-server\src\PhpDocument.php(205): PhpParser\NodeTraverser->traverse(Array)
#10 C:\Users\ettem\.vscode\extensions\felixfbecker.php-intellisense-1.2.0\vendor\felixfbecker\language-server\src\PhpDocument.php(119): LanguageServer\PhpDocument->updateContent('<?php\n\n/*\n * Th...')
#11 C:\Users\ettem\.vscode\extensions\felixfbecker.php-intellisense-1.2.0\vendor\felixfbecker\language-server\src\PhpDocumentLoader.php(134): LanguageServer\PhpDocument->__construct('file:///e:/Munk...', '<?php\n\n/*\n * Th...', Object(LanguageServer\Index\Index), Object(LanguageServer\Parser), Object(phpDocumentor\Reflection\DocBlockFactory), Object(LanguageServer\DefinitionResolver))
#12 C:\Users\ettem\.vscode\extensions\felixfbecker.php-intellisense-1.2.0\vendor\felixfbecker\language-server\src\PhpDocumentLoader.php(113): LanguageServer\PhpDocumentLoader->create('file:///e:/Munk...', '<?php\n\n/*\n * Th...')
#13 [internal function]: LanguageServer\PhpDocumentLoader->LanguageServer\{closure}()
#14 C:\Users\ettem\.vscode\extensions\felixfbecker.php-intellisense-1.2.0\vendor\sabre\event\lib\coroutine.php(70): Generator->send('<?php\n\n/*\n * Th...')
#15 C:\Users\ettem\.vscode\extensions\felixfbecker.php-intellisense-1.2.0\vendor\sabre\event\lib\Promise.php(242): Sabre\Event\{closure}('<?php\n\n/*\n * Th...')
#16 C:\Users\ettem\.vscode\extensions\felixfbecker.php-intellisense-1.2.0\vendor\sabre\event\lib\Loop\Loop.php(261): Sabre\Event\Promise->Sabre\Event\{closure}()
#17 C:\Users\ettem\.vscode\extensions\felixfbecker.php-intellisense-1.2.0\vendor\sabre\event\lib\Loop\Loop.php(215): Sabre\Event\Loop\Loop->runNextTicks()
#18 C:\Users\ettem\.vscode\extensions\felixfbecker.php-intellisense-1.2.0\vendor\sabre\event\lib\Loop\Loop.php(194): Sabre\Event\Loop\Loop->tick(true)
#19 C:\Users\ettem\.vscode\extensions\felixfbecker.php-intellisense-1.2.0\vendor\sabre\event\lib\Loop\functions.php(122): Sabre\Event\Loop\Loop->run()
#20 C:\Users\ettem\.vscode\extensions\felixfbecker.php-intellisense-1.2.0\vendor\felixfbecker\language-server\bin\php-language-server.php(50): Sabre\Event\Loop\run()
#21 {main}

@felixfbecker
Copy link
Owner

#363

felixfbecker pushed a commit that referenced this issue Apr 24, 2017
* Allow getting type from define() node
- fixes #364

* Add test case for DefinitionResolver
lialan pushed a commit to lambdalab/php-language-server that referenced this issue Apr 30, 2017
* Allow getting type from define() node
- fixes felixfbecker#364

* Add test case for DefinitionResolver
zfy0701 pushed a commit to lambdalab/php-language-server that referenced this issue May 10, 2017
* Allow getting type from define() node
- fixes felixfbecker#364

* Add test case for DefinitionResolver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants