Skip to content

Commit bf47c49

Browse files
villfaondrejmirtes
authored andcommitted
Ease the usage of AssertRuleHelper::isMethodOrStaticCallOnAssert()
1 parent 54a24bd commit bf47c49

4 files changed

+3
-15
lines changed

src/Rules/PHPUnit/AssertRuleHelper.php

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
class AssertRuleHelper
1212
{
1313

14+
/**
15+
* @phpstan-assert-if-true Node\Expr\MethodCall|Node\Expr\StaticCall $node
16+
*/
1417
public static function isMethodOrStaticCallOnAssert(Node $node, Scope $scope): bool
1518
{
1619
$testCaseType = new ObjectType('PHPUnit\Framework\Assert');

src/Rules/PHPUnit/AssertSameBooleanExpectedRule.php

-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
use PhpParser\Node;
66
use PhpParser\Node\Expr\ConstFetch;
7-
use PhpParser\Node\Expr\MethodCall;
8-
use PhpParser\Node\Expr\StaticCall;
97
use PhpParser\NodeAbstract;
108
use PHPStan\Analyser\Scope;
119
use PHPStan\Rules\Rule;
@@ -28,9 +26,6 @@ public function processNode(Node $node, Scope $scope): array
2826
return [];
2927
}
3028

31-
/** @var MethodCall|StaticCall $node */
32-
$node = $node;
33-
3429
if (count($node->getArgs()) < 2) {
3530
return [];
3631
}

src/Rules/PHPUnit/AssertSameNullExpectedRule.php

-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
use PhpParser\Node;
66
use PhpParser\Node\Expr\ConstFetch;
7-
use PhpParser\Node\Expr\MethodCall;
8-
use PhpParser\Node\Expr\StaticCall;
97
use PhpParser\NodeAbstract;
108
use PHPStan\Analyser\Scope;
119
use PHPStan\Rules\Rule;
@@ -28,9 +26,6 @@ public function processNode(Node $node, Scope $scope): array
2826
return [];
2927
}
3028

31-
/** @var MethodCall|StaticCall $node */
32-
$node = $node;
33-
3429
if (count($node->getArgs()) < 2) {
3530
return [];
3631
}

src/Rules/PHPUnit/AssertSameWithCountRule.php

-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
use Countable;
66
use PhpParser\Node;
7-
use PhpParser\Node\Expr\MethodCall;
8-
use PhpParser\Node\Expr\StaticCall;
97
use PhpParser\NodeAbstract;
108
use PHPStan\Analyser\Scope;
119
use PHPStan\Rules\Rule;
@@ -29,9 +27,6 @@ public function processNode(Node $node, Scope $scope): array
2927
return [];
3028
}
3129

32-
/** @var MethodCall|StaticCall $node */
33-
$node = $node;
34-
3530
if (count($node->getArgs()) < 2) {
3631
return [];
3732
}

0 commit comments

Comments
 (0)