Skip to content

Commit de8d08b

Browse files
authored
[perf] Hoist cheap limit-arg guard before scope fetch in preg_split rule (#8709)
1 parent d0e13e9 commit de8d08b

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎rules/Php81/Rector/FuncCall/NullToStrictIntPregSlitFuncCallLimitArgRector.php‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,18 @@ public function refactor(Node $node): ?Node
8080
return null;
8181
}
8282

83-
$scope = $node->getAttribute(AttributeKey::SCOPE);
84-
if (! $scope instanceof Scope) {
85-
return null;
86-
}
87-
8883
$args = $node->getArgs();
8984
$position = $this->argsAnalyzer->resolveArgPosition($args, 'limit', 2);
9085

9186
if (! isset($args[$position])) {
9287
return null;
9388
}
9489

90+
$scope = $node->getAttribute(AttributeKey::SCOPE);
91+
if (! $scope instanceof Scope) {
92+
return null;
93+
}
94+
9595
$classReflection = $scope->getClassReflection();
9696
$isTrait = $classReflection instanceof ClassReflection && $classReflection->isTrait();
9797

0 commit comments

Comments
 (0)