Configurable

RenameStringRector

Change string value

 class SomeClass
 {
     public function run()
     {
-        return 'ROLE_PREVIOUS_ADMIN';
+        return 'IS_IMPERSONATOR';
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Renaming\Rector\String_\RenameStringRector;

return RectorConfig::configure()
    ->withConfiguredRule(RenameStringRector::class, [
        'ROLE_PREVIOUS_ADMIN' => 'IS_IMPERSONATOR',
    ]);
SETS:  symfony/* 5.1