Skip to content

[Reporting] Keep needed skip when two skipped rules would make the same change - #9072

Merged
TomasVotruba merged 3 commits into
mainfrom
tv-repro-9979-shared-skip
Nov 27, 2026
Merged

TomasVotruba merged 3 commits into
mainfrom
tv-repro-9979-shared-skip

Conversation

@TomasVotruba

@TomasVotruba TomasVotruba commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Fixes rectorphp/rector#9979

RemoveDeadInstanceOfRector and RemoveAlwaysTrueIfConditionRector are both skipped on the same file, and each one alone changes it. NeededSkipVerifier re-ran the file once with all skips off, so the first rule made the change and the second found nothing left. Its skip was then reported as unnecessary, but removing it changed the file.

Now each skipped rule is verified on its own: the file is re-run with only that rule's skip lifted, while other skips keep applying. This matches what happens when the user removes that one skip.

  • Skipper::startVerifyingSkip(string $rectorClass) replaces the all-off flag
  • NeededSkipVerifier re-runs per rule + file pair (dry run only, reporting phase)
  • test with the sealed class case from the issue

@TomasVotruba TomasVotruba changed the title [Reporting] Add failing test for needed skip reported as unnecessary when two skipped rules make the same change [Reporting] Keep needed skip when two skipped rules would make the same change Nov 26, 2026
@TomasVotruba
TomasVotruba force-pushed the tv-repro-9979-shared-skip branch from 5943814 to 16de11c Compare November 27, 2026 11:34
@TomasVotruba
TomasVotruba merged commit c90860d into main Nov 27, 2026
51 checks passed
@TomasVotruba
TomasVotruba deleted the tv-repro-9979-shared-skip branch November 27, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

reportUnusedSkips() reports a needed skip as unnecessary when two skipped rules would change the same code

1 participant