Skip to content

Commit

Permalink
[Performance] Early skip NativeFunctionReflection on OptionalParamete…
Browse files Browse the repository at this point in the history
…rsAfterRequiredRector (#5836)
  • Loading branch information
samsonasik committed Apr 20, 2024
1 parent 1374e15 commit 9ce6af8
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\FunctionReflection;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\Native\NativeFunctionReflection;
use Rector\CodingStyle\Reflection\VendorLocationDetector;
use Rector\NodeTypeResolver\PHPStan\ParametersAcceptorSelectorVariantsWrapper;
use Rector\Php80\NodeResolver\ArgumentSorter;
Expand Down Expand Up @@ -199,11 +200,19 @@ private function resolveExpectedArgParamOrderIfDifferent(
New_|MethodCall|ClassMethod|Function_|StaticCall|FuncCall $node,
Scope $scope
): ?array {
if ($reflection instanceof MethodReflection && $this->vendorLocationDetector->detectMethodReflection($reflection)) {
if ($reflection instanceof NativeFunctionReflection) {
return null;
}

if ($reflection instanceof FunctionReflection && $this->vendorLocationDetector->detectFunctionReflection($reflection)) {
if ($reflection instanceof MethodReflection && $this->vendorLocationDetector->detectMethodReflection(
$reflection
)) {
return null;
}

if ($reflection instanceof FunctionReflection && $this->vendorLocationDetector->detectFunctionReflection(
$reflection
)) {
return null;
}

Expand Down

0 comments on commit 9ce6af8

Please sign in to comment.