Change strings to specific constants
final class SomeSubscriber
{
public static function getSubscribedEvents()
{
- return ['compiler.post_dump' => 'compile'];
+ return [\Yet\AnotherClass::CONSTANT => 'compile'];
}
}
Configure your rector.php:
<?php
use Rector\Config\RectorConfig;
use Rector\Transform\Rector\String_\StringToClassConstantRector;
use Rector\Transform\ValueObject\StringToClassConstant;
return RectorConfig::configure()
->withConfiguredRule(StringToClassConstantRector::class, [
new StringToClassConstant('compiler.post_dump', 'Yet\AnotherClass', 'CONSTANT'),
]);