phpstan / phpstan-strict-rules

Extra strict and opinionated rules for PHPStan
MIT License
605 stars 48 forks source link

Nette\Schema\ValidationException: Unexpected item 'parameters › checkDynamicProperties' #172

Closed gilbertsoft closed 2 years ago

gilbertsoft commented 2 years ago

Since version 1.2.0 I'm getting the following exception when running rector:

Fatal error: Uncaught _PHPStan_c0c409264\Nette\Schema\ValidationException: Unexpected item 'parameters › checkDynamicProperties'. in phar:///var/www/html/tools/phpstan/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Processor.php:75

I guess it's related to the commit https://github.com/phpstan/phpstan-strict-rules/commit/afbe1e3235c51ee3f10ba4c8b32449099016ea02.

Packages installed:

jangregor/phpstan-prophecy        1.0.0   Provides a phpstan/phpstan extension for phpspec/prophecy
phpstan/extension-installer       1.1.0   Composer plugin for automatic installation of PHPStan extensions
phpstan/phpstan                   1.6.1   PHPStan - PHP Static Analysis Tool
phpstan/phpstan-deprecation-rules 1.0.0   PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.
phpstan/phpstan-phpunit           1.1.1   PHPUnit extensions and rules for PHPStan
phpstan/phpstan-strict-rules      1.2.0   Extra strict and opinionated rules for PHPStan
phpstan/phpstan-symfony           1.1.8   Symfony Framework extensions and rules for PHPStan
rector/rector                     0.12.21 Instant Upgrade and Automated Refactoring of any PHP code

Downgrading phpstan/phpstan-strict-rules to 1.1.0 solves the issue.

Stack trace:

#0 phar:///var/www/html/tools/phpstan/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Processor.php(38): _PHPStan_c0c409264\Nette\Schema\Processor->throwsErrors()
#1 phar:///var/www/html/tools/phpstan/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/DependencyInjection/ParametersSchemaExtension.php(43): _PHPStan_c0c409264\Nette\Schema\Processor->process(Object(_PHPStan_c0c409264\Nette\Schema\Elements\Structure), NULL)
#2 phar:///var/www/html/tools/phpstan/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Compiler.php(182): PHPStan\DependencyInjection\ParametersSchemaExtension->loadConfiguration()
#3 phar:///var/www/html/tools/phpstan/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Compiler.php(158): _PHPStan_c0c409264\Nette\DI\Compiler->processExtensions()
#4 phar:///var/www/html/tools/phpstan/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/ContainerLoader.php(99): _PHPStan_c0c409264\Nette\DI\Compiler->compile()
#5 phar:///var/www/html/tools/phpstan/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/ContainerLoader.php(66): _PHPStan_c0c409264\Nette\DI\ContainerLoader->generate('Container_647d3...', Array)
#6 phar:///var/www/html/tools/phpstan/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/ContainerLoader.php(34): _PHPStan_c0c409264\Nette\DI\ContainerLoader->loadFile('Container_647d3...', Array)
#7 phar:///var/www/html/tools/phpstan/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/DependencyInjection/Configurator.php(40): _PHPStan_c0c409264\Nette\DI\ContainerLoader->load(Array, Array)
#8 phar:///var/www/html/tools/phpstan/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/bootstrap/src/Bootstrap/Configurator.php(175): PHPStan\DependencyInjection\Configurator->loadContainer()
#9 phar:///var/www/html/tools/phpstan/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/DependencyInjection/ContainerFactory.php(81): _PHPStan_c0c409264\Nette\Bootstrap\Configurator->createContainer()
#10 /var/www/html/tools/phpstan/vendor/rector/rector/packages/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php(43): PHPStan\DependencyInjection\ContainerFactory->create('/tmp', Array, Array)
#11 [internal function]: Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory->__construct(Object(RectorPrefix20220418\Symplify\PackageBuilder\Parameter\ParameterProvider))
#12 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(879): ReflectionClass->newInstanceArgs(Array)
#13 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(481): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->createService(Object(RectorPrefix20220418\Symfony\Component\DependencyInjection\Definition), Array, true, 'Rector\\NodeType...')
#14 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(989): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doGet('Rector\\NodeType...', 1, Array, true)
#15 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(861): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Object(RectorPrefix20220418\Symfony\Component\DependencyInjection\Reference), Array, true)
#16 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(481): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->createService(Object(RectorPrefix20220418\Symfony\Component\DependencyInjection\Definition), Array, true, 'Rector\\NodeType...')
#17 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(989): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doGet('Rector\\NodeType...', 1, Array, true)
#18 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(940): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Object(RectorPrefix20220418\Symfony\Component\DependencyInjection\TypedReference), Array, true)
#19 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(858): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Array, Array, true)
#20 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(481): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->createService(Object(RectorPrefix20220418\Symfony\Component\DependencyInjection\Definition), Array, true, 'Rector\\Core\\Sta...')
#21 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(989): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doGet('Rector\\Core\\Sta...', 1, Array, true)
#22 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(940): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Object(RectorPrefix20220418\Symfony\Component\DependencyInjection\TypedReference), Array, true)
#23 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(858): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Array, Array, true)
#24 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(481): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->createService(Object(RectorPrefix20220418\Symfony\Component\DependencyInjection\Definition), Array, true, 'Rector\\Core\\Aut...')
#25 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(989): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doGet('Rector\\Core\\Aut...', 1, Array, true)
#26 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(940): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Object(RectorPrefix20220418\Symfony\Component\DependencyInjection\TypedReference), Array, true)
#27 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(858): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Array, Array, true)
#28 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(481): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->createService(Object(RectorPrefix20220418\Symfony\Component\DependencyInjection\Definition), Array, true, 'Rector\\Core\\Con...')
#29 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(989): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doGet('Rector\\Core\\Con...', 1, Array, true)
#30 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(940): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Object(RectorPrefix20220418\Symfony\Component\DependencyInjection\Reference), Array, true)
#31 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(940): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Array, Array, true)
#32 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(858): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Array, Array, true)
#33 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(481): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->createService(Object(RectorPrefix20220418\Symfony\Component\DependencyInjection\Definition), Array, true, 'Rector\\Core\\Con...')
#34 /var/www/html/tools/phpstan/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(432): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->doGet('Rector\\Core\\Con...', 1)
#35 /var/www/html/tools/phpstan/vendor/rector/rector/bin/rector.php(56): RectorPrefix20220418\Symfony\Component\DependencyInjection\ContainerBuilder->get('Rector\\Core\\Con...')
#36 /var/www/html/tools/phpstan/vendor/rector/rector/bin/rector(5): require_once('/var/www/html/t...')
#37 /var/www/html/vendor/bin/rector(117): include('/var/www/html/t...')
#38 {main}
  thrown in phar:///var/www/html/tools/phpstan/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Processor.php on line 75
ondrejmirtes commented 2 years ago

phpstan-strict-rules require PHPStan 1.6.0. I think you somehow mixed up and you’re running with different PHPStan version from another location.

It’s quite obvious from the path: /var/www/html/tools/phpstan/vendor/rector/rector/vendor/phpstan/phpstan

gilbertsoft commented 2 years ago

Yes, looks you're right, maybe rector changed their packaging or my setup was wrong since ever. Will separate rector now into another namespace which should solve the issue then.

github-actions[bot] commented 2 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.