Skip to content

Commit

Permalink
Microoptimize AssertRuleHelper.
Browse files Browse the repository at this point in the history
  • Loading branch information
mad-briller authored and ondrejmirtes committed May 26, 2023
1 parent 9e928dd commit d8bdab0
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Rules/PHPUnit/AssertRuleHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class AssertRuleHelper
*/
public static function isMethodOrStaticCallOnAssert(Node $node, Scope $scope): bool
{
$testCaseType = new ObjectType('PHPUnit\Framework\Assert');
if ($node instanceof Node\Expr\MethodCall) {
$calledOnType = $scope->getType($node->var);
} elseif ($node instanceof Node\Expr\StaticCall) {
Expand Down Expand Up @@ -45,11 +44,9 @@ public static function isMethodOrStaticCallOnAssert(Node $node, Scope $scope): b
return false;
}

if (!$testCaseType->isSuperTypeOf($calledOnType)->yes()) {
return false;
}
$testCaseType = new ObjectType('PHPUnit\Framework\Assert');

return true;
return $testCaseType->isSuperTypeOf($calledOnType)->yes();
}

}

0 comments on commit d8bdab0

Please sign in to comment.