Description
Bug Report
Subject | Details |
---|---|
Rector version | 0.12.3 Rector cd217264b75e2b7ace93c46f346d32916e2d9809 |
Getting a syntax error from the embedded PHPStan, even though there's no matching token in the code.
PHP 7.4
Symfony 4.4.25
Ruflin Elastica 6.1.5
Running PHPStan 1.1.2 against the same code produces no errors.
In RichParser.php line 42:
[PHPStan\Parser\ParserErrorsException]
Syntax error, unexpected T_MATCH on line 10
Exception trace:
at phar:///home/cameron/project/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/Parser/RichParser.php:42
PHPStan\Parser\RichParser->parseFile() at phar:///home/cameron/project/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/Parser/CachedParser.php:36
PHPStan\Parser\CachedParser->parseFile() at phar:///home/cameron/project/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/Type/FileTypeMapper.php:220
PHPStan\Type\FileTypeMapper->createFilePhpDocMap() at phar:///home/cameron/project/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/Type/FileTypeMapper.php:181
PHPStan\Type\FileTypeMapper->createResolvedPhpDocMap() at phar:///home/cameron/project/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/Type/FileTypeMapper.php:168
PHPStan\Type\FileTypeMapper->getResolvedPhpDocMap() at phar:///home/cameron/project/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/Type/FileTypeMapper.php:75
PHPStan\Type\FileTypeMapper->getResolvedPhpDoc() at phar:///home/cameron/project/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/ClassReflection.php:849
PHPStan\Reflection\ClassReflection->getResolvedPhpDoc() at phar:///home/cameron/project/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/ClassReflection.php:861
PHPStan\Reflection\ClassReflection->getExtendsTags() at phar:///home/cameron/project/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/ClassReflection.php:853
PHPStan\Reflection\ClassReflection->getFirstExtendsTag() at phar:///home/cameron/project/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/ClassReflection.php:164
PHPStan\Reflection\ClassReflection->getParentClass() at phar:///home/cameron/project/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/ClassReflection.php:577
PHPStan\Reflection\ClassReflection->getParentClassesNames() at phar:///home/cameron/project/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/ReflectionProvider/ClassBlacklistReflectionProvider.php:49
PHPStan\Reflection\ReflectionProvider\ClassBlacklistReflectionProvider->hasClass() at phar:///home/cameron/project/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/ReflectionProvider/ChainReflectionProvider.php:25
PHPStan\Reflection\ReflectionProvider\ChainReflectionProvider->hasClass() at phar:///home/cameron/project/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/ReflectionProvider/MemoizingReflectionProvider.php:31
PHPStan\Reflection\ReflectionProvider\MemoizingReflectionProvider->hasClass() at /home/cameron/project/vendor/rector/rector/packages/NodeTypeResolver/PHPStan/CollisionGuard/MixinGuard.php:57
Rector\NodeTypeResolver\PHPStan\CollisionGuard\MixinGuard->isCircularMixin() at /home/cameron/project/vendor/rector/rector/packages/NodeTypeResolver/PHPStan/CollisionGuard/MixinGuard.php:47
Rector\NodeTypeResolver\PHPStan\CollisionGuard\MixinGuard->Rector\NodeTypeResolver\PHPStan\CollisionGuard\{closure}() at /home/cameron/project/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php:42
PhpParser\NodeVisitor\FirstFindingVisitor->enterNode() at /home/cameron/project/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:113
PhpParser\NodeTraverser->traverseNode() at /home/cameron/project/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:133
PhpParser\NodeTraverser->traverseNode() at /home/cameron/project/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:133
PhpParser\NodeTraverser->traverseNode() at /home/cameron/project/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:196
PhpParser\NodeTraverser->traverseArray() at /home/cameron/project/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:105
PhpParser\NodeTraverser->traverseNode() at /home/cameron/project/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:133
PhpParser\NodeTraverser->traverseNode() at /home/cameron/project/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:196
PhpParser\NodeTraverser->traverseArray() at /home/cameron/project/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:105
PhpParser\NodeTraverser->traverseNode() at /home/cameron/project/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:196
PhpParser\NodeTraverser->traverseArray() at /home/cameron/project/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:105
PhpParser\NodeTraverser->traverseNode() at /home/cameron/project/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:196
PhpParser\NodeTraverser->traverseArray() at /home/cameron/project/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:105
PhpParser\NodeTraverser->traverseNode() at /home/cameron/project/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:196
PhpParser\NodeTraverser->traverseArray() at /home/cameron/project/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:85
PhpParser\NodeTraverser->traverse() at /home/cameron/project/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeFinder.php:59
PhpParser\NodeFinder->findFirst() at /home/cameron/project/vendor/rector/rector/src/PhpParser/Node/BetterNodeFinder.php:223
Rector\Core\PhpParser\Node\BetterNodeFinder->findFirst() at /home/cameron/project/vendor/rector/rector/packages/NodeTypeResolver/PHPStan/CollisionGuard/MixinGuard.php:48
Rector\NodeTypeResolver\PHPStan\CollisionGuard\MixinGuard->containsMixinPhpDoc() at /home/cameron/project/vendor/rector/rector/packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php:148
Rector\NodeTypeResolver\PHPStan\Scope\PHPStanNodeScopeResolver->processNodesWithMixinHandling() at /home/cameron/project/vendor/rector/rector/packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php:140
Rector\NodeTypeResolver\PHPStan\Scope\PHPStanNodeScopeResolver->processNodes() at /home/cameron/project/vendor/rector/rector/packages/NodeTypeResolver/NodeScopeAndMetadataDecorator.php:57
Rector\NodeTypeResolver\NodeScopeAndMetadataDecorator->decorateNodesFromFile() at /home/cameron/project/vendor/rector/rector/src/Application/FileProcessor.php:44
Rector\Core\Application\FileProcessor->parseFileInfoToLocalCache() at /home/cameron/project/vendor/rector/rector/src/Application/FileProcessor/PhpFileProcessor.php:80
Rector\Core\Application\FileProcessor\PhpFileProcessor->Rector\Core\Application\FileProcessor\{closure}() at /home/cameron/project/vendor/rector/rector/src/Application/FileProcessor/PhpFileProcessor.php:144
Rector\Core\Application\FileProcessor\PhpFileProcessor->tryCatchWrapper() at /home/cameron/project/vendor/rector/rector/src/Application/FileProcessor/PhpFileProcessor.php:81
Rector\Core\Application\FileProcessor\PhpFileProcessor->process() at /home/cameron/project/vendor/rector/rector/src/Application/ApplicationFileProcessor.php:76
Rector\Core\Application\ApplicationFileProcessor->processFiles() at /home/cameron/project/vendor/rector/rector/src/Application/ApplicationFileProcessor.php:57
Rector\Core\Application\ApplicationFileProcessor->run() at /home/cameron/project/vendor/rector/rector/src/Console/Command/ProcessCommand.php:152
Rector\Core\Console\Command\ProcessCommand->execute() at /home/cameron/project/vendor/rector/rector/vendor/symfony/console/Command/Command.php:274
RectorPrefix20211110\Symfony\Component\Console\Command\Command->run() at /home/cameron/project/vendor/rector/rector/vendor/symfony/console/Application.php:870
RectorPrefix20211110\Symfony\Component\Console\Application->doRunCommand() at /home/cameron/project/vendor/rector/rector/vendor/symfony/console/Application.php:266
RectorPrefix20211110\Symfony\Component\Console\Application->doRun() at /home/cameron/project/vendor/rector/rector/src/Console/ConsoleApplication.php:71
Rector\Core\Console\ConsoleApplication->doRun() at /home/cameron/project/vendor/rector/rector/vendor/symfony/console/Application.php:162
RectorPrefix20211110\Symfony\Component\Console\Application->run() at /home/cameron/project/vendor/rector/rector/bin/rector.php:63
require_once() at /home/cameron/project/vendor/rector/rector/bin/rector:5
Minimal PHP Code Causing Issue
// rector.php
<?php
declare(strict_types=1);
use Rector\Core\Configuration\Option;
use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
// get parameters
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PATHS, [
__DIR__.'/src'
]);
// Define what rule sets will be applied
$containerConfigurator->import(SetList::DEAD_CODE);
};
<?php
declare(strict_types=1);
use Elastica\Query\MatchQuery;
new MatchQuery();
Expected Behaviour
[OK] Rector is done!