From 48bd778f1c37ce43b8144ea83d8b902604146876 Mon Sep 17 00:00:00 2001 From: Andy Postnikov Date: Mon, 29 Jul 2024 18:03:11 +0200 Subject: [PATCH] Upgrade to Drupal 10.3 and dependencies #461 --- composer.json | 21 ++++++++++---------- rector.php | 53 ++++++++++++++++++++++++++------------------------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/composer.json b/composer.json index 31e62e661..a2362ea22 100644 --- a/composer.json +++ b/composer.json @@ -20,28 +20,27 @@ "cweagans/composer-patches": "^1.7", "drupal/ckeditor": "^1.0", "drupal/color": "^1.0", - "drupal/core-composer-scaffold": "^10.0.9", - "drupal/core-vendor-hardening": "^10.0.9", + "drupal/core-composer-scaffold": "^10.3.1", + "drupal/core-vendor-hardening": "^10.3.1", "drupal/default_content": "^2", - "drupal/imagemagick": "^3.4", + "drupal/imagemagick": "^4.0", "drupal/migrate_generator": "^2.0", "drupal/seven": "^1.0", - "drush/drush": "^12.2", + "drush/drush": "^12.5", "skilldlabs/drupal-cleanup": "^1", "skilldlabs/druxxy": "^1.1" }, "require-dev": { "dmore/behat-chrome-extension": "^1.3", "drupal/config_inspector": "^2.1", - "drupal/devel": "^5.1", - "drupal/drupal-extension": "^5.0@rc", - "drupal/upgrade_status": "^4.0", + "drupal/devel": "^5.2", + "drupal/drupal-extension": "^5.0", + "drupal/upgrade_status": "^4.3", "espend/behat-placeholder-extension": "^1.1", - "genesis/behat-fail-aid": "^2.1", - "palantirnet/drupal-rector": "^0.15.1", + "genesis/behat-fail-aid": "^3.7", + "palantirnet/drupal-rector": "^0.20.3", "phpspec/prophecy-phpunit": "^2", - "phpunit/phpunit": "^9", - "symfony/phpunit-bridge": "^5.3.0" + "phpunit/phpunit": "^9" }, "conflict": { "drupal/drupal": "*" diff --git a/rector.php b/rector.php index 371d94cfd..95988b85e 100644 --- a/rector.php +++ b/rector.php @@ -3,32 +3,33 @@ declare(strict_types=1); use DrupalFinder\DrupalFinder; -use Rector\Core\Configuration\Option; -use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; +use DrupalRector\Set\Drupal8SetList; +use DrupalRector\Set\Drupal9SetList; +use DrupalRector\Set\Drupal10SetList; +use Rector\Config\RectorConfig; -return static function (ContainerConfigurator $containerConfigurator): void { - // @todo find out how to only load the relevant rector rules. - // Should we try and load \Drupal::VERSION and check? - $containerConfigurator->import(__DIR__ . '/vendor/palantirnet/drupal-rector/config/drupal-8/drupal-8-all-deprecations.php'); - $containerConfigurator->import(__DIR__ . '/vendor/palantirnet/drupal-rector/config/drupal-9/drupal-9-all-deprecations.php'); +return static function (RectorConfig $rectorConfig): void { + // Adjust the set lists to be more granular to your Drupal requirements. + // @todo find out how to only load the relevant rector rules. + // Should we try and load \Drupal::VERSION and check? + $rectorConfig->sets([ + Drupal8SetList::DRUPAL_8, + Drupal9SetList::DRUPAL_9, + Drupal10SetList::DRUPAL_10, + ]); - $parameters = $containerConfigurator->parameters(); - - $drupalFinder = new DrupalFinder(); - $drupalFinder->locateRoot(__DIR__); - $drupalRoot = $drupalFinder->getDrupalRoot(); - $parameters->set(Option::AUTOLOAD_PATHS, [ - $drupalRoot . '/core', - $drupalRoot . '/modules', - $drupalRoot . '/profiles', - $drupalRoot . '/themes', - __DIR__ . '/vendor/drush/drush/includes/output.inc', - ]); - $parameters->set(Option::SKIP, ['*/upgrade_status/tests/modules/*']); - $parameters->set(Option::FILE_EXTENSIONS, ['php', 'module', 'theme', 'install', 'profile', 'inc', 'engine']); - $parameters->set(Option::AUTO_IMPORT_NAMES, true); - $parameters->set(Option::IMPORT_SHORT_CLASSES, false); - $parameters->set(Option::IMPORT_DOC_BLOCKS, false); - - $parameters->set('drupal_rector_notices_as_comments', true); + $drupalFinder = new DrupalFinder(); + $drupalFinder->locateRoot(__DIR__); + $drupalRoot = $drupalFinder->getDrupalRoot(); + $rectorConfig->autoloadPaths([ + $drupalRoot . '/core', + $drupalRoot . '/modules', + $drupalRoot . '/profiles', + $drupalRoot . '/themes', + __DIR__ . '/vendor/drush/drush/includes/output.inc', + ]); + $rectorConfig->skip(['*/upgrade_status/tests/modules/*']); + $rectorConfig->fileExtensions(['php', 'module', 'theme', 'install', 'profile', 'inc', 'engine']); + $rectorConfig->importNames(true, false); + $rectorConfig->importShortClasses(false); };