rectorphp / rector

Instant Upgrades and Automated Refactoring of any PHP 5.3+ code
https://getrector.com
MIT License
8.73k stars 686 forks source link

Error with new PHPStan 1.6.0 #7133

Closed jordisala1991 closed 2 years ago

jordisala1991 commented 2 years ago

Bug Report

Subject Details
Rector version v0.12.21

Since the new release of PHPStan 1.6.0, with PHPStan strict rules 1.2.0, rector no longer works.

Probably the related commit here: https://github.com/phpstan/phpstan-strict-rules/commit/afbe1e3235c51ee3f10ba4c8b32449099016ea02

Minimal PHP Code Causing Issue

https://github.com/sonata-project/SonataAdminBundle/pull/7795

PHP Fatal error:  Uncaught _PHPStan_c0c40[9](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:9)264\Nette\Schema\ValidationException: Unexpected item 'parameters › checkDynamicProperties'. in phar:///home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Processor.php:75
Stack trace:
#0 phar:///home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Processor.php(38): _PHPStan_c0c409264\Nette\Schema\Processor->throwsErrors()
#1 phar:///home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/DependencyInjection/ParametersSchemaExtension.php(43): _PHPStan_c0c409264\Nette\Schema\Processor->process()
#2 phar:///home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Compiler.php(182): PHPStan\DependencyInjection\ParametersSchemaExtension->loadConfiguration()
#3 phar:///home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Compiler.php(158): _PHPStan_c0c409264\Nette\DI\Compiler->processExtensions()
#4 phar:///home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/ContainerLoader.php(99): _PHPStan_c0c409264\Nette\DI\Compiler->compile()
#5 phar:///home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/ContainerLoader.php(66): _PHPStan_c0c409264\Nette\DI\ContainerLoader->generate()
#6 phar:///home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/ContainerLoader.php(34): _PHPStan_c0c409264\Nette\DI\ContainerLoader->loadFile()
#7 phar:///home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/DependencyInjection/Configurator.php(40): _PHPStan_c0c409264\Nette\DI\ContainerLoader->load()
#8 phar:///home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/bootstrap/src/Bootstrap/Configurator.php(175): PHPStan\DependencyInjection\Configurator->loadContainer()
#9 phar:///home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/DependencyInjection/ContainerFactory.php(81): _PHPStan_c0c409264\Nette\Bootstrap\Configurator->createContainer()
#[10](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:10) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/packages/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php(43): PHPStan\DependencyInjection\ContainerFactory->create()
#[11](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:11) [internal function]: Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory->__construct()
#[12](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:12) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(879): ReflectionClass->newInstanceArgs()
#[13](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:13) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(481): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->createService()
#[14](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:14) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(989): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doGet()
#[15](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:15) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(861): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices()
#[16](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:16) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(481): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->createService()
#[17](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:17) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(989): RectorPrefix202204[18](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:18)\Symfony\Component\DependencyInjection\ContainerBuilder->doGet()
#18 /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(940): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices()
#[19](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:19) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(858): RectorPrefix[20](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:20)220418\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices()
#20 /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(481): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->createService()
#[21](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:21) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(989): RectorPrefix20[22](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:22)0418\Symfony\Component\DependencyInjection\ContainerBuilder->doGet()
#22 /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(940): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices()
#[23](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:23) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(858): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices()
#[24](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:24) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(481): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->createService()
#[25](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:25) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(989): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doGet()
#[26](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:26) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(940): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices()
#[27](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:27) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(858): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices()
#[28](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:28) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(481): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->createService()
#[29](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:29) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(989): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doGet()
#[30](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:30) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(940): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices()
#[31](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:31) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(940): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices()
#[32](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:32) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(858): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices()
#[33](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:33) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(481): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->createService()
#[34](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:34) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(432): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doGet()
#[35](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:35) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/bin/rector.php(56): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->get()
#[36](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:36) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/bin/rector(5): require_once('...')
#[37](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:37) /home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/bin/rector(117): include('...')
#[38](https://github.com/sonata-project/SonataAdminBundle/runs/6188547255?check_suite_focus=true#step:5:38) {main}
  thrown in phar:///home/runner/work/SonataAdminBundle/SonataAdminBundle/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Processor.php on line 75

Expected Behaviour

No errors and normal rector run.

samsonasik commented 2 years ago

could you verify if the issue exists in "rector/rector": "dev-main" ?

jordisala1991 commented 2 years ago

Yes, with dev branch it works.

TomasVotruba commented 2 years ago

We'll release a new version today 👍

samsonasik commented 2 years ago

rector 0.12.22 released https://github.com/rectorphp/rector/releases/tag/0.12.22 . I am closing it ;)