Commit 9dc46fd
Add test for non-object string cast reporting dead catch
Ensures that casting a non-object type (int) to string correctly
reports the catch block as dead code, since no __toString() method
is involved and no exception can be thrown.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 32723e0 commit 9dc46fd
File tree
2 files changed
+17
-1
lines changed- tests/PHPStan/Rules/Exceptions
- data
2 files changed
+17
-1
lines changedLines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
736 | 736 | | |
737 | 737 | | |
738 | 738 | | |
739 | | - | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
740 | 745 | | |
741 | 746 | | |
742 | 747 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
0 commit comments