diff --git a/src/Analyser/MutatingScope.php b/src/Analyser/MutatingScope.php index c08258e4f32..a1d20804cc2 100644 --- a/src/Analyser/MutatingScope.php +++ b/src/Analyser/MutatingScope.php @@ -2650,7 +2650,7 @@ public function enterForeach(self $originalScope, Expr $iteratee, Type $iteratee if ($valueByRef && $iterateeType->isArray()->yes() && $iterateeType->isConstantArray()->no()) { $scope = $scope->assignExpression( new IntertwinedVariableByReferenceWithExpr($valueName, $iteratee, new SetExistingOffsetValueTypeExpr( - $iteratee, + new NativeTypeExpr($iterateeType, $nativeIterateeType), new NativeTypeExpr( $originalScope->getIterableKeyType($iterateeType), $originalScope->getIterableKeyType($nativeIterateeType),