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

"type is missing before a type separator" #834

Open
bobdobbs opened this issue Oct 2, 2022 · 2 comments
Open

"type is missing before a type separator" #834

bobdobbs opened this issue Oct 2, 2022 · 2 comments

Comments

@bobdobbs
Copy link

bobdobbs commented Oct 2, 2022

When following the installation instructions, I get to the step:

composer run-script --working-dir=vendor/felixfbecker/language-server parse-stub

The command runs for a while and then ends, notifying of an exception:

Parsing file:///home/mantis/opt/php-language-server/vendor/jetbrains/phpstorm-stubs/http/http.php

Script LanguageServer\ComposerScripts::parseStubs handling the parse-stubs event terminated with an exception

In TypeResolver.php line 203:
                                             
  A type is missing before a type separator  



@twopoint71
Copy link

twopoint71 commented Nov 22, 2022

I don't have any experience with this package, but, I too, am experiencing this error upon initial install. I have supplied a stack trace, the relevant arguments, and the file being processed. For what it is worth, when the error is thrown, this is the first time an "&"(and) separator appears; all the prior separators were "|"(or). Hoping someone who's head is wrapped tightly around this codebase can identify the issue more quickly. Edit: I would note that the error is occurring on the parseTypes function in vendor/phpdocumentor/type-resolver/src/TypeResolver.php Yes, phpDocumentor is a dependency of this project, so there's a bug in phpDocumentor, or it's being fed bad data when parsing the stubs. At least, that is how it looks.

$ php --version
PHP 7.4.30 (cli) (built: Jun 23 2022 20:19:00) ( NTS )

$ uname -a
Linux a8d2d-allproducts-dev 5.10.118-111.515.amzn2.x86_64 #1 SMP Wed May 25 22:12:19 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

File in process question at time of error :
Parsing file:///www/app/vendor/jetbrains/phpstorm-stubs/http/http.php

----- BEGIN parseTypes arguments at time of error ----
$tokens ==>
object(ArrayIterator)#89079 (1) {
  ["storage":"ArrayIterator":private]=>
  array(2) {
    [0]=>
    string(1) "&"
    [1]=>
    string(5) "$info"
  }
}
$context ==>
object(phpDocumentor\Reflection\Types\Context)#88407 (2) {
  ["namespace":"phpDocumentor\Reflection\Types\Context":private]=>
  string(0) ""
  ["namespaceAliases":"phpDocumentor\Reflection\Types\Context":private]=>
  array(1) {
    ["Pure"]=>
    string(23) "JetBrains\PhpStorm\Pure"
  }
}
$parserContext ==>
int(0)
----- END parseTypes arguments at time of error ----

