-
-
Notifications
You must be signed in to change notification settings - Fork 930
Closed
Description
Bug report
After updating to PHP8.1 I get the
Internal error: Internal error: AST failed to parse in located source (first 20 characters: <?php
namespace Pha) in file
While running the --debug -vvv mode I get this error
Uncaught PHPStan\BetterReflection\SourceLocator\Ast\Exception\ParseToAstFailure: AST failed to parse in located source (first 20 characters: <?php
namespace Pha) in phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/SourceLocator/Ast/Exception/ParseToAstFailure.php:23
#0 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/SourceLocator/Ast/Locator.php(57): PHPStan\BetterReflection\SourceLocator\Ast\Exception\ParseToAstFailure::fromLocatedSource()
#1 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/SourceLocator/Ast/Locator.php(41): PHPStan\BetterReflection\SourceLocator\Ast\Locator->findReflectionsOfType()
#2 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/SourceLocator/Type/AbstractSourceLocator.php(45): PHPStan\BetterReflection\SourceLocator\Ast\Locator->findReflection()
#3 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/SourceLocator/PhpVersionBlacklistSourceLocator.php(39): PHPStan\BetterReflection\SourceLocator\Type\AbstractSourceLocator->locateIdentifier()
#4 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/SourceLocator/Type/AggregateSourceLocator.php(28): PHPStan\Reflection\BetterReflection\SourceLocator\PhpVersionBlacklistSourceLocator->locateIdentifier()
#5 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/SourceLocator/Type/MemoizingSourceLocator.php(33): PHPStan\BetterReflection\SourceLocator\Type\AggregateSourceLocator->locateIdentifier()
#6 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/Reflector/DefaultReflector.php(32): PHPStan\BetterReflection\SourceLocator\Type\MemoizingSourceLocator->locateIdentifier()
#7 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/Reflector/MemoizingReflector.php(45): PHPStan\BetterReflection\Reflector\DefaultReflector->reflectClass()
#8 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/BetterReflectionProvider.php(152): PHPStan\Reflection\BetterReflection\Reflector\MemoizingReflector->reflectClass()
#9 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/ReflectionProvider/MemoizingReflectionProvider.php(35): PHPStan\Reflection\BetterReflection\BetterReflectionProvider->hasClass()
#10 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/src/Rules/FunctionDefinitionCheck.php(195): PHPStan\Reflection\ReflectionProvider\MemoizingReflectionProvider->hasClass()
#11 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/src/Rules/FunctionDefinitionCheck.php(146): PHPStan\Rules\FunctionDefinitionCheck->checkParametersAcceptor()
#12 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/src/Rules/Methods/ExistingClassesInTypehintsRule.php(43): PHPStan\Rules\FunctionDefinitionCheck->checkClassMethod()
#13 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/FileAnalyser.php(105): PHPStan\Rules\Methods\ExistingClassesInTypehintsRule->processNode()
#14 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/src/Node/ClassStatementsGatherer.php(95): PHPStan\Analyser\FileAnalyser->PHPStan\Analyser\{closure}()
#15 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(463): PHPStan\Node\ClassStatementsGatherer->__invoke()
#16 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(326): PHPStan\Analyser\NodeScopeResolver->processStmtNode()
#17 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(562): PHPStan\Analyser\NodeScopeResolver->processStmtNodes()
#18 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(326): PHPStan\Analyser\NodeScopeResolver->processStmtNode()
#19 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(534): PHPStan\Analyser\NodeScopeResolver->processStmtNodes()
#20 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(296): PHPStan\Analyser\NodeScopeResolver->processStmtNode()
#21 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/FileAnalyser.php(174): PHPStan\Analyser\NodeScopeResolver->processNodes()
#22 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/Analyser.php(71): PHPStan\Analyser\FileAnalyser->analyseFile()
#23 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/src/Command/AnalyserRunner.php(63): PHPStan\Analyser\Analyser->analyse()
#24 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/src/Command/AnalyseApplication.php(207): PHPStan\Command\AnalyserRunner->runAnalyser()
#25 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/src/Command/AnalyseApplication.php(100): PHPStan\Command\AnalyseApplication->runAnalyser()
#26 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/src/Command/AnalyseCommand.php(168): PHPStan\Command\AnalyseApplication->analyse()
#27 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Command/Command.php(259): PHPStan\Command\AnalyseCommand->execute()
#28 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(856): _PHPStan_59fb0a3b2\Symfony\Component\Console\Command\Command->run()
#29 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(259): _PHPStan_59fb0a3b2\Symfony\Component\Console\Application->doRunCommand()
#30 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(157): _PHPStan_59fb0a3b2\Symfony\Component\Console\Application->doRun()
#31 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(127): _PHPStan_59fb0a3b2\Symfony\Component\Console\Application->run()
#32 phar:///var/www/project/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(128): _PHPStan_59fb0a3b2\{closure}()
#33 /var/www/project/vendor/phpstan/phpstan/phpstan(8): require('...')
#34 /var/www/project/vendor/bin/phpstan(120): include('...')
#35 {main}
Used memory: 284 MB
Code snippet that reproduces the problem
Was not able to reproduce the problem since the files themselves are fine. There's always 8 of them and even when I tried to delete them it didn't help with this error to appear.
Expected output
Zero internal errors
Did PHPStan help you today? Did it make you happy in any way?
I am very happy with PHPStan otherwise it's a great tool helping us to get better.
This is my first time writing an issue at all so I hope I did it right and that someone will help me with my experience.
Thank you!
Metadata
Metadata
Assignees
Labels
No labels