@@ -2922,12 +2922,12 @@ 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 ];
29292929
2930- return $ this ->scopeFactory ->create (
2930+ $ functionScope = $ this ->scopeFactory ->create (
29312931 $ this ->context ,
29322932 $ this ->isDeclareStrictTypes (),
29332933 $ this ->getFunction (),
@@ -2945,14 +2945,20 @@ public function pushInFunctionCall($reflection, ?ParameterReflection $parameter)
29452945 $ this ->parentScope ,
29462946 $ this ->nativeTypesPromoted ,
29472947 );
2948+
2949+ if ($ rememberTypes ) {
2950+ $ functionScope ->resolvedTypes = $ this ->resolvedTypes ;
2951+ }
2952+
2953+ return $ functionScope ;
29482954 }
29492955
29502956 public function popInFunctionCall (): self
29512957 {
29522958 $ stack = $ this ->inFunctionCallsStack ;
29532959 array_pop ($ stack );
29542960
2955- return $ this ->scopeFactory ->create (
2961+ $ parentScope = $ this ->scopeFactory ->create (
29562962 $ this ->context ,
29572963 $ this ->isDeclareStrictTypes (),
29582964 $ this ->getFunction (),
@@ -2970,6 +2976,10 @@ public function popInFunctionCall(): self
29702976 $ this ->parentScope ,
29712977 $ this ->nativeTypesPromoted ,
29722978 );
2979+
2980+ $ parentScope ->resolvedTypes = $ this ->resolvedTypes ;
2981+
2982+ return $ parentScope ;
29732983 }
29742984
29752985 /** @api */
0 commit comments