Fix rector CI step broken by phpstan 2.2.6 - #19569
Merged
Merged
Conversation
Rector 2.4.x reads a private RichParser::$container property that phpstan 2.2.6 removed, so composer rector-check dies with a fatal before analyzing anything. rector-setup resolves phpstan unpinned, so every PR started failing once 2.2.6 was released on 2026-07-26. Bump rector-setup to ~2.5.0. Rector 2.5.7+ requires phpstan ^2.2.6 and boots fine against it. Rector 2.5 registers new rules in the sets we enable; they fire on about 226 files, mostly docblock removal. Skip them so this stays a CI fix and touches no src code, matching how the 2.4 bump was handled.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
Coding Standard & Static Analysisjob has been red on every PR since 2026-07-26, and it is not caused by any of those PRs.What breaks
composer rector-checkdies before it analyzes anything:Why
rector-setuppinsrector/rector:"~2.4.0". Rector 2.4.6 requiresphpstan/phpstan: ^2.2.2and reaches into a privateRichParser::$containerproperty viaPHPStanContainerMemento::removeRichVisitors(). PHPStan 2.2.6, released 2026-07-26, no longer has that property, so the unpinned resolution of^2.2.2now picks a PHPStan that Rector 2.4.x cannot boot against.Verified locally:
Upstream fixed this in rector 2.5.7/2.5.8, which raise the requirement to
phpstan/phpstan: ^2.2.6.The change
rector-setupnow installsrector/rector:"~2.5.0".RemoveUselessUnionReturnDocblockRector,RemoveMixedDocblockOverruledByNativeTypeRector,RemoveDuplicatedReturnSelfDocblockRector) plusRemoveDefaultValueFromAssignedPropertyRector. They are skipped here, same way the 2.4 bump handledSafeDeclareStrictTypesRectorandRemoveUselessTernaryRector, so this PR only unblocks CI and changes nosrc/code.Whether to actually apply any of those rules is worth its own PR - I did not want to bury a 226-file sweep inside a CI fix.
Alternative considered
Keeping rector on
~2.4.0and pinningphpstan/phpstanbelow 2.2.6 also makes CI green with a smaller diff, but it freezes a transitive tool at an exact patch to work around a bug upstream has already fixed. Happy to switch if the team prefers that.Two pre-existing skips are now reported as deprecated by rector 2.5 (
JoinStringConcatRector,StrictStringParamConcatRector). Left them in place to keep this diff focused; they can be pruned separately.