Commit e40cef4
Treat unsealed from-encoding arrays as multi-candidate in
The PHP 8 "can this return false?" check counted only the explicit
`getValueTypes()` of the from-encoding array, so a one-explicit-key
unsealed array — `mb_convert_encoding($s, 'UTF-8', array{'FOO',
...<int, string>})` — was treated as a single guaranteed encoding and
the `false` branch was dropped. The unsealed extras can supply further
candidates, making it an auto-detect list that may fail.
Extend the `count(...) > 1` gate with `|| isUnsealed()->yes()` so the
result keeps `false` as a possible outcome.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>mb_convert_encoding()
1 parent 3699e95 commit e40cef4
2 files changed
Lines changed: 12 additions & 1 deletion
File tree
- src/Type/Php
- tests/PHPStan/Analyser/nsrt
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
75 | 79 | | |
76 | 80 | | |
77 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
48 | 55 | | |
0 commit comments