mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-25 09:55:28 +02:00
use constant over string for class name
This commit is contained in:
parent
f046ed6457
commit
b6eddb6ac2
@ -27,6 +27,11 @@ use Rector\RectorDefinition\RectorDefinition;
|
||||
*/
|
||||
final class RenameEventNamesInEventSubscriberRector extends AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const EVENT_SUBSCRIBER_INTERFACE = 'Symfony\Component\EventDispatcher\EventSubscriberInterface';
|
||||
|
||||
/**
|
||||
* @var EventInfo[]
|
||||
*/
|
||||
@ -87,13 +92,12 @@ CODE_SAMPLE
|
||||
*/
|
||||
public function refactor(Node $node): ?Node
|
||||
{
|
||||
$classNode = $node->getAttribute(AttributeKey::CLASS_NODE);
|
||||
|
||||
if ($classNode === null) {
|
||||
$class = $node->getAttribute(AttributeKey::CLASS_NODE);
|
||||
if ($class === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $this->isType($classNode, 'Symfony\Component\EventDispatcher\EventSubscriberInterface')) {
|
||||
if (! $this->isType($class, self::EVENT_SUBSCRIBER_INTERFACE)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user