----- Stacktrace ----
#0  phpDocumentor\Reflection\TypeResolver->parseTypes() called at [/www/app/vendor/phpdocumentor/type-resolver/src/TypeResolver.php:200]
#1  phpDocumentor\Reflection\TypeResolver->resolve() called at [/www/app/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Param.php:71]
#2  phpDocumentor\Reflection\DocBlock\Tags\Param::create()
#3  call_user_func_array() called at [/www/app/vendor/phpdocumentor/reflection-docblock/src/DocBlock/StandardTagFactory.php:201]
#4  phpDocumentor\Reflection\DocBlock\StandardTagFactory->createTag() called at [/www/app/vendor/phpdocumentor/reflection-docblock/src/DocBlock/StandardTagFactory.php:122]
#5  phpDocumentor\Reflection\DocBlock\StandardTagFactory->create() called at [/www/app/vendor/phpdocumentor/reflection-docblock/src/DocBlockFactory.php:231]
#6  phpDocumentor\Reflection\DocBlockFactory->parseTagBlock() called at [/www/app/vendor/phpdocumentor/reflection-docblock/src/DocBlockFactory.php:96]
#7  phpDocumentor\Reflection\DocBlockFactory->create() called at [/www/app/vendor/felixfbecker/language-server/src/DefinitionResolver.php:166]
#8  LanguageServer\DefinitionResolver->getDocBlock() called at [/www/app/vendor/felixfbecker/language-server/src/DefinitionResolver.php:1127]
#9  LanguageServer\DefinitionResolver->getTypeFromNode() called at [/www/app/vendor/felixfbecker/language-server/src/DefinitionResolver.php:240]
#10 LanguageServer\DefinitionResolver->createDefinitionFromNode() called at [/www/app/vendor/felixfbecker/language-server/src/TreeAnalyzer.php:157]
#11 LanguageServer\TreeAnalyzer->collectDefinitionsAndReferences() called at [/www/app/vendor/felixfbecker/language-server/src/TreeAnalyzer.php:124]
#12 LanguageServer\TreeAnalyzer->traverse() called at [/www/app/vendor/felixfbecker/language-server/src/TreeAnalyzer.php:136]
#13 LanguageServer\TreeAnalyzer->traverse() called at [/www/app/vendor/felixfbecker/language-server/src/TreeAnalyzer.php:140]
#14 LanguageServer\TreeAnalyzer->traverse() called at [/www/app/vendor/felixfbecker/language-server/src/TreeAnalyzer.php:136]
#15 LanguageServer\TreeAnalyzer->traverse() called at [/www/app/vendor/felixfbecker/language-server/src/TreeAnalyzer.php:58]
#16 LanguageServer\TreeAnalyzer->__construct() called at [/www/app/vendor/felixfbecker/language-server/src/PhpDocument.php:147]
#17 LanguageServer\PhpDocument->updateContent() called at [/www/app/vendor/felixfbecker/language-server/src/PhpDocument.php:105]
#18 LanguageServer\PhpDocument->__construct() called at [/www/app/vendor/felixfbecker/language-server/src/ComposerScripts.php:60]
#19 LanguageServer\ComposerScripts::LanguageServer\{closure}()
#20 Generator->send() called at [/www/app/vendor/sabre/event/lib/coroutine.php:75]
#21 Sabre\Event\{closure}() called at [/www/app/vendor/sabre/event/lib/Promise.php:235]
#22 Sabre\Event\Promise->Sabre\Event\{closure}() called at [/www/app/vendor/sabre/event/lib/Loop/Loop.php:234]
#23 Sabre\Event\Loop\Loop->runNextTicks() called at [/www/app/vendor/sabre/event/lib/Loop/Loop.php:192]
#24 Sabre\Event\Loop\Loop->tick() called at [/www/app/vendor/sabre/event/lib/Loop/functions.php:119]
#25 Sabre\Event\Loop\tick() called at [/www/app/vendor/sabre/event/lib/Promise.php:185]
#26 Sabre\Event\Promise->wait() called at [/www/app/vendor/felixfbecker/language-server/src/ComposerScripts.php:70]
#27 LanguageServer\ComposerScripts::parseStubs() called at [phar:///home/ec2-user/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:398]
#28 Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() called at [phar:///home/ec2-user/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:248]
#29 Composer\EventDispatcher\EventDispatcher->doDispatch() called at [phar:///home/ec2-user/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:125]
#30 Composer\EventDispatcher\EventDispatcher->dispatchScript() called at [phar:///home/ec2-user/bin/composer.phar/src/Composer/Command/RunScriptCommand.php:113]
#31 Composer\Command\RunScriptCommand->execute() called at [phar:///home/ec2-user/bin/composer.phar/vendor/symfony/console/Command/Command.php:298]
#32 Symfony\Component\Console\Command\Command->run() called at [phar:///home/ec2-user/bin/composer.phar/vendor/symfony/console/Application.php:1024]
#33 Symfony\Component\Console\Application->doRunCommand() called at [phar:///home/ec2-user/bin/composer.phar/vendor/symfony/console/Application.php:299]
#34 Symfony\Component\Console\Application->doRun() called at [phar:///home/ec2-user/bin/composer.phar/src/Composer/Console/Application.php:335]
#35 Composer\Console\Application->doRun() called at [phar:///home/ec2-user/bin/composer.phar/vendor/symfony/console/Application.php:171]
#36 Symfony\Component\Console\Application->run() called at [phar:///home/ec2-user/bin/composer.phar/src/Composer/Console/Application.php:130]
#37 Composer\Console\Application->run() called at [phar:///home/ec2-user/bin/composer.phar/bin/composer:88]
#38 require(phar:///home/ec2-user/bin/composer.phar/bin/composer) called at [/home/ec2-user/bin/composer.phar:29]]

@mamins1376
Copy link

#795

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants