@@ -6219,24 +6219,24 @@ private function produceArrayDimFetchAssignValueToWrite(array $dimFetchStack, ar
6219
6219
continue ;
6220
6220
}
6221
6221
6222
- if ($ scope ->hasExpressionType ($ arrayDimFetch )->yes ()) { // keep list for $list[$index] assignments
6222
+ if (!$ arrayDimFetch ->dim instanceof BinaryOp \Plus) {
6223
+ continue ;
6224
+ }
6225
+
6226
+ if ( // keep list for $list[$index + 1] assignments
6227
+ $ arrayDimFetch ->dim ->right instanceof Variable
6228
+ && $ arrayDimFetch ->dim ->left instanceof Node \Scalar \Int_
6229
+ && $ arrayDimFetch ->dim ->left ->value === 1
6230
+ && $ scope ->hasExpressionType (new ArrayDimFetch ($ arrayDimFetch ->var , $ arrayDimFetch ->dim ->right ))->yes ()
6231
+ ) {
6232
+ $ valueToWrite = TypeCombinator::intersect ($ valueToWrite , new AccessoryArrayListType ());
6233
+ } elseif ( // keep list for $list[1 + $index] assignments
6234
+ $ arrayDimFetch ->dim ->left instanceof Variable
6235
+ && $ arrayDimFetch ->dim ->right instanceof Node \Scalar \Int_
6236
+ && $ arrayDimFetch ->dim ->right ->value === 1
6237
+ && $ scope ->hasExpressionType (new ArrayDimFetch ($ arrayDimFetch ->var , $ arrayDimFetch ->dim ->left ))->yes ()
6238
+ ) {
6223
6239
$ valueToWrite = TypeCombinator::intersect ($ valueToWrite , new AccessoryArrayListType ());
6224
- } elseif ($ arrayDimFetch ->dim instanceof BinaryOp \Plus) {
6225
- if ( // keep list for $list[$index + 1] assignments
6226
- $ arrayDimFetch ->dim ->right instanceof Variable
6227
- && $ arrayDimFetch ->dim ->left instanceof Node \Scalar \Int_
6228
- && $ arrayDimFetch ->dim ->left ->value === 1
6229
- && $ scope ->hasExpressionType (new ArrayDimFetch ($ arrayDimFetch ->var , $ arrayDimFetch ->dim ->right ))->yes ()
6230
- ) {
6231
- $ valueToWrite = TypeCombinator::intersect ($ valueToWrite , new AccessoryArrayListType ());
6232
- } elseif ( // keep list for $list[1 + $index] assignments
6233
- $ arrayDimFetch ->dim ->left instanceof Variable
6234
- && $ arrayDimFetch ->dim ->right instanceof Node \Scalar \Int_
6235
- && $ arrayDimFetch ->dim ->right ->value === 1
6236
- && $ scope ->hasExpressionType (new ArrayDimFetch ($ arrayDimFetch ->var , $ arrayDimFetch ->dim ->left ))->yes ()
6237
- ) {
6238
- $ valueToWrite = TypeCombinator::intersect ($ valueToWrite , new AccessoryArrayListType ());
6239
- }
6240
6240
}
6241
6241
}
6242
6242
0 commit comments