Commit 2377075
Simplify by-ref constant array handling via MutatingScope::enterForeach
Remove the isConstantArray()->no() guard from the with-key
IntertwinedVariableByReferenceWithExpr setup in enterForeach.
The ArrayDimFetch-based intertwined expression correctly targets
individual elements via the key variable, so it works for constant
arrays (unlike the SetExistingOffsetValueTypeExpr path which
updates all values at once and must remain guarded).
This lets the intertwined mechanism automatically propagate by-ref
type changes to the dim fetch for constant arrays, removing the
need for the elseif ($stmt->byRef) fallback branches in the
post-loop rewrite in NodeScopeResolver.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 2576141 commit 2377075
2 files changed
Lines changed: 1 addition & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2373 | 2373 | | |
2374 | 2374 | | |
2375 | 2375 | | |
2376 | | - | |
| 2376 | + | |
2377 | 2377 | | |
2378 | 2378 | | |
2379 | 2379 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1377 | 1377 | | |
1378 | 1378 | | |
1379 | 1379 | | |
1380 | | - | |
1381 | | - | |
1382 | 1380 | | |
1383 | 1381 | | |
1384 | 1382 | | |
| |||
1396 | 1394 | | |
1397 | 1395 | | |
1398 | 1396 | | |
1399 | | - | |
1400 | | - | |
1401 | 1397 | | |
1402 | 1398 | | |
1403 | 1399 | | |
| |||
0 commit comments