Replace string class names by
class AnotherClass
{
}
class SomeClass
{
public function run()
{
- return 'AnotherClass';
+ return \AnotherClass::class;
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
return RectorConfig::configure()
->withConfiguredRule(StringClassNameToClassConstantRector::class, [
'ClassName',
'AnotherClassName',
'should_keep_pre_slash' => false,
]);