Skip to content

Commit

Permalink
Merge pull request #1 from palantirnet/main
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
timohuisman authored May 27, 2024
2 parents 4a2e739 + 61ba140 commit c4cfa62
Show file tree
Hide file tree
Showing 61 changed files with 1,886 additions and 118 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.2
coverage: none # disable xdebug, pcov
tools: composer:v2
extensions: zip
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/functional_test__rector_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
- php-version: "8.1"
drupal: "^10.0"
fixture: "d10"
- php-version: "8.2"
drupal: "^10.0"
fixture: "d10"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.2
coverage: none # disable xdebug, pcov
tools: composer:v2
extensions: dom, curl, libxml, mbstring, zip, pdo, mysql, pdo_mysql, bcmath, gd, exif, iconv
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.2"
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
Expand Down
16 changes: 12 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"ast"
],
"require": {
"rector/rector": "~0.19.0",
"rector/rector": "^1.0",
"webflo/drupal-finder": "^1.2"
},
"license": "MIT",
Expand All @@ -30,6 +30,14 @@
{
"name": "Matt Glaman",
"email": "[email protected]"
},
{
"name": "Björn Brala",
"email": "[email protected]"
},
{
"name": "Ken Rickard",
"email": "[email protected]"
}
],
"autoload": {
Expand Down Expand Up @@ -66,15 +74,15 @@
"enable-patching": true
},
"require-dev": {
"php": "^8.1",
"php": "^8.2",
"cweagans/composer-patches": "^1.7.2",
"friendsofphp/php-cs-fixer": "^3.38",
"friendsofphp/php-cs-fixer": "^3.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.0",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpunit/phpunit": "^10.0",
"symfony/yaml": "^5 || ^6",
"symplify/rule-doc-generator": "^12.0",
"symplify/rule-doc-generator": "dev-main",
"symplify/vendor-patches": "^11.0"
},
"scripts": {
Expand Down
19 changes: 13 additions & 6 deletions config/drupal-10/drupal-10.0-deprecations.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@

use DrupalRector\Rector\PHPUnit\ShouldCallParentMethodsRector;
use Rector\Config\RectorConfig;
use Rector\PHPUnit\Set\PHPUnitLevelSetList;
use Rector\Symfony\Set\SymfonyLevelSetList;
use Rector\Symfony\Set\TwigLevelSetList;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Symfony\Set\SymfonySetList;
use Rector\Symfony\Set\TwigSetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([
PHPUnitLevelSetList::UP_TO_PHPUNIT_90,
SymfonyLevelSetList::UP_TO_SYMFONY_62,
TwigLevelSetList::UP_TO_TWIG_240,
PHPUnitSetList::PHPUNIT_90,
SymfonySetList::SYMFONY_50,
SymfonySetList::SYMFONY_51,
SymfonySetList::SYMFONY_52,
SymfonySetList::SYMFONY_53,
SymfonySetList::SYMFONY_54,
SymfonySetList::SYMFONY_60,
SymfonySetList::SYMFONY_61,
SymfonySetList::SYMFONY_62,
TwigSetList::TWIG_240,
]);

$rectorConfig->rule(ShouldCallParentMethodsRector::class);
Expand Down
4 changes: 2 additions & 2 deletions config/drupal-10/drupal-10.1-deprecations.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
use DrupalRector\Rector\ValueObject\DrupalIntroducedVersionConfiguration;
use DrupalRector\Rector\ValueObject\FunctionToStaticConfiguration;
use Rector\Config\RectorConfig;
use Rector\Symfony\Set\SymfonyLevelSetList;
use Rector\Symfony\Set\SymfonySetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([
SymfonyLevelSetList::UP_TO_SYMFONY_63,
SymfonySetList::SYMFONY_63,
]);

// https://www.drupal.org/node/3244583
Expand Down
22 changes: 21 additions & 1 deletion config/drupal-10/drupal-10.2-deprecations.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,33 @@

declare(strict_types=1);

use DrupalRector\Drupal10\Rector\Deprecation\VersionedFunctionToServiceRector;
use DrupalRector\Drupal10\Rector\ValueObject\VersionedFunctionToServiceConfiguration;
use DrupalRector\Rector\Deprecation\FunctionToStaticRector;
use DrupalRector\Rector\Deprecation\MethodToMethodWithCheckRector;
use DrupalRector\Rector\ValueObject\FunctionToStaticConfiguration;
use DrupalRector\Rector\ValueObject\MethodToMethodWithCheckConfiguration;
use Rector\Config\RectorConfig;
use Rector\Symfony\Set\SymfonySetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([
SymfonySetList::SYMFONY_64,
]);

// https://www.drupal.org/node/2999981
$rectorConfig->ruleWithConfiguration(FunctionToStaticRector::class, [
new FunctionToStaticConfiguration('10.2.0', 'format_size', '\Drupal\Core\StringTranslation\ByteSizeMarkup', 'create'),
new FunctionToStaticConfiguration('10.2.0', 'format_size', 'Drupal\Core\StringTranslation\ByteSizeMarkup', 'create'),
]);

// https://www.drupal.org/node/3265963
$rectorConfig->ruleWithConfiguration(MethodToMethodWithCheckRector::class, [
new MethodToMethodWithCheckConfiguration('Drupal\system\Plugin\ImageToolkit\GDToolkit', 'getResource', 'getImage'),
new MethodToMethodWithCheckConfiguration('Drupal\system\Plugin\ImageToolkit\GDToolkit', 'setResource', 'setImage'),
]);

// https://www.drupal.org/node/3358337
$rectorConfig->ruleWithConfiguration(VersionedFunctionToServiceRector::class, [
new VersionedFunctionToServiceConfiguration('10.2.0', '_drupal_flush_css_js', 'asset.query_string', 'reset'),
]);
};
8 changes: 4 additions & 4 deletions config/drupal-8/drupal-8.0-deprecations.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@

