Commit 5901a55
Fix array_splice not resetting integer keys of the input array
- Generalize specific integer key types (e.g. 10|20|30) to int in ArrayType::spliceArray()
- Uses TypeTraverser to only affect integer parts of union key types, preserving string keys
- New regression test in tests/PHPStan/Analyser/nsrt/bug-14037.php
- The root cause was that ArrayType::spliceArray() preserved the original key type verbatim, but PHP's array_splice re-indexes integer keys to 0, 1, 2, ...1 parent 1b1f48c commit 5901a55
File tree
2 files changed
+26
-1
lines changed- src/Type
- tests/PHPStan/Analyser/nsrt
2 files changed
+26
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
521 | 521 | | |
522 | 522 | | |
523 | 523 | | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
524 | 536 | | |
525 | | - | |
| 537 | + | |
526 | 538 | | |
527 | 539 | | |
528 | 540 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
0 commit comments