@@ -5705,13 +5705,11 @@ private function processAssignVar(
57055705 }
57065706 $ offsetValueType = $ varType ;
57075707 $ offsetNativeValueType = $ varNativeType ;
5708- $ additionalExpressions = [];
57095708
5710- $ valueToWrite = $ this ->produceArrayDimFetchAssignValueToWrite ($ dimFetchStack , $ offsetTypes , $ offsetValueType , $ valueToWrite , $ scope, $ additionalExpressions );
5709+ [ $ valueToWrite, $ additionalExpressions ] = $ this ->produceArrayDimFetchAssignValueToWrite ($ dimFetchStack , $ offsetTypes , $ offsetValueType , $ valueToWrite , $ scope );
57115710
57125711 if (!$ offsetValueType ->equals ($ offsetNativeValueType ) || !$ valueToWrite ->equals ($ nativeValueToWrite )) {
5713- $ additionalNativeExpressions = [];
5714- $ nativeValueToWrite = $ this ->produceArrayDimFetchAssignValueToWrite ($ dimFetchStack , $ offsetNativeTypes , $ offsetNativeValueType , $ nativeValueToWrite , $ scope , $ additionalNativeExpressions );
5712+ [$ nativeValueToWrite , $ additionalNativeExpressions ] = $ this ->produceArrayDimFetchAssignValueToWrite ($ dimFetchStack , $ offsetNativeTypes , $ offsetNativeValueType , $ nativeValueToWrite , $ scope );
57155713 } else {
57165714 $ rewritten = false ;
57175715 foreach ($ offsetTypes as $ i => $ offsetType ) {
@@ -5730,7 +5728,7 @@ private function processAssignVar(
57305728 continue ;
57315729 }
57325730
5733- $ nativeValueToWrite = $ this ->produceArrayDimFetchAssignValueToWrite ($ dimFetchStack , $ offsetNativeTypes , $ offsetNativeValueType , $ nativeValueToWrite , $ scope );
5731+ [ $ nativeValueToWrite] = $ this ->produceArrayDimFetchAssignValueToWrite ($ dimFetchStack , $ offsetNativeTypes , $ offsetNativeValueType , $ nativeValueToWrite , $ scope );
57345732 $ rewritten = true ;
57355733 break ;
57365734 }
@@ -6146,9 +6144,10 @@ private function isImplicitArrayCreation(array $dimFetchStack, Scope $scope): Tr
61466144 /**
61476145 * @param list<ArrayDimFetch> $dimFetchStack
61486146 * @param list<Type|null> $offsetTypes
6149- * @param list<array{Expr, Type}> $additionalExpressions
6147+ *
6148+ * @return array{Type, list<array{Expr, Type}>}
61506149 */
6151- private function produceArrayDimFetchAssignValueToWrite (array $ dimFetchStack , array $ offsetTypes , Type $ offsetValueType , Type $ valueToWrite , Scope $ scope, array & $ additionalExpressions = [] ): Type
6150+ private function produceArrayDimFetchAssignValueToWrite (array $ dimFetchStack , array $ offsetTypes , Type $ offsetValueType , Type $ valueToWrite , Scope $ scope ): array
61526151 {
61536152 $ originalValueToWrite = $ valueToWrite ;
61546153
@@ -6240,6 +6239,7 @@ private function produceArrayDimFetchAssignValueToWrite(array $dimFetchStack, ar
62406239 }
62416240 }
62426241
6242+ $ additionalExpressions = [];
62436243 $ offsetValueType = $ valueToWrite ;
62446244 $ lastDimKey = array_key_last ($ dimFetchStack );
62456245 foreach ($ dimFetchStack as $ key => $ dimFetch ) {
@@ -6258,7 +6258,7 @@ private function produceArrayDimFetchAssignValueToWrite(array $dimFetchStack, ar
62586258 $ additionalExpressions [] = [$ dimFetch , $ offsetValueType ];
62596259 }
62606260
6261- return $ valueToWrite ;
6261+ return [ $ valueToWrite, $ additionalExpressions ] ;
62626262 }
62636263
62646264 private function unwrapAssign (Expr $ expr ): Expr
0 commit comments