$rectorConfig->ruleWithConfiguration(FunctionToServiceRector::class, [
// https://www.drupal.org/node/2418133
new FunctionToServiceConfiguration('drupal_realpath', 'file_system', 'realpath'),
new FunctionToServiceConfiguration('8.0.0', 'drupal_realpath', 'file_system', 'realpath'),
// https://www.drupal.org/node/2912696
new FunctionToServiceConfiguration('drupal_render', 'renderer', 'render'),
new FunctionToServiceConfiguration('8.0.0', 'drupal_render', 'renderer', 'render'),
// https://www.drupal.org/node/2912696
new FunctionToServiceConfiguration('drupal_render_root', 'renderer', 'renderRoot'),
new FunctionToServiceConfiguration('8.0.0', 'drupal_render_root', 'renderer', 'renderRoot'),
// https://www.drupal.org/node/1876852
new FunctionToServiceConfiguration('format_date', 'date.formatter', 'format'),
new FunctionToServiceConfiguration('8.0.0', 'format_date', 'date.formatter', 'format'),
]);

$rectorConfig->rule(EntityInterfaceLinkRector::class);
Expand Down
4 changes: 2 additions & 2 deletions config/drupal-8/drupal-8.5-deprecations.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

use DrupalRector\Drupal8\Rector\Deprecation\ConstantToClassConstantRector;
use DrupalRector\Drupal8\Rector\Deprecation\DrupalSetMessageRector;
use DrupalRector\Drupal8\Rector\ValueObject\ConstantToClassConfiguration;
use DrupalRector\Rector\Deprecation\ConstantToClassConstantRector;
use DrupalRector\Rector\ValueObject\ConstantToClassConfiguration;
use DrupalRector\Services\AddCommentService;
use Rector\Config\RectorConfig;

Expand Down
8 changes: 4 additions & 4 deletions config/drupal-8/drupal-8.7-deprecations.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

use DrupalRector\Drupal8\Rector\Deprecation\ConstantToClassConstantRector;
use DrupalRector\Drupal8\Rector\ValueObject\ConstantToClassConfiguration;
use DrupalRector\Rector\Deprecation\ConstantToClassConstantRector;
use DrupalRector\Rector\Deprecation\FunctionToServiceRector;
use DrupalRector\Rector\ValueObject\ConstantToClassConfiguration;
use DrupalRector\Rector\ValueObject\FunctionToServiceConfiguration;
use DrupalRector\Services\AddCommentService;
use Rector\Config\RectorConfig;
Expand All @@ -15,9 +15,9 @@
});
$rectorConfig->ruleWithConfiguration(FunctionToServiceRector::class, [
// https://www.drupal.org/node/3006851
new FunctionToServiceConfiguration('file_prepare_directory', 'file_system', 'prepareDirectory'),
new FunctionToServiceConfiguration('8.7.0', 'file_prepare_directory', 'file_system', 'prepareDirectory'),
// https://www.drupal.org/node/3006851
new FunctionToServiceConfiguration('file_unmanaged_save_data', 'file_system', 'saveData'),
new FunctionToServiceConfiguration('8.7.0', 'file_unmanaged_save_data', 'file_system', 'saveData'),
]);

/**
Expand Down
10 changes: 5 additions & 5 deletions config/drupal-8/drupal-8.8-deprecations.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@
$rectorConfig->ruleWithConfiguration(FunctionToServiceRector::class,
[
// https://www.drupal.org/node/2835616
new FunctionToServiceConfiguration('entity_get_display', 'entity_display.repository', 'getViewDisplay'),
new FunctionToServiceConfiguration('8.8.0', 'entity_get_display', 'entity_display.repository', 'getViewDisplay'),
// https://www.drupal.org/node/2835616
new FunctionToServiceConfiguration('entity_get_form_display', 'entity_display.repository', 'getFormDisplay'),
new FunctionToServiceConfiguration('8.8.0', 'entity_get_form_display', 'entity_display.repository', 'getFormDisplay'),
// https://www.drupal.org/node/3039255
new FunctionToServiceConfiguration('file_directory_temp', 'file_system', 'getTempDirectory'),
new FunctionToServiceConfiguration('8.8.0', 'file_directory_temp', 'file_system', 'getTempDirectory'),
// https://www.drupal.org/node/3038437
new FunctionToServiceConfiguration('file_scan_directory', 'file_system', 'scanDirectory'),
new FunctionToServiceConfiguration('8.8.0', 'file_scan_directory', 'file_system', 'scanDirectory'),
// https://www.drupal.org/node/3035273
new FunctionToServiceConfiguration('file_uri_target', 'stream_wrapper_manager', 'getTarget'),
new FunctionToServiceConfiguration('8.8.0', 'file_uri_target', 'stream_wrapper_manager', 'getTarget'),
]);

$rectorConfig->ruleWithConfiguration(MethodToMethodWithCheckRector::class, [
Expand Down
4 changes: 2 additions & 2 deletions config/drupal-9/drupal-9-all-deprecations.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use DrupalRector\Services\AddCommentService;
use DrupalRector\Set\Drupal9SetList;
use Rector\Config\RectorConfig;
use Rector\PHPUnit\Set\PHPUnitLevelSetList;
use Rector\PHPUnit\Set\PHPUnitSetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->singleton(AddCommentService::class, function () {
Expand All @@ -17,7 +17,7 @@
Drupal9SetList::DRUPAL_92,
Drupal9SetList::DRUPAL_93,
Drupal9SetList::DRUPAL_94,
PHPUnitLevelSetList::UP_TO_PHPUNIT_90,
PHPUnitSetList::PHPUNIT_90,
]);

$rectorConfig->bootstrapFiles([
Expand Down
24 changes: 24 additions & 0 deletions config/drupal-9/drupal-9.1-deprecations.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
use DrupalRector\Drupal9\Rector\Deprecation\UiHelperTraitDrupalPostFormRector;
use DrupalRector\Drupal9\Rector\Deprecation\UserPasswordRector;
use DrupalRector\Drupal9\Rector\ValueObject\AssertLegacyTraitConfiguration;
use DrupalRector\Rector\Deprecation\ClassConstantToClassConstantRector;
use DrupalRector\Rector\ValueObject\ClassConstantToClassConstantConfiguration;
use DrupalRector\Services\AddCommentService;
use Rector\Config\RectorConfig;
use Rector\PHPUnit\Set\PHPUnitSetList;
Expand Down Expand Up @@ -107,4 +109,26 @@
'toNumber'
),
]);

// Change record: https://www.drupal.org/node/3151009 (only constants are supported)
$rectorConfig->ruleWithConfiguration(ClassConstantToClassConstantRector::class, [
new ClassConstantToClassConstantConfiguration(
'Symfony\Cmf\Component\Routing\RouteObjectInterface',
'ROUTE_NAME',
'Drupal\Core\Routing\RouteObjectInterface',
'ROUTE_NAME',
),
new ClassConstantToClassConstantConfiguration(
'Symfony\Cmf\Component\Routing\RouteObjectInterface',
'ROUTE_OBJECT',
'Drupal\Core\Routing\RouteObjectInterface',
'ROUTE_OBJECT',
),
new ClassConstantToClassConstantConfiguration(
'Symfony\Cmf\Component\Routing\RouteObjectInterface',
'CONTROLLER_NAME',
'Drupal\Core\Routing\RouteObjectInterface',
'CONTROLLER_NAME',
),
]);
};
12 changes: 6 additions & 6 deletions config/drupal-9/drupal-9.3-deprecations.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

declare(strict_types=1);

use DrupalRector\Drupal8\Rector\Deprecation\ConstantToClassConstantRector;
use DrupalRector\Drupal8\Rector\ValueObject\ConstantToClassConfiguration;
use DrupalRector\Drupal9\Rector\Deprecation\ExtensionPathRector;
use DrupalRector\Drupal9\Rector\Deprecation\FileBuildUriRector;
use DrupalRector\Drupal9\Rector\Deprecation\FunctionToEntityTypeStorageMethod;
Expand All @@ -15,8 +13,10 @@
use DrupalRector\Drupal9\Rector\ValueObject\ExtensionPathConfiguration;
use DrupalRector\Drupal9\Rector\ValueObject\FunctionToEntityTypeStorageConfiguration;
use DrupalRector\Drupal9\Rector\ValueObject\FunctionToFirstArgMethodConfiguration;
use DrupalRector\Rector\Deprecation\ConstantToClassConstantRector;
use DrupalRector\Rector\Deprecation\FunctionToServiceRector;
use DrupalRector\Rector\Deprecation\FunctionToStaticRector;
use DrupalRector\Rector\ValueObject\ConstantToClassConfiguration;
use DrupalRector\Rector\ValueObject\FunctionToServiceConfiguration;
use DrupalRector\Rector\ValueObject\FunctionToStaticConfiguration;
use DrupalRector\Services\AddCommentService;
Expand All @@ -39,11 +39,11 @@

// Change record: https://www.drupal.org/node/3223520
$rectorConfig->ruleWithConfiguration(FunctionToServiceRector::class, [
new FunctionToServiceConfiguration('file_copy', 'file.repository', 'copy'),
new FunctionToServiceConfiguration('file_move', 'file.repository', 'move'),
new FunctionToServiceConfiguration('file_save_data', 'file.repository', 'writeData'),
new FunctionToServiceConfiguration('9.3.0', 'file_copy', 'file.repository', 'copy'),
new FunctionToServiceConfiguration('9.3.0', 'file_move', 'file.repository', 'move'),
new FunctionToServiceConfiguration('9.3.0', 'file_save_data', 'file.repository', 'writeData'),
// Change record: https://www.drupal.org/node/2939099
new FunctionToServiceConfiguration('render', 'renderer', 'render'),
new FunctionToServiceConfiguration('9.3.0', 'render', 'renderer', 'render'),
]);

// Change record: https://www.drupal.org/node/3223091.
Expand Down
Loading

0 comments on commit c4cfa62

Please sign in to comment.