From 5d6401037367fee8d377a42dd4948249606cc117 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 13 May 2025 01:04:18 +0700 Subject: [PATCH 1/2] Directly use isName(s) and getName() on rector rules --- .../Class_/EventSubscriberInterfaceToAttributeRector.php | 4 ++-- .../Rector/Class_/RemoveEmptyTableAttributeRector.php | 2 +- rules/DoctrineFixture/Reflection/ParameterTypeResolver.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rules/Bundle210/Rector/Class_/EventSubscriberInterfaceToAttributeRector.php b/rules/Bundle210/Rector/Class_/EventSubscriberInterfaceToAttributeRector.php index 466f0794..b64686d2 100644 --- a/rules/Bundle210/Rector/Class_/EventSubscriberInterfaceToAttributeRector.php +++ b/rules/Bundle210/Rector/Class_/EventSubscriberInterfaceToAttributeRector.php @@ -201,7 +201,7 @@ private function addAttribute(Class_ $class, array $arguments): void private function hasImplements(Class_ $class, string $interfaceFQN): bool { foreach ($class->implements as $implement) { - if ($this->nodeNameResolver->isName($implement, $interfaceFQN)) { + if ($this->isName($implement, $interfaceFQN)) { return true; } } @@ -215,7 +215,7 @@ private function hasImplements(Class_ $class, string $interfaceFQN): bool private function removeImplements(Class_ $class, array $interfaceFQNS): void { foreach ($class->implements as $key => $implement) { - if (! $this->nodeNameResolver->isNames($implement, $interfaceFQNS)) { + if (! $this->isNames($implement, $interfaceFQNS)) { continue; } diff --git a/rules/CodeQuality/Rector/Class_/RemoveEmptyTableAttributeRector.php b/rules/CodeQuality/Rector/Class_/RemoveEmptyTableAttributeRector.php index 85877567..e2f2670e 100644 --- a/rules/CodeQuality/Rector/Class_/RemoveEmptyTableAttributeRector.php +++ b/rules/CodeQuality/Rector/Class_/RemoveEmptyTableAttributeRector.php @@ -67,7 +67,7 @@ public function refactor(Node $node): ?Node foreach ($node->attrGroups as $attrGroupKey => $attrGroup) { foreach ($attrGroup->attrs as $key => $attribute) { - if (! $this->nodeNameResolver->isName($attribute, 'Doctrine\ORM\Mapping\Table')) { + if (! $this->isName($attribute, 'Doctrine\ORM\Mapping\Table')) { continue; } diff --git a/rules/DoctrineFixture/Reflection/ParameterTypeResolver.php b/rules/DoctrineFixture/Reflection/ParameterTypeResolver.php index c470bd23..6e2914e1 100644 --- a/rules/DoctrineFixture/Reflection/ParameterTypeResolver.php +++ b/rules/DoctrineFixture/Reflection/ParameterTypeResolver.php @@ -34,7 +34,7 @@ public function resolveCallerFirstParameterObjectType(MethodCall $methodCall): ? } $callerClassReflection = $this->reflectionProvider->getClass($callerType->getClassName()); - $callerMethodName = $this->nodeNameResolver->getName($methodCall->name); + $callerMethodName = $this->getName($methodCall->name); if (! is_string($callerMethodName)) { return null; } From d120ad0b8f8b6070c38b8d65fc8abec989784407 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 13 May 2025 01:10:17 +0700 Subject: [PATCH 2/2] ci --- rules/DoctrineFixture/Reflection/ParameterTypeResolver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/DoctrineFixture/Reflection/ParameterTypeResolver.php b/rules/DoctrineFixture/Reflection/ParameterTypeResolver.php index 6e2914e1..c470bd23 100644 --- a/rules/DoctrineFixture/Reflection/ParameterTypeResolver.php +++ b/rules/DoctrineFixture/Reflection/ParameterTypeResolver.php @@ -34,7 +34,7 @@ public function resolveCallerFirstParameterObjectType(MethodCall $methodCall): ? } $callerClassReflection = $this->reflectionProvider->getClass($callerType->getClassName()); - $callerMethodName = $this->getName($methodCall->name); + $callerMethodName = $this->nodeNameResolver->getName($methodCall->name); if (! is_string($callerMethodName)) { return null; }