Commit 82fb419
committed
Resolve
- In `ResolvedFunctionVariantWithOriginal::resolveConditionalTypesForParameter()`, traverse
children (target, if, else) of `ConditionalTypeForParameter` first, then convert to
`ConditionalType` and return without further traversal. This prevents entering the subject
(the passed argument type), which may contain its own `ConditionalTypeForParameter` with a
colliding parameter name (e.g. `$value`), causing infinite recursion.
- Applied the same fix to the analogous pattern in `TypeSpecifier::resolveAssertTypes()`.
- Triggered by `is_X(is_Y(...))` first-class callable combinations where both functions have
conditional return types using the same parameter name `$value`.ConditionalTypeForParameter children before converting to ConditionalType to prevent infinite traversal1 parent d2d6328 commit 82fb419
File tree
3 files changed
+51
-3
lines changed- src
- Analyser
- Reflection
- tests/PHPStan/Analyser/nsrt
3 files changed
+51
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1849 | 1849 | | |
1850 | 1850 | | |
1851 | 1851 | | |
1852 | | - | |
1853 | | - | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
1854 | 1858 | | |
1855 | 1859 | | |
1856 | 1860 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
293 | | - | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
294 | 300 | | |
295 | 301 | | |
296 | 302 | | |
| |||
| 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 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
0 commit comments