Skip to content

DE-175591 fix: pin rector below 2.5.9, which removed classes this package wires - #126

Closed
tomasJancar wants to merge 1 commit into
masterfrom
DE-175591-rector-2.5.9-compat
Closed

DE-175591 fix: pin rector below 2.5.9, which removed classes this package wires#126
tomasJancar wants to merge 1 commit into
masterfrom
DE-175591-rector-2.5.9-compat

Conversation

@tomasJancar

Copy link
Copy Markdown
Contributor

Description: Pin rector/rector below 2.5.9, which removed Skipper classes this package registers as PHPStan services
Possible impact: Fixes the PHPStan and Rector CI jobs in every repository consuming this package


What broke

Rector 2.5.9 removed three classes and one method this package depends on:

Removed in 2.5.9 Used by
Rector\Skipper\FileSystem\FnMatchPathNormalizer default-phpstan.neon + phpstan.neon service list
Rector\Skipper\Fnmatcher same
Rector\Skipper\RealpathMatcher same
FileInfoMatcher::doesFileInfoMatchPatterns() DisallowConstantsInTestsRule, DisallowConstantsInTestsRector

Result — every consumer's PHPStan run dies before analysing anything:

Service (Rector\Skipper\FileSystem\FnMatchPathNormalizer::__construct()):
Class 'Rector\Skipper\FileSystem\FnMatchPathNormalizer' not found.

Why it hit everyone at once

None of these repos commit a composer.lock, so CI resolves the newest matching dependency on every run. The constraint was ^2.3, so the day 2.5.9 was published, PHPStan and Rector started failing on branches that changed nothing related to either.

Found it while opening an unrelated PR on platform-api-client. Confirmed it is not the PR by cloning platform-api-client master and installing fresh — identical failure, so master is red too, and 10 repos consume this package.

Bisected precisely: 2.5.8 works, 2.5.9 breaks.

Why pin rather than support 2.5.9

The two versions cannot be satisfied by one service list. FileInfoMatcher takes those three classes as constructor dependencies in ≤2.5.8 and none in 2.5.9, and PHPStan autowires the constructor from the service list — so any single configuration is wrong for one of the versions.

Supporting 2.5.9 means reworking the rule and the service list around the new API (matchPattern() returns the matched pattern instead of a bool), which is a behavioural change to a shared rule and deserves its own PR. This one just gets the builds green.

Test plan

  • Fresh install with the new constraint resolves rector 2.5.8
  • PHPStan: no errors (was failing before)
  • PHPUnit: 80 tests green
  • Rector dry-run: clean

Follow-up

Two things worth separate tickets:

  1. Support Rector 2.5.9+ — rework the rule/service list around the new FileInfoMatcher API, then lift the pin.
  2. Commit a composer.lock (or at least pin the dev tooling) in these repos. Without one, any upstream release can turn every CI run red with no local change, which is exactly what happened here.

🤖 Generated with Claude Code

…kage wires

Rector 2.5.9 removed Rector\Skipper\FileSystem\FnMatchPathNormalizer,
Rector\Skipper\Fnmatcher and Rector\Skipper\RealpathMatcher, and dropped
FileInfoMatcher::doesFileInfoMatchPatterns() along with the three constructor
dependencies. default-phpstan.neon registers those classes as services and
DisallowConstantsInTestsRule / DisallowConstantsInTestsRector call the removed
method, so every consumer's PHPStan run dies with:

    Service (Rector\Skipper\FileSystem\FnMatchPathNormalizer::__construct()):
    Class 'Rector\Skipper\FileSystem\FnMatchPathNormalizer' not found.

None of these repositories commit a composer.lock, so CI installs the newest
matching dependency and started picking 2.5.9 the moment it was released - the
PHPStan and Rector jobs broke on branches that changed nothing related. Verified
by cloning platform-api-client master and installing fresh: same failure.

Pinning is the fix that restores the builds now. Supporting 2.5.9 needs the rule
and the service list reworked around the new API (matchPattern() returning the
matched pattern instead of a bool, no constructor dependencies), which is a
separate change - the two versions cannot be satisfied by one service list,
because PHPStan autowires the constructor.

Verified with a fresh install: rector 2.5.8 resolved, PHPStan clean, 80 tests
green, Rector dry-run clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@tomasJancar

Copy link
Copy Markdown
Contributor Author

Superseded by #127, which fixes the cause instead of pinning the version.

#127 moves the ~100 lines of path matching into our own FilePatternMatcher, so the package no longer depends on Rector's Skipper internals and works on 2.5.8 and 2.5.9 — verified with a fresh install of each. That also means the next upstream refactor of those internals can't break all 10 consumers again.

Leaving this open for now as a fallback in case #127 needs discussion; will close it once #127 is merged.

@tomasJancar

Copy link
Copy Markdown
Contributor Author

Closing in favour of #127, which keeps the rector/rector constraint at ^2.3 (unlocked, same as master) and fixes the cause instead: the ~100 lines of path matching now live in our own FilePatternMatcher, so the package no longer depends on Rector's Skipper internals.

Verified on the #127 branch: fresh install resolves rector 2.5.9 and PHPStan, 80 tests, Rector dry-run and ECS are all green — also green on 2.5.8.

@tomasJancar tomasJancar closed this Aug 3, 2026
@tomasJancar
tomasJancar deleted the DE-175591-rector-2.5.9-compat branch August 3, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant