Skip to content

Commit 094bf54

Browse files
committed
fix
1 parent f3c0a87 commit 094bf54

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

src/Rules/PHPUnit/DataProviderDataRule.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,12 @@
1616
class DataProviderDataRule implements Rule
1717
{
1818

19-
private ReflectionProvider $reflectionProvider;
20-
2119
private TestMethodsHelper $testMethodsHelper;
2220

2321
public function __construct(
24-
ReflectionProvider $reflectionProvider,
2522
TestMethodsHelper $testMethodsHelper
2623
)
2724
{
28-
$this->reflectionProvider = $reflectionProvider;
2925
$this->testMethodsHelper = $testMethodsHelper;
3026
}
3127

@@ -80,10 +76,14 @@ public function processNode(Node $node, Scope $scope): array
8076

8177
foreach ($node->expr->items as $item) {
8278
if (!$item->value instanceof Node\Expr\Array_) {
83-
return [];
79+
continue;
8480
}
8581

8682
$args = $this->arrayItemsToArgs($item->value);
83+
if ($args === null) {
84+
continue;
85+
}
86+
8787
$var = new Node\Expr\New_(new Node\Name($classReflection->getName()));
8888
$scope->invokeNodeCallback(new Node\Expr\MethodCall(
8989
$var,

tests/PHPStan/Rules/CompositeRule.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
use PHPStan\Analyser\Scope;
77
use function get_class;
88

9-
class CompositeRule implements Rule
9+
/**
10+
* @implements Rule<Node>
11+
*/
12+
final class CompositeRule implements Rule
1013
{
1114

1215
private DirectRegistry $registry;

tests/Rules/PHPUnit/DataProviderDataRuleTest.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use PHPStan\Type\FileTypeMapper;
1919

2020
/**
21-
* @extends RuleTestCase<DataProviderDataRule>
21+
* @extends RuleTestCase<CompositeRule>
2222
*/
2323
class DataProviderDataRuleTest extends RuleTestCase
2424
{
@@ -27,12 +27,8 @@ protected function getRule(): Rule
2727
{
2828
$reflectionProvider = $this->createReflectionProvider();
2929

30-
$ruleLevelHelper = new RuleLevelHelper($reflectionProvider, true, false, true, true, false, false, true);
31-
32-
3330
return new CompositeRule(new DirectRegistry([
3431
new DataProviderDataRule(
35-
$reflectionProvider,
3632
new TestMethodsHelper($reflectionProvider, self::getContainer()->getByType(FileTypeMapper::class), self::getContainer()->getService('defaultAnalysisParser'))
3733
),
3834
self::getContainer()->getByType(CallMethodsRule::class)

0 commit comments

Comments
 (0)