Skip to content

Commit

Permalink
Ease the usage of AssertRuleHelper::isMethodOrStaticCallOnAssert()
Browse files Browse the repository at this point in the history
  • Loading branch information
villfa authored and ondrejmirtes committed Dec 30, 2022
1 parent 54a24bd commit bf47c49
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 15 deletions.
3 changes: 3 additions & 0 deletions src/Rules/PHPUnit/AssertRuleHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
class AssertRuleHelper
{

/**
* @phpstan-assert-if-true Node\Expr\MethodCall|Node\Expr\StaticCall $node
*/
public static function isMethodOrStaticCallOnAssert(Node $node, Scope $scope): bool
{
$testCaseType = new ObjectType('PHPUnit\Framework\Assert');
Expand Down
5 changes: 0 additions & 5 deletions src/Rules/PHPUnit/AssertSameBooleanExpectedRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

use PhpParser\Node;
use PhpParser\Node\Expr\ConstFetch;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\NodeAbstract;
use PHPStan\Analyser\Scope;
use PHPStan\Rules\Rule;
Expand All @@ -28,9 +26,6 @@ public function processNode(Node $node, Scope $scope): array
return [];
}

/** @var MethodCall|StaticCall $node */
$node = $node;

if (count($node->getArgs()) < 2) {
return [];
}
Expand Down
5 changes: 0 additions & 5 deletions src/Rules/PHPUnit/AssertSameNullExpectedRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

use PhpParser\Node;
use PhpParser\Node\Expr\ConstFetch;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\NodeAbstract;
use PHPStan\Analyser\Scope;
use PHPStan\Rules\Rule;
Expand All @@ -28,9 +26,6 @@ public function processNode(Node $node, Scope $scope): array
return [];
}

/** @var MethodCall|StaticCall $node */
$node = $node;

if (count($node->getArgs()) < 2) {
return [];
}
Expand Down
5 changes: 0 additions & 5 deletions src/Rules/PHPUnit/AssertSameWithCountRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

use Countable;
use PhpParser\Node;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\NodeAbstract;
use PHPStan\Analyser\Scope;
use PHPStan\Rules\Rule;
Expand All @@ -29,9 +27,6 @@ public function processNode(Node $node, Scope $scope): array
return [];
}

/** @var MethodCall|StaticCall $node */
$node = $node;

if (count($node->getArgs()) < 2) {
return [];
}
Expand Down

0 comments on commit bf47c49

Please sign in to comment.