Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rector fails with phpstan/phpstan-phpunit 1.3.2 installed #3232

Closed
eliashaeussler opened this issue Dec 13, 2022 · 5 comments
Closed

Rector fails with phpstan/phpstan-phpunit 1.3.2 installed #3232

eliashaeussler opened this issue Dec 13, 2022 · 5 comments
Labels

Comments

@eliashaeussler
Copy link
Contributor

eliashaeussler commented Dec 13, 2022

Bug Report

Subject Details
Rector version v1.0.7

When having Rector installed next to phpstan/phpstan-phpunit and phpstan/extension-installer, I'm currently getting an exception when running Rector. This only happens since updating to phpstan/phpstan-phpunit 1.3.1 or 1.3.2.

Running PHPStan itself (vendor/bin/phpstan analyse) works without any problems.

The following exception occurs:

$ vendor/bin/rector process                                      
PHP Fatal error:  Uncaught _PHPStan_582a9cb8b\Nette\InvalidArgumentException: Missing parameter 'deprecationRulesInstalled'. in phar:///xxx/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Helpers.php:62
Stack trace:
#0 phar:///xxx/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Helpers.php(34): _PHPStan_582a9cb8b\Nette\DI\Helpers::expand('%deprecationRul...', Array, false)
#1 phar:///xxx/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Helpers.php(34): _PHPStan_582a9cb8b\Nette\DI\Helpers::expand(Array, Array, false)
#2 phar:///xxx/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Config/DefinitionSchema.php(139): _PHPStan_582a9cb8b\Nette\DI\Helpers::expand(Array, Array)
#3 phar:///xxx/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Config/DefinitionSchema.php(41): _PHPStan_582a9cb8b\Nette\DI\Config\DefinitionSchema->expandParameters(Array)
#4 phar:///xxx/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Elements/Type.php(153): _PHPStan_582a9cb8b\Nette\DI\Config\DefinitionSchema->complete(Array, Object(_PHPStan_582a9cb8b\Nette\Schema\Context))
#5 phar:///xxx/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Processor.php(57): _PHPStan_582a9cb8b\Nette\Schema\Elements\Type->complete(Array, Object(_PHPStan_582a9cb8b\Nette\Schema\Context))
#6 phar:///xxx/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Compiler.php(217): _PHPStan_582a9cb8b\Nette\Schema\Processor->processMultiple(Object(_PHPStan_582a9cb8b\Nette\Schema\Elements\Type), Array)
#7 phar:///xxx/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Compiler.php(185): _PHPStan_582a9cb8b\Nette\DI\Compiler->processSchema(Object(_PHPStan_582a9cb8b\Nette\Schema\Elements\Type), Array, 'services')
#8 phar:///xxx/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Compiler.php(158): _PHPStan_582a9cb8b\Nette\DI\Compiler->processExtensions()
#9 phar:///xxx/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/ContainerLoader.php(99): _PHPStan_582a9cb8b\Nette\DI\Compiler->compile()
#10 phar:///xxx/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/ContainerLoader.php(66): _PHPStan_582a9cb8b\Nette\DI\ContainerLoader->generate('Container_fb427...', Array)
#11 phar:///xxx/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/ContainerLoader.php(34): _PHPStan_582a9cb8b\Nette\DI\ContainerLoader->loadFile('Container_fb427...', Array)
#12 phar:///xxx/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/DependencyInjection/Configurator.php(51): _PHPStan_582a9cb8b\Nette\DI\ContainerLoader->load(Array, Array)
#13 phar:///xxx/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/bootstrap/src/Bootstrap/Configurator.php(175): PHPStan\DependencyInjection\Configurator->loadContainer()
#14 phar:///xxx/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/DependencyInjection/ContainerFactory.php(107): _PHPStan_582a9cb8b\Nette\Bootstrap\Configurator->createContainer()
#15 /xxx/vendor/rector/rector/packages/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php(45): PHPStan\DependencyInjection\ContainerFactory->create('/var/folders/nl...', Array, Array)
#16 [internal function]: Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory->__construct(Object(Rector\Core\Configuration\Parameter\ParameterProvider))
#17 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(894): ReflectionClass->newInstanceArgs(Array)
#18 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(490): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->createService(Object(RectorPrefix202211\Symfony\Component\DependencyInjection\Definition), Array, true, 'Rector\\NodeType...')
#19 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(1002): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->doGet('Rector\\NodeType...', 1, Array, true)
#20 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(870): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Object(RectorPrefix202211\Symfony\Component\DependencyInjection\Reference), Array, true)
#21 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(490): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->createService(Object(RectorPrefix202211\Symfony\Component\DependencyInjection\Definition), Array, true, 'Rector\\NodeType...')
#22 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(1002): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->doGet('Rector\\NodeType...', 1, Array, true)
#23 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(955): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Object(RectorPrefix202211\Symfony\Component\DependencyInjection\TypedReference), Array, true)
#24 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(880): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Array, Array, true)
#25 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(490): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->createService(Object(RectorPrefix202211\Symfony\Component\DependencyInjection\Definition), Array, true, 'Rector\\Core\\Sta...')
#26 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(1002): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->doGet('Rector\\Core\\Sta...', 1, Array, true)
#27 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(955): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Object(RectorPrefix202211\Symfony\Component\DependencyInjection\TypedReference), Array, true)
#28 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(880): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Array, Array, true)
#29 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(490): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->createService(Object(RectorPrefix202211\Symfony\Component\DependencyInjection\Definition), Array, true, 'Rector\\Core\\Aut...')
#30 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(1002): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->doGet('Rector\\Core\\Aut...', 1, Array, true)
#31 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(955): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Object(RectorPrefix202211\Symfony\Component\DependencyInjection\TypedReference), Array, true)
#32 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(880): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Array, Array, true)
#33 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(490): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->createService(Object(RectorPrefix202211\Symfony\Component\DependencyInjection\Definition), Array, true, 'Rector\\Core\\Con...')
#34 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(1002): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->doGet('Rector\\Core\\Con...', 1, Array, true)
#35 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(955): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Object(RectorPrefix202211\Symfony\Component\DependencyInjection\Reference), Array, true)
#36 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(955): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Array, Array, true)
#37 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(880): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Array, Array, true)
#38 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(490): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->createService(Object(RectorPrefix202211\Symfony\Component\DependencyInjection\Definition), Array, true, 'Rector\\Core\\Con...')
#39 /xxx/vendor/rector/rector/vendor/symfony/dependency-injection/ContainerBuilder.php(441): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->doGet('Rector\\Core\\Con...', 1)
#40 /xxx/vendor/rector/rector/bin/rector.php(127): RectorPrefix202211\Symfony\Component\DependencyInjection\ContainerBuilder->get('Rector\\Core\\Con...')
#41 /xxx/vendor/rector/rector/bin/rector(5): require_once('/xxx...')
#42 /xxx/bin/rector(120): include('/xxx...')
#43 {main}
  thrown in phar:///xxx/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Helpers.php on line 62
