Skip to content

Unexpected error in PHPParser #8157

@alexander-schranz

Description

@alexander-schranz

Bug Report

Subject Details
Rector version ^0.16, ^0.17

Currently I run with sulu-rector into the following errors

0.16:

Error: Call to undefined method PhpParser\Node\Name::getParts()

Full Stack Trace
1) Sulu\Rector\Tests\Set\Sulu24\Sulu24Test::test with data set #0 ('/Users/alexanderschranz/Docum...hp.inc')
Error: Call to undefined method PhpParser\Node\Name::getParts()

phar:///Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/SourceLocator/Ast/Strategy/NodeToReflection.php:26
phar:///Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocator.php:82
phar:///Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/SourceLocator/Type/AggregateSourceLocator.php:26
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/packages/NodeTypeResolver/Reflection/BetterReflection/SourceLocator/IntermediateSourceLocator.php:30
phar:///Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/SourceLocator/Type/AggregateSourceLocator.php:26
phar:///Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/SourceLocator/Type/MemoizingSourceLocator.php:33
phar:///Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/Reflector/DefaultReflector.php:32
phar:///Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/Reflector/MemoizingReflector.php:45
phar:///Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/BetterReflectionProvider.php:147
phar:///Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/phpstan/phpstan/phpstan.phar/src/Reflection/ReflectionProvider/MemoizingReflectionProvider.php:35
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php:346
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php:203
phar:///Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php:441
phar:///Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php:384
phar:///Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php:612
phar:///Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php:353
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php:332
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php:215
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/packages/NodeTypeResolver/NodeScopeAndMetadataDecorator.php:41
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/src/Application/FileProcessor.php:54
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/src/Application/FileProcessor/PhpFileProcessor.php:165
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/src/Application/FileProcessor/PhpFileProcessor.php:104
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/src/Application/ApplicationFileProcessor.php:169
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/packages/Testing/PHPUnit/AbstractRectorTestCase.php:161
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/packages/Testing/PHPUnit/AbstractRectorTestCase.php:135
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/packages/Testing/PHPUnit/AbstractRectorTestCase.php:116
/Users/alexanderschranz/Documents/Projects/sulu-rector/tests/Set/Sulu24/Sulu24Test.php:17

0.17.3 Update 0.17.2 works

  1. Sulu\Rector\Tests\Set\Sulu24\Sulu24Test::test with data set #0 ('/Users/alexanderschranz/Docum...hp.inc')
    RectorPrefix202308\Symfony\Component\Config\Exception\LoaderLoadException: Expected an existing class name. Got: "Rector\Core\NonPhpFile\Rector\RenameClassNonPhpRector" in /Users/alexanderschranz/Documents/Projects/sulu-rector/tests/Set/Sulu24/config/../../../../config/config.php (which is being imported from "/Users/alexanderschranz/Documents/Projects/sulu-rector/tests/Set/Sulu24/config/sulu-24.php").
Full Stack trace
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/vendor/symfony/config/Loader/FileLoader.php:166
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/vendor/symfony/config/Loader/FileLoader.php:90
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/vendor/symfony/dependency-injection/Loader/FileLoader.php:60
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/src/DependencyInjection/Loader/ConfigurableCallValuesCollectingPhpFileLoader.php:47
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php:83
/Users/alexanderschranz/Documents/Projects/sulu-rector/tests/Set/Sulu24/config/sulu-24.php:9
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php:138
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php:67
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/src/DependencyInjection/Loader/ConfigurableCallValuesCollectingPhpFileLoader.php:34
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/vendor/symfony/config/Loader/DelegatingLoader.php:37
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/src/Kernel/ContainerBuilderFactory.php:66
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/src/Kernel/ContainerBuilderFactory.php:53
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/src/Kernel/ContainerBuilderBuilder.php:24
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/src/Kernel/RectorKernel.php:55
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/src/Kernel/RectorKernel.php:27
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/packages/Testing/PHPUnit/AbstractTestCase.php:37
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/packages/Testing/PHPUnit/AbstractRectorTestCase.php:48

Caused by
RectorPrefix202308\Webmozart\Assert\InvalidArgumentException: Expected an existing class name. Got: "Rector\Core\NonPhpFile\Rector\RenameClassNonPhpRector"

/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/vendor/webmozart/assert/src/Assert.php:1601
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/vendor/webmozart/assert/src/Assert.php:1168
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/packages/Config/RectorConfig.php:154
/Users/alexanderschranz/Documents/Projects/sulu-rector/config/config.php:20
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php:138
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php:67
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/src/DependencyInjection/Loader/ConfigurableCallValuesCollectingPhpFileLoader.php:34
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/vendor/symfony/config/Loader/FileLoader.php:153
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/vendor/symfony/config/Loader/FileLoader.php:90
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/vendor/symfony/dependency-injection/Loader/FileLoader.php:60
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/src/DependencyInjection/Loader/ConfigurableCallValuesCollectingPhpFileLoader.php:47
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php:83
/Users/alexanderschranz/Documents/Projects/sulu-rector/tests/Set/Sulu24/config/sulu-24.php:9
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php:138
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php:67
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/src/DependencyInjection/Loader/ConfigurableCallValuesCollectingPhpFileLoader.php:34
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/vendor/symfony/config/Loader/DelegatingLoader.php:37
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/src/Kernel/ContainerBuilderFactory.php:66
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/src/Kernel/ContainerBuilderFactory.php:53
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/src/Kernel/ContainerBuilderBuilder.php:24
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/src/Kernel/RectorKernel.php:55
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/src/Kernel/RectorKernel.php:27
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/packages/Testing/PHPUnit/AbstractTestCase.php:37
/Users/alexanderschranz/Documents/Projects/sulu-rector/vendor/rector/rector/packages/Testing/PHPUnit/AbstractRectorTestCase.php:48

Minimal PHP Code Causing Issue

Currently appears on https://github.com/sulu/sulu-rector

Expected Behaviour

Both versions ^0.16 and ^0.17 did work some time ago so not 100% sure what is now causing this errors 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions