Skip to content

Commit 06fe0ea

Browse files
committed
fix
1 parent 418647d commit 06fe0ea

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

src/Analyser/MutatingScope.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2922,7 +2922,7 @@ public function hasExpressionType(Expr $node): TrinaryLogic
29222922
/**
29232923
* @param MethodReflection|FunctionReflection|null $reflection
29242924
*/
2925-
public function pushInFunctionCall($reflection, ?ParameterReflection $parameter): self
2925+
public function pushInFunctionCall($reflection, ?ParameterReflection $parameter, bool $rememberTypes): self
29262926
{
29272927
$stack = $this->inFunctionCallsStack;
29282928
$stack[] = [$reflection, $parameter];
@@ -2945,7 +2945,11 @@ public function pushInFunctionCall($reflection, ?ParameterReflection $parameter)
29452945
$this->parentScope,
29462946
$this->nativeTypesPromoted,
29472947
);
2948-
$functionScope->resolvedTypes = $this->resolvedTypes;
2948+
2949+
if ($rememberTypes) {
2950+
$functionScope->resolvedTypes = $this->resolvedTypes;
2951+
}
2952+
29492953
return $functionScope;
29502954
}
29512955

@@ -2972,7 +2976,9 @@ public function popInFunctionCall(): self
29722976
$this->parentScope,
29732977
$this->nativeTypesPromoted,
29742978
);
2979+
29752980
$parentScope->resolvedTypes = $this->resolvedTypes;
2981+
29762982
return $parentScope;
29772983
}
29782984

src/Analyser/NodeScopeResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5604,7 +5604,7 @@ private function processArgs(
56045604
}
56055605

56065606
if ($calleeReflection !== null) {
5607-
$scope = $scope->pushInFunctionCall($calleeReflection, $parameter);
5607+
$scope = $scope->pushInFunctionCall($calleeReflection, $parameter, true);
56085608
}
56095609

56105610
$originalArg = $arg->getAttribute(ArgumentsNormalizer::ORIGINAL_ARG_ATTRIBUTE) ?? $arg;

src/Reflection/ParametersAcceptorSelector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ public static function selectFromArgs(
499499
}
500500

501501
if ($parameter !== null && $scope instanceof MutatingScope) {
502-
$scope = $scope->pushInFunctionCall(null, $parameter);
502+
$scope = $scope->pushInFunctionCall(null, $parameter, true);
503503
}
504504

505505
$type = $scope->getType($originalArg->value);

src/Rules/FunctionCallParametersCheck.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,8 @@ public function check(
319319

320320
if ($argumentValueType === null) {
321321
if ($scope instanceof MutatingScope) {
322-
$scope = $scope->pushInFunctionCall(null, $parameter);
322+
$rememberTypes = !$argumentValue instanceof Expr\Closure && !$argumentValue instanceof Expr\ArrowFunction;
323+
$scope = $scope->pushInFunctionCall(null, $parameter, $rememberTypes);
323324
}
324325
$argumentValueType = $scope->getType($argumentValue);
325326

0 commit comments

Comments
 (0)