Skip to content

DE-175591 fix: adapt to the Skipper collaborators removed in Rector 2.5.9 - #127

Merged
tomasJancar merged 2 commits into
masterfrom
DE-175591-rector-2.5.9-support
Aug 4, 2026
Merged

DE-175591 fix: adapt to the Skipper collaborators removed in Rector 2.5.9#127
tomasJancar merged 2 commits into
masterfrom
DE-175591-rector-2.5.9-support

Conversation

@tomasJancar

@tomasJancar tomasJancar commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Description: Drop the Rector Skipper services removed in 2.5.9, switch to matchPattern(), and raise the rector/rector floor to ^2.5.9
Possible impact: Fixes the PHPStan and Rector CI jobs in every repository consuming this package; raises the minimum Rector version


What broke

rectorphp/rector-src#8226"Collapse single-use Skipper collaborators", merged 2026-07-30, shipped in 2.5.9 — removed three classes and inlined them as private methods:

Removed in 2.5.9 Was 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

FileInfoMatcher itself stays, but ends up with an empty constructor. None of the three removed classes were ever used by our own code — they were in the service list purely so PHPStan could build FileInfoMatcher's constructor.

Every consumer's PHPStan run then died before analysing anything:

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

Verified via class_exists() on 2.5.9 and 2.6.0 — the three are genuinely gone, not renamed or aliased.

No repository here commits a composer.lock, so CI resolves the newest matching dependency. The day 2.5.9 was published (3 days after 2.5.8) the PHPStan and Rector jobs went red across all consumers, on branches that changed nothing related.

The change

  • Both neon files: the three removed services are gone. FileInfoMatcher is no longer listed either — with an empty constructor it does not need to be, and the rules still receive it through the existing autowiring.
  • Both rules: doesFileInfoMatchPatterns(...)matchPattern(...) !== null. matchPattern() returns the matched pattern or null, and exists in every supported version.
  • The test: new FileInfoMatcher() without arguments.
  • composer.json: rector/rector floor ^2.3^2.5.9.

Why the floor has to move

The constructor change cannot be satisfied for both sides at once: neon cannot register a service conditionally and PHPStan autowires the constructor, so ≤2.5.8 needs the three collaborators in the service list while ≥2.5.9 must not have them. Measured both ways:

  • list them → 2.5.9 fails with Class ... not found
  • omit them → 2.5.8 fails with Service of type FnMatchPathNormalizer required by $fnMatchPathNormalizer ... not found

So supporting both would mean not using FileInfoMatcher at all (an earlier revision of this PR copied its ~100 lines locally, at +287/−19). Raising the floor keeps the diff at +10/−17 and keeps the matching in Rector's hands, which is where it belongs.

Consumer impact

Checked each consumer's own rector/rector constraint against the new floor with the real composer resolver:

Repo Its constraint Result
channel-integrations ^2.0 ✅ resolves
platform-backend ^2.4.1 ✅ resolves
services-monorepo 2.2.3 (exact pin) ❌ conflicts

services-monorepo pins an exact version, so it will need that pin raised when a new tag of this package is released. Out of scope here.

Test plan

Fresh install of each version, full gate set:

Rector 2.5.9 Rector 2.6.0
PHPStan ✅ no errors ✅ no errors
PHPUnit ✅ 80 tests ✅ 80 tests
Rector dry-run ✅ clean ✅ clean
ECS ✅ clean ✅ clean

Follow-up

Worth a separate ticket: 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 — exactly what happened here.

🤖 Generated with Claude Code

@tomasJancar
tomasJancar force-pushed the DE-175591-rector-2.5.9-support branch from b1240e6 to 074e5a5 Compare August 3, 2026 09:30
@tomasJancar tomasJancar changed the title DE-175591 fix: support Rector 2.5.9 by owning the file pattern matching DE-175591 fix: support Rector 2.5.9+ by owning the file pattern matching Aug 3, 2026
….5.9

Rector 2.5.9 (rectorphp/rector-src#8226, "Collapse single-use Skipper
collaborators") removed Rector\Skipper\FileSystem\FnMatchPathNormalizer,
Rector\Skipper\Fnmatcher and Rector\Skipper\RealpathMatcher, inlining them as
private methods of FileInfoMatcher. FileInfoMatcher itself stays, but ends up
with an empty constructor and without its doesFileInfoMatchPatterns() method.

Both neon files registered the three removed classes as services, so every
consumer's PHPStan run died before analysing anything:

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

Since no repository here commits a composer.lock, CI resolves the newest matching
dependency, so the PHPStan and Rector jobs broke across all consumers the day
2.5.9 was published - on branches that changed nothing related.

The three services are gone from both neon files, the two rules call
matchPattern() (which returns the matched pattern or null and exists in every
supported version), and the test instantiates FileInfoMatcher without arguments.
FileInfoMatcher is no longer listed either: with an empty constructor it does not
need to be, and the rules receive it through the existing autowiring.

The rector/rector floor moves to ^2.5.9, because the constructor change cannot be
satisfied for both sides at once - neon cannot register a service conditionally
and PHPStan autowires the constructor, so <=2.5.8 needs the three collaborators in
the service list while >=2.5.9 must not have them.

Verified with a fresh install of Rector 2.5.9 and 2.6.0: PHPStan clean, 80 tests
green, Rector dry-run clean, ECS clean on both.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@tomasJancar
tomasJancar force-pushed the DE-175591-rector-2.5.9-support branch from 074e5a5 to 2f345d7 Compare August 3, 2026 11:47
@tomasJancar tomasJancar changed the title DE-175591 fix: support Rector 2.5.9+ by owning the file pattern matching DE-175591 fix: adapt to the Skipper collaborators removed in Rector 2.5.9 Aug 3, 2026
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@tomasJancar
tomasJancar merged commit bb11451 into master Aug 4, 2026
20 checks passed
@tomasJancar
tomasJancar deleted the DE-175591-rector-2.5.9-support branch August 4, 2026 09:55
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.

3 participants