Skip to content

Commit 25c9aaf

Browse files
committed
fix
1 parent 3a0babe commit 25c9aaf

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

rules/CodeQuality/Rector/ClassMethod/DataProviderArrayItemsNewLinedRector.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
use PhpParser\Node\Stmt\ClassMethod;
1010
use PhpParser\Node\Stmt\Return_;
1111
use Rector\NodeTypeResolver\Node\AttributeKey;
12+
use Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer;
1213
use Rector\PhpParser\Node\BetterNodeFinder;
14+
use Rector\PHPUnit\Enum\PHPUnitAttribute;
1315
use Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer;
1416
use Rector\Rector\AbstractRector;
1517
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
@@ -22,7 +24,8 @@ final class DataProviderArrayItemsNewLinedRector extends AbstractRector
2224
{
2325
public function __construct(
2426
private readonly TestsNodeAnalyzer $testsNodeAnalyzer,
25-
private readonly BetterNodeFinder $betterNodeFinder
27+
private readonly BetterNodeFinder $betterNodeFinder,
28+
private readonly PhpAttributeAnalyzer $phpAttributeAnalyzer
2629
) {
2730
}
2831

@@ -96,7 +99,8 @@ public function refactor(Node $node): ?Node
9699
}
97100

98101
// skip test methods
99-
if (str_starts_with($node->name->toString(), 'test')) {
102+
if (str_starts_with($node->name->toString(), 'test')
103+
|| $this->phpAttributeAnalyzer->hasPhpAttribute($node, PHPUnitAttribute::TEST)) {
100104
return null;
101105
}
102106

0 commit comments

Comments
 (0)