diff --git a/.vortex/installer/tests/Fixtures/handler_process/_baseline/composer.json b/.vortex/installer/tests/Fixtures/handler_process/_baseline/composer.json index 05389a571..af8aa0472 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/_baseline/composer.json +++ b/.vortex/installer/tests/Fixtures/handler_process/_baseline/composer.json @@ -57,7 +57,7 @@ "phpstan/phpstan": "__VERSION__", "phpunit/phpunit": "__VERSION__", "pyrech/composer-changelogs": "__VERSION__", - "rector/rector": "__VERSION__", + "rector/rector": ">=__VERSION__ <__VERSION__", "softcreatr/jsonpath": "^0.10 || ^1.0", "vincentlanglet/twig-cs-fixer": "__VERSION__" }, diff --git a/.vortex/installer/tests/Fixtures/handler_process/_baseline/rector.php b/.vortex/installer/tests/Fixtures/handler_process/_baseline/rector.php index 3f8cae2d4..b8fb83a3f 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/_baseline/rector.php +++ b/.vortex/installer/tests/Fixtures/handler_process/_baseline/rector.php @@ -16,7 +16,6 @@ declare(strict_types=1); -use DrupalFinder\DrupalFinderComposerRuntime; use DrupalRector\Set\DrupalSetProvider; use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector; use Rector\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector; @@ -81,9 +80,9 @@ '*/vendor/*', '*/node_modules/*', ]) - // PHP version upgrade sets - modernizes syntax to PHP 8.4. - // Includes all rules from PHP 5.3 through 8.4. - ->withPhpSets(php84: TRUE) + // PHP version upgrade sets. Called without an argument, the target version + // comes from `composer.json`, so the sets follow the project's PHP version. + ->withPhpSets() // Behat attribute sets - converts annotations to PHP 8 attributes. ->withAttributesSets(behat: TRUE) // Code quality improvement sets. @@ -95,11 +94,10 @@ privatization: TRUE, typeDeclarations: TRUE, ) - // Drupal-specific deprecation fixes. The provider binds each set to a - // `drupal/core` version and only the sets the installed core satisfies are - // loaded, so the set tracks core upgrades without changing this - // configuration. Both calls are required: the provider supplies the sets, - // `withComposerBased()` enables the group. + // Drupal deprecation fixes for the installed `drupal/core` version. Both + // calls are required: the provider supplies the sets, `withComposerBased()` + // enables the group. The sets carry the autoload paths and the file + // extensions Drupal executes PHP from, so this file declares neither. ->withSetProviders(DrupalSetProvider::class) ->withComposerBased(drupal: TRUE) // Additional rules. @@ -107,27 +105,5 @@ DeclareStrictTypesRector::class, YieldDataProviderRector::class, ]) - // Configure Drupal autoloading. - ->withAutoloadPaths((function (): array { - $drupalFinder = new DrupalFinderComposerRuntime(); - $drupalRoot = $drupalFinder->getDrupalRoot(); - - return [ - $drupalRoot . '/core', - $drupalRoot . '/modules', - $drupalRoot . '/themes', - $drupalRoot . '/profiles', - ]; - })()) - // Drupal file extensions. - ->withFileExtensions([ - 'php', - 'module', - 'install', - 'profile', - 'theme', - 'inc', - 'engine', - ]) // Import configuration. ->withImportNames(importNames: FALSE, importDocBlockNames: FALSE); diff --git a/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/rector.php b/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/rector.php index f73607a8b..f75f90052 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/rector.php +++ b/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/rector.php @@ -1,4 +1,4 @@ -@@ -44,10 +44,10 @@ +@@ -43,10 +43,10 @@ return RectorConfig::configure() ->withPaths([ @@ -13,7 +13,7 @@ __DIR__ . '/tests', ]) ->withSkip([ -@@ -65,8 +65,8 @@ +@@ -64,8 +64,8 @@ PrivatizeLocalGetterToPropertyRector::class, RemoveAlwaysTrueIfConditionRector::class, RemoveUnusedPublicMethodParameterRector::class => [ @@ -24,7 +24,7 @@ ], RenameForeachValueVariableToMatchExprVariableRector::class, RenameForeachValueVariableToMatchMethodCallReturnTypeRector::class, -@@ -75,7 +75,7 @@ +@@ -74,7 +74,7 @@ RenameVariableToMatchNewTypeRector::class, SimplifyEmptyCheckOnEmptyArrayRector::class, StringClassNameToClassConstantRector::class => [ diff --git a/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/rector.php b/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/rector.php index f73607a8b..f75f90052 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/rector.php +++ b/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/rector.php @@ -1,4 +1,4 @@ -@@ -44,10 +44,10 @@ +@@ -43,10 +43,10 @@ return RectorConfig::configure() ->withPaths([ @@ -13,7 +13,7 @@ __DIR__ . '/tests', ]) ->withSkip([ -@@ -65,8 +65,8 @@ +@@ -64,8 +64,8 @@ PrivatizeLocalGetterToPropertyRector::class, RemoveAlwaysTrueIfConditionRector::class, RemoveUnusedPublicMethodParameterRector::class => [ @@ -24,7 +24,7 @@ ], RenameForeachValueVariableToMatchExprVariableRector::class, RenameForeachValueVariableToMatchMethodCallReturnTypeRector::class, -@@ -75,7 +75,7 @@ +@@ -74,7 +74,7 @@ RenameVariableToMatchNewTypeRector::class, SimplifyEmptyCheckOnEmptyArrayRector::class, StringClassNameToClassConstantRector::class => [ diff --git a/.vortex/installer/tests/Fixtures/handler_process/theme_claro/rector.php b/.vortex/installer/tests/Fixtures/handler_process/theme_claro/rector.php index 9b6af1d93..c7a7ea853 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/theme_claro/rector.php +++ b/.vortex/installer/tests/Fixtures/handler_process/theme_claro/rector.php @@ -1,4 +1,4 @@ -@@ -45,7 +45,6 @@ +@@ -44,7 +44,6 @@ return RectorConfig::configure() ->withPaths([ __DIR__ . '/web/modules/custom', @@ -6,7 +6,7 @@ __DIR__ . '/web/sites/default/settings.php', __DIR__ . '/web/sites/default/includes', __DIR__ . '/tests', -@@ -66,7 +65,6 @@ +@@ -65,7 +64,6 @@ RemoveAlwaysTrueIfConditionRector::class, RemoveUnusedPublicMethodParameterRector::class => [ __DIR__ . '/web/modules/custom/*/src/Hook/*', diff --git a/.vortex/installer/tests/Fixtures/handler_process/theme_olivero/rector.php b/.vortex/installer/tests/Fixtures/handler_process/theme_olivero/rector.php index 9b6af1d93..c7a7ea853 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/theme_olivero/rector.php +++ b/.vortex/installer/tests/Fixtures/handler_process/theme_olivero/rector.php @@ -1,4 +1,4 @@ -@@ -45,7 +45,6 @@ +@@ -44,7 +44,6 @@ return RectorConfig::configure() ->withPaths([ __DIR__ . '/web/modules/custom', @@ -6,7 +6,7 @@ __DIR__ . '/web/sites/default/settings.php', __DIR__ . '/web/sites/default/includes', __DIR__ . '/tests', -@@ -66,7 +65,6 @@ +@@ -65,7 +64,6 @@ RemoveAlwaysTrueIfConditionRector::class, RemoveUnusedPublicMethodParameterRector::class => [ __DIR__ . '/web/modules/custom/*/src/Hook/*', diff --git a/.vortex/installer/tests/Fixtures/handler_process/theme_stark/rector.php b/.vortex/installer/tests/Fixtures/handler_process/theme_stark/rector.php index 9b6af1d93..c7a7ea853 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/theme_stark/rector.php +++ b/.vortex/installer/tests/Fixtures/handler_process/theme_stark/rector.php @@ -1,4 +1,4 @@ -@@ -45,7 +45,6 @@ +@@ -44,7 +44,6 @@ return RectorConfig::configure() ->withPaths([ __DIR__ . '/web/modules/custom', @@ -6,7 +6,7 @@ __DIR__ . '/web/sites/default/settings.php', __DIR__ . '/web/sites/default/includes', __DIR__ . '/tests', -@@ -66,7 +65,6 @@ +@@ -65,7 +64,6 @@ RemoveAlwaysTrueIfConditionRector::class, RemoveUnusedPublicMethodParameterRector::class => [ __DIR__ . '/web/modules/custom/*/src/Hook/*', diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_lint/composer.json b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_lint/composer.json index 116057d41..3bde0b219 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_lint/composer.json +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_lint/composer.json @@ -21,7 +21,7 @@ - "phpstan/phpstan": "__VERSION__", "phpunit/phpunit": "__VERSION__", "pyrech/composer-changelogs": "__VERSION__", -- "rector/rector": "__VERSION__", +- "rector/rector": ">=__VERSION__ <__VERSION__", "softcreatr/jsonpath": "^0.10 || ^1.0", "vincentlanglet/twig-cs-fixer": "__VERSION__" }, diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_lint_circleci/composer.json b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_lint_circleci/composer.json index 116057d41..3bde0b219 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_lint_circleci/composer.json +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_lint_circleci/composer.json @@ -21,7 +21,7 @@ - "phpstan/phpstan": "__VERSION__", "phpunit/phpunit": "__VERSION__", "pyrech/composer-changelogs": "__VERSION__", -- "rector/rector": "__VERSION__", +- "rector/rector": ">=__VERSION__ <__VERSION__", "softcreatr/jsonpath": "^0.10 || ^1.0", "vincentlanglet/twig-cs-fixer": "__VERSION__" }, diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests/composer.json b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests/composer.json index 0daa19e38..b769f649c 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests/composer.json +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests/composer.json @@ -23,7 +23,7 @@ "phpstan/phpstan": "__VERSION__", - "phpunit/phpunit": "__VERSION__", "pyrech/composer-changelogs": "__VERSION__", - "rector/rector": "__VERSION__", + "rector/rector": ">=__VERSION__ <__VERSION__", "softcreatr/jsonpath": "^0.10 || ^1.0", @@ -72,11 +64,6 @@ ], diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests/rector.php b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests/rector.php index 696b79cd5..c8109937d 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests/rector.php +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests/rector.php @@ -1,4 +1,4 @@ -@@ -36,7 +36,6 @@ +@@ -35,7 +35,6 @@ use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector; use Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector; use Rector\Php81\Rector\Array_\ArrayToFirstClassCallableRector; @@ -6,20 +6,20 @@ use Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector; use Rector\Privatization\Rector\MethodCall\PrivatizeLocalGetterToPropertyRector; use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector; -@@ -84,8 +83,6 @@ - // PHP version upgrade sets - modernizes syntax to PHP 8.4. - // Includes all rules from PHP 5.3 through 8.4. - ->withPhpSets(php84: TRUE) +@@ -83,8 +82,6 @@ + // PHP version upgrade sets. Called without an argument, the target version + // comes from `composer.json`, so the sets follow the project's PHP version. + ->withPhpSets() - // Behat attribute sets - converts annotations to PHP 8 attributes. - ->withAttributesSets(behat: TRUE) // Code quality improvement sets. ->withPreparedSets( codeQuality: TRUE, -@@ -105,7 +102,6 @@ +@@ -103,7 +100,6 @@ // Additional rules. ->withRules([ DeclareStrictTypesRector::class, - YieldDataProviderRector::class, ]) - // Configure Drupal autoloading. - ->withAutoloadPaths((function (): array { + // Import configuration. + ->withImportNames(importNames: FALSE, importDocBlockNames: FALSE); diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests_circleci/composer.json b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests_circleci/composer.json index 0daa19e38..b769f649c 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests_circleci/composer.json +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests_circleci/composer.json @@ -23,7 +23,7 @@ "phpstan/phpstan": "__VERSION__", - "phpunit/phpunit": "__VERSION__", "pyrech/composer-changelogs": "__VERSION__", - "rector/rector": "__VERSION__", + "rector/rector": ">=__VERSION__ <__VERSION__", "softcreatr/jsonpath": "^0.10 || ^1.0", @@ -72,11 +64,6 @@ ], diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests_circleci/rector.php b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests_circleci/rector.php index 696b79cd5..c8109937d 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests_circleci/rector.php +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests_circleci/rector.php @@ -1,4 +1,4 @@ -@@ -36,7 +36,6 @@ +@@ -35,7 +35,6 @@ use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector; use Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector; use Rector\Php81\Rector\Array_\ArrayToFirstClassCallableRector; @@ -6,20 +6,20 @@ use Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector; use Rector\Privatization\Rector\MethodCall\PrivatizeLocalGetterToPropertyRector; use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector; -@@ -84,8 +83,6 @@ - // PHP version upgrade sets - modernizes syntax to PHP 8.4. - // Includes all rules from PHP 5.3 through 8.4. - ->withPhpSets(php84: TRUE) +@@ -83,8 +82,6 @@ + // PHP version upgrade sets. Called without an argument, the target version + // comes from `composer.json`, so the sets follow the project's PHP version. + ->withPhpSets() - // Behat attribute sets - converts annotations to PHP 8 attributes. - ->withAttributesSets(behat: TRUE) // Code quality improvement sets. ->withPreparedSets( codeQuality: TRUE, -@@ -105,7 +102,6 @@ +@@ -103,7 +100,6 @@ // Additional rules. ->withRules([ DeclareStrictTypesRector::class, - YieldDataProviderRector::class, ]) - // Configure Drupal autoloading. - ->withAutoloadPaths((function (): array { + // Import configuration. + ->withImportNames(importNames: FALSE, importDocBlockNames: FALSE); diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme/rector.php b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme/rector.php index 9b6af1d93..c7a7ea853 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme/rector.php +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme/rector.php @@ -1,4 +1,4 @@ -@@ -45,7 +45,6 @@ +@@ -44,7 +44,6 @@ return RectorConfig::configure() ->withPaths([ __DIR__ . '/web/modules/custom', @@ -6,7 +6,7 @@ __DIR__ . '/web/sites/default/settings.php', __DIR__ . '/web/sites/default/includes', __DIR__ . '/tests', -@@ -66,7 +65,6 @@ +@@ -65,7 +64,6 @@ RemoveAlwaysTrueIfConditionRector::class, RemoveUnusedPublicMethodParameterRector::class => [ __DIR__ . '/web/modules/custom/*/src/Hook/*', diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme_circleci/rector.php b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme_circleci/rector.php index 9b6af1d93..c7a7ea853 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme_circleci/rector.php +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme_circleci/rector.php @@ -1,4 +1,4 @@ -@@ -45,7 +45,6 @@ +@@ -44,7 +44,6 @@ return RectorConfig::configure() ->withPaths([ __DIR__ . '/web/modules/custom', @@ -6,7 +6,7 @@ __DIR__ . '/web/sites/default/settings.php', __DIR__ . '/web/sites/default/includes', __DIR__ . '/tests', -@@ -66,7 +65,6 @@ +@@ -65,7 +64,6 @@ RemoveAlwaysTrueIfConditionRector::class, RemoveUnusedPublicMethodParameterRector::class => [ __DIR__ . '/web/modules/custom/*/src/Hook/*', diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_behat/rector.php b/.vortex/installer/tests/Fixtures/handler_process/tools_no_behat/rector.php index 16c9a86b0..b032c984e 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_behat/rector.php +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_behat/rector.php @@ -1,7 +1,7 @@ -@@ -84,8 +84,6 @@ - // PHP version upgrade sets - modernizes syntax to PHP 8.4. - // Includes all rules from PHP 5.3 through 8.4. - ->withPhpSets(php84: TRUE) +@@ -83,8 +83,6 @@ + // PHP version upgrade sets. Called without an argument, the target version + // comes from `composer.json`, so the sets follow the project's PHP version. + ->withPhpSets() - // Behat attribute sets - converts annotations to PHP 8 attributes. - ->withAttributesSets(behat: TRUE) // Code quality improvement sets. diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_behat_circleci/rector.php b/.vortex/installer/tests/Fixtures/handler_process/tools_no_behat_circleci/rector.php index 16c9a86b0..b032c984e 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_behat_circleci/rector.php +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_behat_circleci/rector.php @@ -1,7 +1,7 @@ -@@ -84,8 +84,6 @@ - // PHP version upgrade sets - modernizes syntax to PHP 8.4. - // Includes all rules from PHP 5.3 through 8.4. - ->withPhpSets(php84: TRUE) +@@ -83,8 +83,6 @@ + // PHP version upgrade sets. Called without an argument, the target version + // comes from `composer.json`, so the sets follow the project's PHP version. + ->withPhpSets() - // Behat attribute sets - converts annotations to PHP 8 attributes. - ->withAttributesSets(behat: TRUE) // Code quality improvement sets. diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_eslint_no_theme/rector.php b/.vortex/installer/tests/Fixtures/handler_process/tools_no_eslint_no_theme/rector.php index 9b6af1d93..c7a7ea853 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_eslint_no_theme/rector.php +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_eslint_no_theme/rector.php @@ -1,4 +1,4 @@ -@@ -45,7 +45,6 @@ +@@ -44,7 +44,6 @@ return RectorConfig::configure() ->withPaths([ __DIR__ . '/web/modules/custom', @@ -6,7 +6,7 @@ __DIR__ . '/web/sites/default/settings.php', __DIR__ . '/web/sites/default/includes', __DIR__ . '/tests', -@@ -66,7 +65,6 @@ +@@ -65,7 +64,6 @@ RemoveAlwaysTrueIfConditionRector::class, RemoveUnusedPublicMethodParameterRector::class => [ __DIR__ . '/web/modules/custom/*/src/Hook/*', diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpstan/composer.json b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpstan/composer.json index cd31a9e10..17bfb5b10 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpstan/composer.json +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpstan/composer.json @@ -11,7 +11,7 @@ - "phpstan/phpstan": "__VERSION__", "phpunit/phpunit": "__VERSION__", "pyrech/composer-changelogs": "__VERSION__", - "rector/rector": "__VERSION__", + "rector/rector": ">=__VERSION__ <__VERSION__", @@ -85,7 +82,6 @@ "drupal/core-composer-scaffold": true, "ergebnis/composer-normalize": true, diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpstan_circleci/composer.json b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpstan_circleci/composer.json index cd31a9e10..17bfb5b10 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpstan_circleci/composer.json +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpstan_circleci/composer.json @@ -11,7 +11,7 @@ - "phpstan/phpstan": "__VERSION__", "phpunit/phpunit": "__VERSION__", "pyrech/composer-changelogs": "__VERSION__", - "rector/rector": "__VERSION__", + "rector/rector": ">=__VERSION__ <__VERSION__", @@ -85,7 +82,6 @@ "drupal/core-composer-scaffold": true, "ergebnis/composer-normalize": true, diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit/composer.json b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit/composer.json index 8f0d5a8f3..31709efbe 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit/composer.json +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit/composer.json @@ -7,7 +7,7 @@ "phpstan/phpstan": "__VERSION__", - "phpunit/phpunit": "__VERSION__", "pyrech/composer-changelogs": "__VERSION__", - "rector/rector": "__VERSION__", + "rector/rector": ">=__VERSION__ <__VERSION__", "softcreatr/jsonpath": "^0.10 || ^1.0", @@ -72,11 +70,6 @@ ], diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit/rector.php b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit/rector.php index 6f6084748..09dd85457 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit/rector.php +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit/rector.php @@ -1,4 +1,4 @@ -@@ -36,7 +36,6 @@ +@@ -35,7 +35,6 @@ use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector; use Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector; use Rector\Php81\Rector\Array_\ArrayToFirstClassCallableRector; @@ -6,11 +6,11 @@ use Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector; use Rector\Privatization\Rector\MethodCall\PrivatizeLocalGetterToPropertyRector; use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector; -@@ -105,7 +104,6 @@ +@@ -103,7 +102,6 @@ // Additional rules. ->withRules([ DeclareStrictTypesRector::class, - YieldDataProviderRector::class, ]) - // Configure Drupal autoloading. - ->withAutoloadPaths((function (): array { + // Import configuration. + ->withImportNames(importNames: FALSE, importDocBlockNames: FALSE); diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit_circleci/composer.json b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit_circleci/composer.json index 8f0d5a8f3..31709efbe 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit_circleci/composer.json +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit_circleci/composer.json @@ -7,7 +7,7 @@ "phpstan/phpstan": "__VERSION__", - "phpunit/phpunit": "__VERSION__", "pyrech/composer-changelogs": "__VERSION__", - "rector/rector": "__VERSION__", + "rector/rector": ">=__VERSION__ <__VERSION__", "softcreatr/jsonpath": "^0.10 || ^1.0", @@ -72,11 +70,6 @@ ], diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit_circleci/rector.php b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit_circleci/rector.php index 6f6084748..09dd85457 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit_circleci/rector.php +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit_circleci/rector.php @@ -1,4 +1,4 @@ -@@ -36,7 +36,6 @@ +@@ -35,7 +35,6 @@ use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector; use Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector; use Rector\Php81\Rector\Array_\ArrayToFirstClassCallableRector; @@ -6,11 +6,11 @@ use Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector; use Rector\Privatization\Rector\MethodCall\PrivatizeLocalGetterToPropertyRector; use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector; -@@ -105,7 +104,6 @@ +@@ -103,7 +102,6 @@ // Additional rules. ->withRules([ DeclareStrictTypesRector::class, - YieldDataProviderRector::class, ]) - // Configure Drupal autoloading. - ->withAutoloadPaths((function (): array { + // Import configuration. + ->withImportNames(importNames: FALSE, importDocBlockNames: FALSE); diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_rector/composer.json b/.vortex/installer/tests/Fixtures/handler_process/tools_no_rector/composer.json index 095c85d4a..97ac61cdc 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_rector/composer.json +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_rector/composer.json @@ -10,7 +10,7 @@ "phpstan/phpstan": "__VERSION__", "phpunit/phpunit": "__VERSION__", "pyrech/composer-changelogs": "__VERSION__", -- "rector/rector": "__VERSION__", +- "rector/rector": ">=__VERSION__ <__VERSION__", "softcreatr/jsonpath": "^0.10 || ^1.0", "vincentlanglet/twig-cs-fixer": "__VERSION__" }, diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_rector_circleci/composer.json b/.vortex/installer/tests/Fixtures/handler_process/tools_no_rector_circleci/composer.json index 095c85d4a..97ac61cdc 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_rector_circleci/composer.json +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_rector_circleci/composer.json @@ -10,7 +10,7 @@ "phpstan/phpstan": "__VERSION__", "phpunit/phpunit": "__VERSION__", "pyrech/composer-changelogs": "__VERSION__", -- "rector/rector": "__VERSION__", +- "rector/rector": ">=__VERSION__ <__VERSION__", "softcreatr/jsonpath": "^0.10 || ^1.0", "vincentlanglet/twig-cs-fixer": "__VERSION__" }, diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_stylelint_no_theme/rector.php b/.vortex/installer/tests/Fixtures/handler_process/tools_no_stylelint_no_theme/rector.php index 9b6af1d93..c7a7ea853 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_stylelint_no_theme/rector.php +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_stylelint_no_theme/rector.php @@ -1,4 +1,4 @@ -@@ -45,7 +45,6 @@ +@@ -44,7 +44,6 @@ return RectorConfig::configure() ->withPaths([ __DIR__ . '/web/modules/custom', @@ -6,7 +6,7 @@ __DIR__ . '/web/sites/default/settings.php', __DIR__ . '/web/sites/default/includes', __DIR__ . '/tests', -@@ -66,7 +65,6 @@ +@@ -65,7 +64,6 @@ RemoveAlwaysTrueIfConditionRector::class, RemoveUnusedPublicMethodParameterRector::class => [ __DIR__ . '/web/modules/custom/*/src/Hook/*', diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_twig/composer.json b/.vortex/installer/tests/Fixtures/handler_process/tools_no_twig/composer.json index 2541c6937..762618e52 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_twig/composer.json +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_twig/composer.json @@ -1,7 +1,7 @@ @@ -58,8 +58,7 @@ "phpunit/phpunit": "__VERSION__", "pyrech/composer-changelogs": "__VERSION__", - "rector/rector": "__VERSION__", + "rector/rector": ">=__VERSION__ <__VERSION__", - "softcreatr/jsonpath": "^0.10 || ^1.0", - "vincentlanglet/twig-cs-fixer": "__VERSION__" + "softcreatr/jsonpath": "^0.10 || ^1.0" diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/composer.json b/.vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/composer.json index 2541c6937..762618e52 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/composer.json +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/composer.json @@ -1,7 +1,7 @@ @@ -58,8 +58,7 @@ "phpunit/phpunit": "__VERSION__", "pyrech/composer-changelogs": "__VERSION__", - "rector/rector": "__VERSION__", + "rector/rector": ">=__VERSION__ <__VERSION__", - "softcreatr/jsonpath": "^0.10 || ^1.0", - "vincentlanglet/twig-cs-fixer": "__VERSION__" + "softcreatr/jsonpath": "^0.10 || ^1.0" diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_none/composer.json b/.vortex/installer/tests/Fixtures/handler_process/tools_none/composer.json index 5128b7d12..98fc28279 100644 --- a/.vortex/installer/tests/Fixtures/handler_process/tools_none/composer.json +++ b/.vortex/installer/tests/Fixtures/handler_process/tools_none/composer.json @@ -23,7 +23,7 @@ - "phpstan/phpstan": "__VERSION__", - "phpunit/phpunit": "__VERSION__", "pyrech/composer-changelogs": "__VERSION__", -- "rector/rector": "__VERSION__", +- "rector/rector": ">=__VERSION__ <__VERSION__", - "softcreatr/jsonpath": "^0.10 || ^1.0", - "vincentlanglet/twig-cs-fixer": "__VERSION__" + "softcreatr/jsonpath": "^0.10 || ^1.0" diff --git a/.vortex/tests/phpunit/Functional/AhoyWorkflowTest.php b/.vortex/tests/phpunit/Functional/AhoyWorkflowTest.php index e6d4314e2..827f41749 100644 --- a/.vortex/tests/phpunit/Functional/AhoyWorkflowTest.php +++ b/.vortex/tests/phpunit/Functional/AhoyWorkflowTest.php @@ -62,6 +62,8 @@ public function testAhoyWorkflowStateless(): void { $this->subtestAhoyLintBe(); + $this->subtestAhoyLintBeRector(); + $this->subtestAhoyLintFe(); $this->subtestAhoyLintSdc(); diff --git a/.vortex/tests/phpunit/Traits/Subtests/SubtestAhoyTrait.php b/.vortex/tests/phpunit/Traits/Subtests/SubtestAhoyTrait.php index 7cf7b03b2..f16d1ed93 100644 --- a/.vortex/tests/phpunit/Traits/Subtests/SubtestAhoyTrait.php +++ b/.vortex/tests/phpunit/Traits/Subtests/SubtestAhoyTrait.php @@ -458,6 +458,48 @@ protected function subtestAhoyLintBe(string $webroot = 'web'): void { $this->logStepFinish(); } + protected function subtestAhoyLintBeRector(string $webroot = 'web'): void { + $this->logStepStart(); + + // Rector reports success when its rule sets load nothing, so a passing + // `ahoy lint-be` is not evidence that the Drupal rules ran. Seed a + // deprecation that only those rules rewrite: the run has to fail, and the + // failure has to name the rule that caught it, because an unrelated rule + // firing on this file would otherwise mask a set that stopped loading. + $this->logSubstep('Assert that the Drupal Rector rule sets are loaded'); + $test_file = $webroot . '/modules/custom/sw_base/src/RectorCanary.php'; + $canary = <<<'PHP' + syncToContainer($test_file); + + $this->cmdFail('ahoy cli vendor/bin/rector --dry-run --clear-cache', ['* FunctionToStaticRector'], tio: 300, ito: 180, txt: '`rector` fails and names the rule that rewrote a deprecated Drupal call'); + + $this->removePathHostAndContainer($test_file); + + $this->logStepFinish(); + } + protected function subtestAhoyLintFe(string $webroot = 'web'): void { $this->logStepStart(); diff --git a/composer.json b/composer.json index 2d41023e8..f8366127b 100644 --- a/composer.json +++ b/composer.json @@ -59,7 +59,7 @@ "phpstan/phpstan": "^2.2.10", "phpunit/phpunit": "^11.5.56", "pyrech/composer-changelogs": "^2.2", - "rector/rector": "^2.6.4", + "rector/rector": ">=2.6.4 <2.6.5", "softcreatr/jsonpath": "^0.10 || ^1.0", "vincentlanglet/twig-cs-fixer": "^4.1.0" }, diff --git a/rector.php b/rector.php index e7b267b5d..cd506a9b8 100644 --- a/rector.php +++ b/rector.php @@ -16,7 +16,6 @@ declare(strict_types=1); -use DrupalFinder\DrupalFinderComposerRuntime; use DrupalRector\Set\DrupalSetProvider; use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector; use Rector\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector; @@ -81,9 +80,9 @@ '*/vendor/*', '*/node_modules/*', ]) - // PHP version upgrade sets - modernizes syntax to PHP 8.4. - // Includes all rules from PHP 5.3 through 8.4. - ->withPhpSets(php84: TRUE) + // PHP version upgrade sets. Called without an argument, the target version + // comes from `composer.json`, so the sets follow the project's PHP version. + ->withPhpSets() #;< TOOL_BEHAT // Behat attribute sets - converts annotations to PHP 8 attributes. ->withAttributesSets(behat: TRUE) @@ -97,11 +96,10 @@ privatization: TRUE, typeDeclarations: TRUE, ) - // Drupal-specific deprecation fixes. The provider binds each set to a - // `drupal/core` version and only the sets the installed core satisfies are - // loaded, so the set tracks core upgrades without changing this - // configuration. Both calls are required: the provider supplies the sets, - // `withComposerBased()` enables the group. + // Drupal deprecation fixes for the installed `drupal/core` version. Both + // calls are required: the provider supplies the sets, `withComposerBased()` + // enables the group. The sets carry the autoload paths and the file + // extensions Drupal executes PHP from, so this file declares neither. ->withSetProviders(DrupalSetProvider::class) ->withComposerBased(drupal: TRUE) // Additional rules. @@ -109,27 +107,5 @@ DeclareStrictTypesRector::class, YieldDataProviderRector::class, ]) - // Configure Drupal autoloading. - ->withAutoloadPaths((function (): array { - $drupalFinder = new DrupalFinderComposerRuntime(); - $drupalRoot = $drupalFinder->getDrupalRoot(); - - return [ - $drupalRoot . '/core', - $drupalRoot . '/modules', - $drupalRoot . '/themes', - $drupalRoot . '/profiles', - ]; - })()) - // Drupal file extensions. - ->withFileExtensions([ - 'php', - 'module', - 'install', - 'profile', - 'theme', - 'inc', - 'engine', - ]) // Import configuration. ->withImportNames(importNames: FALSE, importDocBlockNames: FALSE);