Configurable

DrupalServiceRenameRector

Renames the IDs in Drupal::service() calls

-\Drupal::service('old')->foo();
+\Drupal::service('bar')->foo();

Configure your rector.php:

<?php

use DrupalRector\Rector\Deprecation\DrupalServiceRenameRector;
use DrupalRector\Rector\ValueObject\DrupalServiceRenameConfiguration;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withConfiguredRule(DrupalServiceRenameRector::class, [
        new DrupalServiceRenameConfiguration('11.4.0', 'old', 'bar'),
    ]);