Commit c703aa0
committed
- When TypeNodeResolver creates an intersection of a non-generic iterable class with user-provided type arguments (e.g. PDOStatement<int,string>), TypeCombinator::intersect may collapse the result to NeverType if the iterable types are incompatible
- This was triggered by the more precise getIterator() return type in the PDOStatement stub (Iterator<mixed, array<int|string, mixed>> instead of plain Iterator)
- The fix preserves the IntersectionType directly when the intersection would otherwise collapse to NeverType, maintaining @var override semantics
- New regression test in tests/PHPStan/Rules/PhpDoc/data/bug-14206.php
1 parent f08de42 commit c703aa0
5 files changed
Lines changed: 39 additions & 8 deletions
File tree
- .claude/worktrees
- src/PhpDoc
- tests/PHPStan/Rules/PhpDoc
- data
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
| |||
935 | 936 | | |
936 | 937 | | |
937 | 938 | | |
938 | | - | |
939 | | - | |
940 | | - | |
941 | | - | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
942 | 946 | | |
943 | 947 | | |
944 | 948 | | |
945 | | - | |
946 | | - | |
947 | | - | |
948 | | - | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
949 | 956 | | |
950 | 957 | | |
951 | 958 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
173 | 178 | | |
174 | 179 | | |
175 | 180 | | |
| |||
| 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 | + | |
0 commit comments