Commit 70dde7c
Preserve never-type implicit throw point suppression for dynamically-typed calls
The previous commit's early return when `!isInThrow()` bypassed the
return type check entirely, creating false implicit throw points for
never-returning calls like `trigger_error("hello", E_USER_ERROR)`.
The original Throwable supertype check accidentally suppressed `never`
(bottom type, subtype of everything). Separate the two concerns:
- `never` return type: always suppress (function terminates, not throws)
- Throwable return type: only suppress inside `throw` expressions
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent a07dc29 commit 70dde7c
3 files changed
Lines changed: 11 additions & 10 deletions
File tree
- src/Analyser/ExprHandler
- Helper
- tests/PHPStan/Rules/Exceptions/data
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
626 | 626 | | |
627 | 627 | | |
628 | 628 | | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | 629 | | |
634 | | - | |
| 630 | + | |
635 | 631 | | |
636 | 632 | | |
637 | 633 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | 91 | | |
96 | | - | |
| 92 | + | |
97 | 93 | | |
98 | 94 | | |
99 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
0 commit comments