Commit 0a219ab
Fix phpstan/phpstan#10172: foreach over array dim fetch losing template type
- Skip HasOffsetValueType propagation to parent variable in specifyExpressionType when the variable has a template type
- The root cause was that foreach's empty/non-empty scope split narrowed the parent variable through ArrayDimFetch, destroying the template identity
- New regression test in tests/PHPStan/Analyser/nsrt/bug-10172.php1 parent c36922b commit 0a219ab
File tree
2 files changed
+29
-1
lines changed- src/Analyser
- tests/PHPStan/Analyser/nsrt
2 files changed
+29
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| |||
2731 | 2732 | | |
2732 | 2733 | | |
2733 | 2734 | | |
2734 | | - | |
| 2735 | + | |
2735 | 2736 | | |
2736 | 2737 | | |
2737 | 2738 | | |
| |||
| 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 | + | |
0 commit comments