[#2975] Replaced versioned Drupal Rector sets with the composer-based provider. - #2978
Conversation
… set. 'rector/rector' 2.6.2 removed the versioned 'PHPUnitSetList::PHPUNIT_40' through 'PHPUNIT_130' constants in favour of composer-based sets. The 'palantirnet/drupal-rector' Drupal 8, 9 and 10 deprecation configs still reference 'PHPUnitSetList::PHPUNIT_90', so loading 'Drupal9SetList::DRUPAL_9' or 'Drupal10SetList::DRUPAL_10' aborts Rector before it analyses anything. 'withComposerBased(drupal: TRUE)' loads Drupal sets through 'DrupalSetProvider', which binds each set to a 'drupal/core' version and loads only those the installed core satisfies. On Drupal 11 that resolves to the 11.0-11.4 sets and never the Drupal 9 or 10 configs that carry the removed constant.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (55)
📒 Files selected for processing (9)
WalkthroughThe Rector configuration now loads Drupal rules from the installed Composer package. Custom module and theme tests now run in separate processes through PHPUnit attributes. ChangesTooling and test isolation
Estimated code review effort: 2 (Simple) | ~10 minutes Mergeability Score: ⚪ Minimal · up to This updates Rector configuration and related fixtures to use the Composer-based Drupal rule set; no actionable merge-blocking risk remains beyond normal checks and review. Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@rector.php`:
- Around line 96-99: Add the DrupalSetProvider import and register
DrupalSetProvider::class with withSetProviders before the existing
withComposerBased(drupal: TRUE) call, preserving the current Drupal-specific
rule configuration.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 7e81a13a-e2c0-476f-bc2a-b2c6fea6f6b8
⛔ Files ignored due to path filters (16)
.vortex/installer/tests/Fixtures/handler_process/_baseline/rector.phpis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/rector.phpis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/rector.phpis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/handler_process/theme_claro/rector.phpis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/handler_process/theme_olivero/rector.phpis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/handler_process/theme_stark/rector.phpis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests/rector.phpis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests_circleci/rector.phpis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme/rector.phpis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme_circleci/rector.phpis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/handler_process/tools_no_behat/rector.phpis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/handler_process/tools_no_behat_circleci/rector.phpis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/handler_process/tools_no_eslint_no_theme/rector.phpis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit/rector.phpis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit_circleci/rector.phpis excluded by!.vortex/installer/tests/Fixtures/**.vortex/installer/tests/Fixtures/handler_process/tools_no_stylelint_no_theme/rector.phpis excluded by!.vortex/installer/tests/Fixtures/**
📒 Files selected for processing (1)
rector.php
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
2 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2978 +/- ##
==========================================
- Coverage 87.10% 86.68% -0.42%
==========================================
Files 101 94 -7
Lines 4817 4658 -159
Branches 47 3 -44
==========================================
- Hits 4196 4038 -158
+ Misses 621 620 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
📖 Documentation preview for this pull request has been deployed to Netlify: https://6a7d213d7d7da8873f2f5e18--vortex-docs.netlify.app This preview is rebuilt on every commit and is not the production documentation site. |
…4 test attribute. 'withComposerBased(drupal: TRUE)' only enables the 'drupal' set group; the sets themselves come from 'DrupalRector\Set\DrupalSetProvider', which must be registered with 'withSetProviders()'. Without it Rector loaded no Drupal rules at all and still exited 0, so lint passed while silently covering nothing. 'rector list-rules' reports 98 'DrupalRector' rules with the provider registered and 0 without it. Loading the Drupal 11 sets newly enables 'PhpUnitAddRunTestsInSeparateProcessesAttributeRector' from the 11.4 set, which adds '#[RunTestsInSeparateProcesses]' to Kernel and Functional test classes. The attribute and its import are applied to the example tests so Rector runs clean. PHPUnit runs each of those classes in its own process.
|
Code coverage (threshold: 90%) Per-class coverage |
This comment has been minimized.
This comment has been minimized.
2 similar comments
This comment has been minimized.
This comment has been minimized.
|
Code coverage (threshold: 90%) Per-class coverage |
Closes #2975
Summary
rector/rector 2.6.2 (published 2026-08-12) removed the versioned
Rector\PHPUnit\Set\PHPUnitSetList::PHPUNIT_40throughPHPUNIT_130constants in favour of composer-based sets, butpalantirnet/drupal-rector1.1.2 still referencesPHPUnitSetList::PHPUNIT_90from its Drupal 8/9/10 deprecation configs, whichrector.phploaded viaDrupal9SetList::DRUPAL_9andDrupal10SetList::DRUPAL_10. Because the template commits no lock file, CI resolves rector/rector fresh on every run, so Rector aborts withUndefined constant Rector\PHPUnit\Set\PHPUnitSetList::PHPUNIT_90before analysing anything and fails thelintandvortex-test-workflowchecks regardless of what a branch changed.This branch was green only because nothing had pushed to it since rector/rector 2.6.2 was released: the last push run completed at 03:06Z and 2.6.2 landed at 06:24Z the same day. The next push would have failed the same way
2.xalready did.The versioned set lists are replaced with the composer-based mechanism, which needs two calls that work together:
->withSetProviders(DrupalSetProvider::class)supplies the sets and->withComposerBased(drupal: TRUE)enables thedrupalgroup. Registering the provider matters - with onlywithComposerBased(), Rector loads no Drupal rules at all and still exits 0, so lint passes while covering nothing.vendor/bin/rector list-rulesreports 0DrupalRectorrules without the provider and 98 with it. Both calls exist in rector/rector 2.6.1 and 2.6.2, so the fix is safe across the whole^2.6.1constraint range.DrupalSetProviderbinds each set to adrupal/coreversion throughComposerTriggeredSetand loads only the sets the installed core satisfies. Ondrupal/core11.4.5 that resolves to the Drupal 11.0-11.4 sets plus the version-matched breaking-change sets, and never the Drupal 9 or 10 configs that carry the removed constant. Two consequences follow. Drupal 9 and 10 deprecation rules no longer run against a Drupal 11 site, which is the intended behaviour of the composer-based provider rather than a regression. And the Drupal 11.4 set newly enablesPhpUnitAddRunTestsInSeparateProcessesAttributeRector, which adds#[RunTestsInSeparateProcesses]to Kernel and Functional test classes, tracking Drupal core issue 3445240. PHPUnit then runs each of those classes in its own process, which drupal-rector flags as a change to test execution on PHPUnit 10 and 11, not only on Drupal 12.The same change is applied to
2.xin #2977 and #2979.Changes
->withSets([Drupal9SetList::DRUPAL_9, Drupal10SetList::DRUPAL_10])in the rootrector.phpwith->withSetProviders(DrupalSetProvider::class)and->withComposerBased(drupal: TRUE), swapping theDrupalRector\Set\Drupal9SetListandDrupalRector\Set\Drupal10SetListimports forDrupalRector\Set\DrupalSetProvider.#[RunTestsInSeparateProcesses]and itsPHPUnit\Framework\Attributes\RunTestsInSeparateProcessesimport to the 8 example Kernel, Functional and FunctionalJavascript test classes underweb/modules/custom/andweb/themes/custom/, so Rector runs clean. Rector emits the attribute fully qualified because the config setswithImportNames(importNames: FALSE); the import is added by hand so the template's example code does not mix an importedGroupattribute with a fully qualified one.composer update-snapshots, covering therector.phpbaseline, the example test files, and the diff-hunk line offsets in the scenario fixtures under.vortex/installer/tests/Fixtures/handler_process/.Before / After