Fatal error: Uncaught _PHPStan_582a9cb8b\Nette\InvalidArgumentException: Missing parameter 'deprecationRulesInstalled'. in phar:///xxx/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Helpers.php:62

Minimal PHP Code Causing Issue

My composer.json:

{
    "name": "eliashaeussler/rector-failure-test",
    "require-dev": {
        "phpstan/extension-installer": "1.2.0",
        "phpstan/phpstan": "1.9.3",
        "phpstan/phpstan-phpunit": "1.3.2",
        "ssch/typo3-rector": "1.0.7"
    },
    "config": {
        "sort-packages": true,
        "allow-plugins": {
            "phpstan/extension-installer": true
        }
    }
}
@tomasnorre
Copy link
Contributor

I can confirm this. I don't have tested the Minimal setup, though.
https://typo3.slack.com/archives/C019R5LAA6A/p1671395399418829

@sabbelasichon
Copy link
Owner

@eliashaeussler Could you check if this is fixed with the latest version of typo3-rector 1.1.0

@tomasnorre
Copy link
Contributor

I can confirm that it's working in my setup with TYPO3 Rector 1.1.0

@sabbelasichon
Copy link
Owner

Resolved by #3227

@eliashaeussler
Copy link
Contributor Author

@sabbelasichon Thanks for taking care ❤️ Works like a charm now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants