diff --git a/config/drupal-9/drupal-9.1-deprecations.php b/config/drupal-9/drupal-9.1-deprecations.php index c62eee8f..8a6d1999 100644 --- a/config/drupal-9/drupal-9.1-deprecations.php +++ b/config/drupal-9/drupal-9.1-deprecations.php @@ -18,6 +18,8 @@ use DrupalRector\Services\AddCommentService; use Rector\Config\RectorConfig; use Rector\PHPUnit\Set\PHPUnitSetList; +use Rector\Renaming\Rector\StaticCall\RenameStaticMethodRector; +use Rector\Renaming\ValueObject\RenameStaticMethod; return static function (RectorConfig $rectorConfig): void { $rectorConfig->singleton(AddCommentService::class, function () { @@ -95,4 +97,14 @@ $rectorConfig->rule(GetRawContentRector::class); $rectorConfig->rule(GetAllOptionsRector::class); $rectorConfig->rule(UserPasswordRector::class); + + // Change record: https://www.drupal.org/node/3162663 + $rectorConfig->ruleWithConfiguration(RenameStaticMethodRector::class, [ + new RenameStaticMethod( + 'Drupal\Component\Utility\Bytes', + 'toInt', + 'Drupal\Component\Utility\Bytes', + 'toNumber' + ), + ]); }; diff --git a/fixtures/d9/rector_examples/rector_examples.module b/fixtures/d9/rector_examples/rector_examples.module index 937e4b4f..61738d50 100644 --- a/fixtures/d9/rector_examples/rector_examples.module +++ b/fixtures/d9/rector_examples/rector_examples.module @@ -1,5 +1,6 @@ getPath('node'); \Drupal::service('extension.list.theme')->getPath('seven'); @@ -13,3 +14,8 @@ function rector_examples_with_render() { $build = []; $output = \Drupal::service('renderer')->render($build); } + +function rector_utility_bytes_to_int() { + $int = Bytes::toNumber("15"); +} +