Skip to content

Commit d7cc42e

Browse files
authored
[Symfony 6.1] Skip abstract class on CommandConfigureToAttributeRector (#662)
* [Symfony 6.1] Skip abstract class on CommandConfigureToAttributeRector * [Symfony 6.1] Skip abstract class on CommandConfigureToAttributeRector * [Symfony 6.1] Skip abstract class on CommandConfigureToAttributeRector
1 parent 0eca1e4 commit d7cc42e

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace Rector\Symfony\Tests\Symfony61\Rector\Class_\CommandConfigureToAttributeRector\Fixture;
4+
5+
use Symfony\Component\Console\Command\Command;
6+
7+
abstract class SkipAbstractClass extends Command
8+
{
9+
public function configure()
10+
{
11+
}
12+
}

rules/Symfony61/Rector/Class_/CommandConfigureToAttributeRector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ public function getNodeTypes(): array
9898
*/
9999
public function refactor(Node $node): ?Node
100100
{
101+
if ($node->isAbstract()) {
102+
return null;
103+
}
104+
101105
if (! $this->reflectionProvider->hasClass(SymfonyAnnotation::AS_COMMAND)) {
102106
return null;
103107
}

0 commit comments

Comments
 (0)