Commit 1a447f6
Track array value type overwrites in by-reference
- Allow the post-foreach array value type rewrite to apply to constant arrays
when the foreach is by-reference (`$stmt->byRef`), since
`tryProcessUnrolledConstantArrayForeach` skips by-ref iteration
- Move the `isConstantArray()->yes()` check before `instanceof ArrayType` in
the TypeTraverser callbacks, since `ConstantArrayType` implements `Type`
directly and does not extend `ArrayType`
- Use `ConstantArrayType::traverse()` to replace value types while preserving
the constant array structure (key types, optional keys, list status)
- For by-ref foreach with key on constant arrays, use the value variable's type
as the dim fetch type when the value was reassigned, since the
`IntertwinedVariableByReferenceWithExpr` mechanism is not set up for constant
arraysforeach on constant arrays1 parent d883cd8 commit 1a447f6
2 files changed
Lines changed: 112 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1352 | 1352 | | |
1353 | 1353 | | |
1354 | 1354 | | |
1355 | | - | |
| 1355 | + | |
1356 | 1356 | | |
1357 | 1357 | | |
1358 | 1358 | | |
| |||
1372 | 1372 | | |
1373 | 1373 | | |
1374 | 1374 | | |
1375 | | - | |
1376 | | - | |
1377 | | - | |
1378 | | - | |
1379 | | - | |
1380 | | - | |
1381 | 1375 | | |
1382 | 1376 | | |
1383 | 1377 | | |
1384 | 1378 | | |
1385 | 1379 | | |
| 1380 | + | |
| 1381 | + | |
1386 | 1382 | | |
1387 | 1383 | | |
1388 | 1384 | | |
| |||
1400 | 1396 | | |
1401 | 1397 | | |
1402 | 1398 | | |
| 1399 | + | |
| 1400 | + | |
1403 | 1401 | | |
1404 | 1402 | | |
1405 | 1403 | | |
| |||
1432 | 1430 | | |
1433 | 1431 | | |
1434 | 1432 | | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
1435 | 1437 | | |
1436 | 1438 | | |
1437 | 1439 | | |
| |||
1446 | 1448 | | |
1447 | 1449 | | |
1448 | 1450 | | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
1449 | 1455 | | |
1450 | 1456 | | |
1451 | 1457 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
0 commit comments