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 crashes with PHPStan 1.10.55 #8395

Closed
X-Coder264 opened this issue Jan 8, 2024 · 10 comments
Closed

Rector crashes with PHPStan 1.10.55 #8395

X-Coder264 opened this issue Jan 8, 2024 · 10 comments
Labels

Comments

@X-Coder264
Copy link

Bug Report

Subject Details
Rector version 0.18.13

Updating from PHPStan 1.10.54 to 1.10.55 causes Rector to crash.

Fatal error: Uncaught Error: Call to a member function end() on null in /srv/app/vendor/rector/rector/vendor/symplify/easy-parallel/src/ValueObject/ParallelProcess.php:120
Stack trace:
#0 /srv/app/vendor/rector/rector/vendor/symplify/easy-parallel/src/ValueObject/ProcessPool.php(49): RectorPrefix202312\Symplify\EasyParallel\ValueObject\ParallelProcess->quit()
#1 /srv/app/vendor/rector/rector/vendor/symplify/easy-parallel/src/ValueObject/ProcessPool.php(59): RectorPrefix202312\Symplify\EasyParallel\ValueObject\ProcessPool->quitProcess()
#2 /srv/app/vendor/rector/rector/packages/Parallel/Application/ParallelFileProcessor.php(145): RectorPrefix202312\Symplify\EasyParallel\ValueObject\ProcessPool->quitAll()
#3 /srv/app/vendor/rector/rector/vendor/symplify/easy-parallel/src/ValueObject/ParallelProcess.php(130): Rector\Parallel\Application\ParallelFileProcessor->Rector\Parallel\Application\{closure}()
#4 /srv/app/vendor/rector/rector/vendor/evenement/evenement/src/EventEmitterTrait.php(111): RectorPrefix202312\Symplify\EasyParallel\ValueObject\ParallelProcess->RectorPrefix202312\Symplify\EasyParallel\ValueObject\{closure}()
#5 /srv/app/vendor/rector/rector/vendor/clue/ndjson-react/src/Decoder.php(117): RectorPrefix202312\Evenement\EventEmitter->emit()
#6 /srv/app/vendor/rector/rector/vendor/evenement/evenement/src/EventEmitterTrait.php(111): RectorPrefix202312\Clue\React\NDJson\Decoder->handleData()
#7 /srv/app/vendor/rector/rector/vendor/react/stream/src/Util.php(62): RectorPrefix202312\Evenement\EventEmitter->emit()
#8 /srv/app/vendor/rector/rector/vendor/evenement/evenement/src/EventEmitterTrait.php(111): RectorPrefix202312\React\Stream\Util::RectorPrefix202312\React\Stream\{closure}()
#9 /srv/app/vendor/rector/rector/vendor/react/stream/src/DuplexResourceStream.php(154): RectorPrefix202312\Evenement\EventEmitter->emit()
#10 /srv/app/vendor/rector/rector/vendor/react/event-loop/src/StreamSelectLoop.php(201): RectorPrefix202312\React\Stream\DuplexResourceStream->handleData()
#11 /srv/app/vendor/rector/rector/vendor/react/event-loop/src/StreamSelectLoop.php(173): RectorPrefix202312\React\EventLoop\StreamSelectLoop->waitForStreamActivity()
#12 /srv/app/vendor/rector/rector/packages/Parallel/Application/ParallelFileProcessor.php(184): RectorPrefix202312\React\EventLoop\StreamSelectLoop->run()
#13 /srv/app/vendor/rector/rector/src/Application/ApplicationFileProcessor.php(230): Rector\Parallel\Application\ParallelFileProcessor->process()
#14 /srv/app/vendor/rector/rector/src/Application/ApplicationFileProcessor.php(126): Rector\Core\Application\ApplicationFileProcessor->runParallel()
#15 /srv/app/vendor/rector/rector/src/Console/Command/ProcessCommand.php(117): Rector\Core\Application\ApplicationFileProcessor->run()
#16 /srv/app/vendor/rector/rector/vendor/symfony/console/Command/Command.php(327): Rector\Core\Console\Command\ProcessCommand->execute()
#17 /srv/app/vendor/rector/rector/vendor/symfony/console/Application.php(960): RectorPrefix202312\Symfony\Component\Console\Command\Command->run()
#18 /srv/app/vendor/rector/rector/vendor/symfony/console/Application.php(333): RectorPrefix202312\Symfony\Component\Console\Application->doRunCommand()
#19 /srv/app/vendor/rector/rector/src/Console/ConsoleApplication.php(53): RectorPrefix202312\Symfony\Component\Console\Application->doRun()
#20 /srv/app/vendor/rector/rector/vendor/symfony/console/Application.php(216): Rector\Core\Console\ConsoleApplication->doRun()
#21 /srv/app/vendor/rector/rector/bin/rector.php(129): RectorPrefix202312\Symfony\Component\Console\Application->run()
#22 /srv/app/vendor/rector/rector/bin/rector(5): require_once('...')
#23 /srv/app/vendor/bin/rector(117): include('...')
#24 {main}
  thrown in /srv/app/vendor/rector/rector/vendor/symplify/easy-parallel/src/ValueObject/ParallelProcess.php on line 120

If I add the disableParallel call in my Rector config and I re-run it then I get a bunch of these errors in the output:

 [ERROR] Could not process "src/Foo/Bar.php" file, due
         to:                                                                                                            
         "Call to undefined method PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode::getRequireExtendsTagValues()". On line:  
         330
@X-Coder264 X-Coder264 added the bug label Jan 8, 2024
@samsonasik
Copy link
Member

You can try latest rector/rector:dev-main that use preload latest phpstan/phpdoc-parser.

composer config minimum-stability dev
composer config prefer-stable true
composer require --dev rector/rector:dev-main

@X-Coder264
Copy link
Author

I can confirm that there are no crashes with the dev-main version. When can we expect a tag for it?

@TomasVotruba
Copy link
Member

@X-Coder264 I'll look into tagging today to tomorrow, to fix this one. We'll heading towards 0.19 release, as there was change in namespace for Core classes.

@samsonasik
Copy link
Member

Rector 0.19.0 released https://github.com/rectorphp/rector/releases/tag/0.19.0

@alexander-schranz
Copy link

Is there any fix for 0.18.x version of rector for this?

@TomasVotruba
Copy link
Member

TomasVotruba commented Jan 9, 2024

@alexander-schranz The PHPStan BC break came in a time we've also done change in Rector namespace, so no. We could do such release, but it would miss other dozens of fixes we've done in coming up to 0.19.

Bump to Rector 0.19 and let us know what you need help with 👍

@alexander-schranz
Copy link

alexander-schranz commented Jan 9, 2024

Thought that. I currently conflict the 1.10.55 version in sulu/rector for all which are on rector 0.18. And then do a seperate release which require atleast rector 0.19.

Thx for the quick response.

@devin-purple
Copy link

Rector 0.19.0 released https://github.com/rectorphp/rector/releases/tag/0.19.0

can you bump packagist? still on 0.18.6

@samsonasik
Copy link
Member

@devin-purple you can bump your composer.json to use `"rector/rector": "^0.19"

@alexander-schranz
Copy link

alexander-schranz commented Jan 11, 2024

@devin-purple Composer follows Semantic Versioning when you use ^0.18 and in semantic versioning 0.x version are not auto updated e.g. 0.x versions 0.18 -> 0.19 are interpreted as major releases as they can contain bc breaks. So to jump to 0.19 you need to tell composer with ^0.19 that you want that new version. Only in >=1.x semantic versioning contains minor releases without bc breaks, which composer automatic installs.

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

5 participants