Commit 6148fb6
Report missing iterable value type for array part of
- In `MissingTypehintCheck::getIterableTypesWithMissingValueTypehint()`, the
special-case block for `array&callable` intersection types was skipping the
array part entirely, never checking it for missing value types
- Added a check for the array inner type's iterable value type before skipping
it, so `callable-array`, `callable&array`, and `array&callable(...)` now
correctly report `missingType.iterableValue` when the array has no value type
- Updated test expectations for `doIntersection()` (gains a third error for the
outer array) and `doFoo()` (now reports missing iterable value type)
- Added new test case `doBaz()` with explicit `callable&array` parameter
- All consumers of `MissingTypehintCheck` (method/function parameters, return
types, properties, constants, @var tags, @phpstan-assert) are automatically
fixed since they share the same checkarray&callable intersections in MissingTypehintCheck
1 parent 28f6ffe commit 6148fb6
3 files changed
Lines changed: 30 additions & 0 deletions
File tree
- src/Rules
- tests/PHPStan/Rules/Methods
- data
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
| |||
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
154 | 159 | | |
155 | 160 | | |
156 | 161 | | |
| |||
165 | 170 | | |
166 | 171 | | |
167 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
168 | 187 | | |
169 | 188 | | |
170 | 189 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
50 | 57 | | |
51 | 58 | | |
52 | 59 | | |
0 commit comments