Skip to content

Commit d8bdab0

Browse files
mad-brillerondrejmirtes
authored andcommitted
Microoptimize AssertRuleHelper.
1 parent 9e928dd commit d8bdab0

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/Rules/PHPUnit/AssertRuleHelper.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ class AssertRuleHelper
1616
*/
1717
public static function isMethodOrStaticCallOnAssert(Node $node, Scope $scope): bool
1818
{
19-
$testCaseType = new ObjectType('PHPUnit\Framework\Assert');
2019
if ($node instanceof Node\Expr\MethodCall) {
2120
$calledOnType = $scope->getType($node->var);
2221
} elseif ($node instanceof Node\Expr\StaticCall) {
@@ -45,11 +44,9 @@ public static function isMethodOrStaticCallOnAssert(Node $node, Scope $scope): b
4544
return false;
4645
}
4746

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

52-
return true;
49+
return $testCaseType->isSuperTypeOf($calledOnType)->yes();
5350
}
5451

5552
}

0 commit comments

Comments
 (0)