Skip to content

Commit 23fc42e

Browse files
committed
fix
1 parent 0938195 commit 23fc42e

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

src/Rules/PHPUnit/AssertEqualsIsDiscouragedRule.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ public function getNodeType(): string
2727

2828
public function processNode(Node $node, Scope $scope): array
2929
{
30+
if (!$node instanceof Node\Expr\MethodCall && ! $node instanceof Node\Expr\StaticCall) {
31+
return [];
32+
}
3033
if (count($node->getArgs()) < 2) {
3134
return [];
3235
}

src/Rules/PHPUnit/AssertRuleHelper.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
class AssertRuleHelper
1212
{
1313

14-
/**
15-
* @phpstan-assert-if-true Node\Expr\MethodCall|Node\Expr\StaticCall $node
16-
*/
1714
public static function isMethodOrStaticCallOnAssert(Node $node, Scope $scope): bool
1815
{
1916
if ($node instanceof Node\Expr\MethodCall) {

src/Rules/PHPUnit/AssertSameBooleanExpectedRule.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ public function getNodeType(): string
2323

2424
public function processNode(Node $node, Scope $scope): array
2525
{
26+
if (!$node instanceof Node\Expr\MethodCall && ! $node instanceof Node\Expr\StaticCall) {
27+
return [];
28+
}
2629
if (count($node->getArgs()) < 2) {
2730
return [];
2831
}

src/Rules/PHPUnit/AssertSameNullExpectedRule.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ public function getNodeType(): string
2323

2424
public function processNode(Node $node, Scope $scope): array
2525
{
26+
if (!$node instanceof Node\Expr\MethodCall && ! $node instanceof Node\Expr\StaticCall) {
27+
return [];
28+
}
2629
if (count($node->getArgs()) < 2) {
2730
return [];
2831
}

src/Rules/PHPUnit/AssertSameWithCountRule.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@ public function getNodeType(): string
2424

2525
public function processNode(Node $node, Scope $scope): array
2626
{
27+
if (!$node instanceof Node\Expr\MethodCall && ! $node instanceof Node\Expr\StaticCall) {
28+
return [];
29+
}
2730
if (count($node->getArgs()) < 2) {
2831
return [];
2932
}
3033
if ($node->isFirstClassCallable()) {
3134
return [];
3235
}
33-
if (!$node->name instanceof Node\Identifier || $node->name->toLowerString() !== 'assertsame') {
36+
if (!$node->name instanceof Node\Identifier || $node->name->toLowerString() !== 'assertsame') {
3437
return [];
3538
}
3639

0 commit comments

Comments
 (0)