Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions .vortex/cli/tests/Fixtures/handler_process/_baseline/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
declare(strict_types=1);

use DrupalFinder\DrupalFinderComposerRuntime;
use DrupalRector\Set\Drupal10SetList;
use DrupalRector\Set\Drupal9SetList;
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
use Rector\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector;
use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector;
Expand Down Expand Up @@ -99,11 +97,10 @@
privatization: TRUE,
typeDeclarations: TRUE,
)
// Drupal-specific deprecation fixes.
->withSets([
Drupal9SetList::DRUPAL_9,
Drupal10SetList::DRUPAL_10,
])
// Drupal-specific deprecation fixes. Each rule is bound to a `drupal/core`
// version and runs only when the installed core matches, so the set tracks
// core upgrades without changing this configuration.
->withComposerBased(drupal: TRUE)
// Additional rules.
->withRules([
DeclareStrictTypesRector::class,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -48,10 +48,10 @@
@@ -46,10 +46,10 @@

return RectorConfig::configure()
->withPaths([
Expand All @@ -13,7 +13,7 @@
__DIR__ . '/tests',
])
->withSkip([
@@ -79,7 +79,7 @@
@@ -77,7 +77,7 @@
RenameVariableToMatchNewTypeRector::class,
SimplifyEmptyCheckOnEmptyArrayRector::class,
StringClassNameToClassConstantRector::class => [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -48,10 +48,10 @@
@@ -46,10 +46,10 @@

return RectorConfig::configure()
->withPaths([
Expand All @@ -13,7 +13,7 @@
__DIR__ . '/tests',
])
->withSkip([
@@ -79,7 +79,7 @@
@@ -77,7 +77,7 @@
RenameVariableToMatchNewTypeRector::class,
SimplifyEmptyCheckOnEmptyArrayRector::class,
StringClassNameToClassConstantRector::class => [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -49,7 +49,6 @@
@@ -47,7 +47,6 @@
return RectorConfig::configure()
->withPaths([
__DIR__ . '/web/modules/custom',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -49,7 +49,6 @@
@@ -47,7 +47,6 @@
return RectorConfig::configure()
->withPaths([
__DIR__ . '/web/modules/custom',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -49,7 +49,6 @@
@@ -47,7 +47,6 @@
return RectorConfig::configure()
->withPaths([
__DIR__ . '/web/modules/custom',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@@ -38,7 +38,6 @@
@@ -36,7 +36,6 @@
use Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector;
use Rector\Php81\Rector\Array_\ArrayToFirstClassCallableRector;
use Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector;
-use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
use Rector\Privatization\Rector\ClassConst\PrivatizeFinalClassConstantRector;
use Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector;
use Rector\Privatization\Rector\MethodCall\PrivatizeLocalGetterToPropertyRector;
@@ -88,8 +87,6 @@
@@ -86,8 +85,6 @@
// PHP version upgrade sets - modernizes syntax to PHP 8.4.
// Includes all rules from PHP 5.3 through 8.4.
->withPhpSets(php84: TRUE)
Expand All @@ -15,7 +15,7 @@
// Code quality improvement sets.
->withPreparedSets(
codeQuality: TRUE,
@@ -107,7 +104,6 @@
@@ -104,7 +101,6 @@
// Additional rules.
->withRules([
DeclareStrictTypesRector::class,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@@ -38,7 +38,6 @@
@@ -36,7 +36,6 @@
use Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector;
use Rector\Php81\Rector\Array_\ArrayToFirstClassCallableRector;
use Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector;
-use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
use Rector\Privatization\Rector\ClassConst\PrivatizeFinalClassConstantRector;
use Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector;
use Rector\Privatization\Rector\MethodCall\PrivatizeLocalGetterToPropertyRector;
@@ -88,8 +87,6 @@
@@ -86,8 +85,6 @@
// PHP version upgrade sets - modernizes syntax to PHP 8.4.
// Includes all rules from PHP 5.3 through 8.4.
->withPhpSets(php84: TRUE)
Expand All @@ -15,7 +15,7 @@
// Code quality improvement sets.
->withPreparedSets(
codeQuality: TRUE,
@@ -107,7 +104,6 @@
@@ -104,7 +101,6 @@
// Additional rules.
->withRules([
DeclareStrictTypesRector::class,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -49,7 +49,6 @@
@@ -47,7 +47,6 @@
return RectorConfig::configure()
->withPaths([
__DIR__ . '/web/modules/custom',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -49,7 +49,6 @@
@@ -47,7 +47,6 @@
return RectorConfig::configure()
->withPaths([
__DIR__ . '/web/modules/custom',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -88,8 +88,6 @@
@@ -86,8 +86,6 @@
// PHP version upgrade sets - modernizes syntax to PHP 8.4.
// Includes all rules from PHP 5.3 through 8.4.
->withPhpSets(php84: TRUE)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -88,8 +88,6 @@
@@ -86,8 +86,6 @@
// PHP version upgrade sets - modernizes syntax to PHP 8.4.
// Includes all rules from PHP 5.3 through 8.4.
->withPhpSets(php84: TRUE)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -49,7 +49,6 @@
@@ -47,7 +47,6 @@
return RectorConfig::configure()
->withPaths([
__DIR__ . '/web/modules/custom',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@@ -38,7 +38,6 @@
@@ -36,7 +36,6 @@
use Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector;
use Rector\Php81\Rector\Array_\ArrayToFirstClassCallableRector;
use Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector;
-use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
use Rector\Privatization\Rector\ClassConst\PrivatizeFinalClassConstantRector;
use Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector;
use Rector\Privatization\Rector\MethodCall\PrivatizeLocalGetterToPropertyRector;
@@ -107,7 +106,6 @@
@@ -104,7 +103,6 @@
// Additional rules.
->withRules([
DeclareStrictTypesRector::class,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@@ -38,7 +38,6 @@
@@ -36,7 +36,6 @@
use Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector;
use Rector\Php81\Rector\Array_\ArrayToFirstClassCallableRector;
use Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector;
-use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
use Rector\Privatization\Rector\ClassConst\PrivatizeFinalClassConstantRector;
use Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector;
use Rector\Privatization\Rector\MethodCall\PrivatizeLocalGetterToPropertyRector;
@@ -107,7 +106,6 @@
@@ -104,7 +103,6 @@
// Additional rules.
->withRules([
DeclareStrictTypesRector::class,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -49,7 +49,6 @@
@@ -47,7 +47,6 @@
return RectorConfig::configure()
->withPaths([
__DIR__ . '/web/modules/custom',
Expand Down
11 changes: 4 additions & 7 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
declare(strict_types=1);

use DrupalFinder\DrupalFinderComposerRuntime;
use DrupalRector\Set\Drupal10SetList;
use DrupalRector\Set\Drupal9SetList;
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
use Rector\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector;
use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector;
Expand Down Expand Up @@ -101,11 +99,10 @@
privatization: TRUE,
typeDeclarations: TRUE,
)
// Drupal-specific deprecation fixes.
->withSets([
Drupal9SetList::DRUPAL_9,
Drupal10SetList::DRUPAL_10,
])
// Drupal-specific deprecation fixes. Each rule is bound to a `drupal/core`
// version and runs only when the installed core matches, so the set tracks
// core upgrades without changing this configuration.
->withComposerBased(drupal: TRUE)
Comment on lines +102 to +105

@coderabbitai coderabbitai Bot Aug 13, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

find .artifacts -maxdepth 1 -type f -name 'docs-*.md' -print

Repository: drevops/vortex

Length of output: 198


🏁 Script executed:

find docs -maxdepth 2 -type f -print

Repository: drevops/vortex

Length of output: 244


🏁 Script executed:

git ls-files rector.php .vortex/cli/tests/Fixtures/handler_process/_baseline/rector.php

Repository: drevops/vortex

Length of output: 227


🏁 Script executed:

ls -la .artifacts

Repository: drevops/vortex

Length of output: 210


🌐 Web query:

Drupal Rector 1.1.2 withComposerBased drupal DrupalSetProvider withSetProviders

💡 Result:

In Drupal Rector 1.1.2, you can use the withComposerBased and withSetProviders methods to automate the selection of Drupal upgrade rules based on your installed drupal/core version, eliminating the need to manually manage lists of upgrade sets [1][2][3]. To implement this, update your rector.php configuration file as follows [2]: return RectorConfig::configure ->withSetProviders(\DrupalRector\Set\DrupalSetProvider::class) ->withComposerBased(drupal: true); By using this configuration: 1. withSetProviders(\DrupalRector\Set\DrupalSetProvider::class) registers the Drupal-specific rule sets [2][4]. 2. withComposerBased(drupal: true) instructs Rector to inspect your project's composer.json, identify the installed version of drupal/core, and automatically load the relevant upgrade rules up to and including that minor version [1][2]. This approach is dynamic; as you upgrade your Drupal core version, Rector will automatically adjust the sets it applies without requiring further manual updates to your rector.php [2]. This feature requires Rector 2.5.0 or newer [2][5].

Citations:


🌐 Web query:

site:github.com/palantirnet/drupal-rector "withComposerBased" "DrupalSetProvider"

💡 Result:

The withComposerBased method is a feature of the drupal-rector project, used to automatically select and apply Rector deprecation sets based on the version of drupal/core installed in your project [1][2]. Usage: To use this feature, you must register the DrupalSetProvider and configure the withComposerBased option in your rector.php file [1]: return RectorConfig::configure ->withSetProviders(\DrupalRector\Set\DrupalSetProvider::class) ->withComposerBased(drupal: true); How it works: When configured this way, Rector inspects your project's installed drupal/core version [1]. It then automatically loads the relevant deprecation sets for all Drupal minor versions up to and including your current installed version [1]. For example, if your site is on Drupal 11.2, it will load sets covering 11.0 through 11.2, while excluding future minor versions [1]. Key benefits: - Version Accuracy: It ensures that your code is only updated for deprecations relevant to your specific Drupal installation, preventing the application of premature or unnecessary rules [1][2]. - Automatic Breaking Changes: Because the exact version is known, Rector can safely include "breaking" sets (rules for renames introduced in specific minor versions) that would otherwise be unsafe to apply without version awareness [1]. - Simplified Configuration: It removes the need to manually list or update deprecation sets in your configuration as you upgrade your Drupal core [1]. Important Note: This feature typically requires a compatible version of the rector package that supports the SetGroup::DRUPAL constant and the withComposerBased toggle [1][2]. As it is designed for your specific installed version, it is intended for projects that do not need to maintain simultaneous compatibility with multiple older Drupal versions [2].

Citations:


🏁 Script executed:

curl -L --fail --silent --show-error https://raw.githubusercontent.com/palantirnet/drupal-rector/1.1.2/README.md

Repository: drevops/vortex

Length of output: 14763


🏁 Script executed:

cat docs/README.md

Repository: drevops/vortex

Length of output: 657


🏁 Script executed:

cat -n rector.php

Repository: drevops/vortex

Length of output: 6414


🏁 Script executed:

cat -n .vortex/cli/tests/Fixtures/handler_process/_baseline/rector.php

Repository: drevops/vortex

Length of output: 6366


🏁 Script executed:

rg -n -i 'drupal-rector|rector/rector|withComposerBased|DrupalSetProvider' --glob 'composer*.json' --glob 'rector.php' --glob '*.lock'

Repository: drevops/vortex

Length of output: 152


🏁 Script executed:

git ls-files '*composer*'

Repository: drevops/vortex

Length of output: 5453


🏁 Script executed:

rg -n -i 'rector|drupal-rector' composer.json .vortex/cli/composer.json .vortex/cli/tests/Fixtures/handler_process/_baseline/composer.json

Repository: drevops/vortex

Length of output: 776


Register DrupalSetProvider in both Rector configurations.

withComposerBased(drupal: TRUE) requires DrupalRector\Set\DrupalSetProvider. Add the import and ->withSetProviders(DrupalSetProvider::class) to rector.php and .vortex/cli/tests/Fixtures/handler_process/_baseline/rector.php.

📍 Affects 2 files
  • rector.php#L102-L105 (this comment)
  • .vortex/cli/tests/Fixtures/handler_process/_baseline/rector.php#L100-L103
🤖 Prompt for 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.

In `@rector.php` around lines 102 - 105, Import DrupalRector\Set\DrupalSetProvider
and register DrupalSetProvider::class via withSetProviders in both rector.php
(lines 102-105) and
.vortex/cli/tests/Fixtures/handler_process/_baseline/rector.php (lines 100-103),
alongside the existing withComposerBased(drupal: TRUE) configuration.

Source: MCP tools

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, and thank you - this was a real bug, not a style nit. Verified with vendor/bin/rector list-rules: 0 DrupalRector rules loaded without the provider, 98 with it. withComposerBased(drupal: TRUE) only pushes SetGroup::DRUPAL onto $setGroups; nothing supplies sets for that group unless DrupalSetProvider is registered, so Rector loaded no Drupal rules at all and still exited 0. Lint was green while covering nothing.

This pull request was merged before the fix could land here, so it is in #2979 instead, which adds ->withSetProviders(DrupalSetProvider::class) to both rector.php and the regenerated _baseline/rector.php fixture.

One consequence worth recording: registering the provider loads the Drupal 11.0-11.4 sets for the installed drupal/core 11.4.5, which newly enables PhpUnitAddRunTestsInSeparateProcessesAttributeRector from the 11.4 set. That adds #[RunTestsInSeparateProcesses] to the 8 example Kernel and Functional test classes, so those are updated in #2979 as well.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlexSkrypnyk, thank you for the detailed verification.

The finding is valid. withComposerBased(drupal: TRUE) alone did not load Drupal rule sets. The green Rector exit status was therefore not sufficient validation.

#2979 contains the required provider registration and the related Drupal 11.4 test-class updates. The PhpUnitAddRunTestsInSeparateProcessesAttributeRector effect is also clear.

🐇 ✓


✏️ Learnings added
Learnt from: AlexSkrypnyk
Repo: drevops/vortex PR: 2977
File: rector.php:102-105
Timestamp: 2026-08-13T01:49:05.251Z
Learning: In this Drupal Rector configuration, `RectorConfig::withComposerBased(drupal: TRUE)` only adds `SetGroup::DRUPAL`; it does not supply Drupal sets. `rector.php` and `.vortex/cli/tests/Fixtures/handler_process/_baseline/rector.php` must also register `DrupalRector\Set\DrupalSetProvider::class` with `withSetProviders()` or no `DrupalRector` rules load, even though Rector exits with status 0.

Learnt from: AlexSkrypnyk
Repo: drevops/vortex PR: 2977
File: rector.php:102-105
Timestamp: 2026-08-13T01:49:05.251Z
Learning: With installed `drupal/core` version 11.4.5, registering `DrupalRector\Set\DrupalSetProvider` loads Drupal 11.0 through 11.4 sets. The Drupal 11.4 set enables `PhpUnitAddRunTestsInSeparateProcessesAttributeRector`, which adds `#[RunTestsInSeparateProcesses]` to the project example Kernel and Functional test classes.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

You are interacting with an AI system.

// Additional rules.
->withRules([
DeclareStrictTypesRector::class,
Expand Down