Commit b5638cc
Fix containsNan to handle union array types and optional keys
When a type is a union of constant arrays (e.g. array{NAN}|array{1}),
containsNan should only return true if ALL variants contain NAN, not
just any of them. Also skip optional keys since absent optional entries
mean the array might not actually contain NAN.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 869b3e4 commit b5638cc
2 files changed
Lines changed: 28 additions & 4 deletions
File tree
- src/Reflection
- tests/PHPStan/Rules/Comparison/data
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2076 | 2076 | | |
2077 | 2077 | | |
2078 | 2078 | | |
2079 | | - | |
2080 | | - | |
2081 | | - | |
2082 | | - | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
2083 | 2084 | | |
2084 | 2085 | | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
| 2089 | + | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
| 2093 | + | |
| 2094 | + | |
| 2095 | + | |
| 2096 | + | |
| 2097 | + | |
| 2098 | + | |
| 2099 | + | |
| 2100 | + | |
| 2101 | + | |
| 2102 | + | |
2085 | 2103 | | |
2086 | 2104 | | |
2087 | 2105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
13 | 19 | | |
0 commit comments