Commit 3984d04
Fix throw points not properly matched to catch clauses
- When a method has @throws with a supertype of the caught exception (e.g. @throws RuntimeException with catch PDOException), implicit throw points from other method calls were incorrectly excluded from the catch scope
- Phase 3 (implicit throw point matching) was skipped when explicit @throws matched even as "maybe", now it only skips when there's a definitive "yes" match
- Added regression test in tests/PHPStan/Rules/Variables/data/bug-9349.php
Closes phpstan/phpstan#93491 parent d32efcb commit 3984d04
3 files changed
Lines changed: 52 additions & 1 deletion
File tree
- src/Analyser
- tests/PHPStan/Rules/Variables
- data
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1879 | 1879 | | |
1880 | 1880 | | |
1881 | 1881 | | |
| 1882 | + | |
1882 | 1883 | | |
1883 | 1884 | | |
1884 | 1885 | | |
| |||
1896 | 1897 | | |
1897 | 1898 | | |
1898 | 1899 | | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
1899 | 1903 | | |
1900 | 1904 | | |
1901 | 1905 | | |
1902 | 1906 | | |
1903 | 1907 | | |
1904 | 1908 | | |
1905 | 1909 | | |
1906 | | - | |
| 1910 | + | |
1907 | 1911 | | |
1908 | 1912 | | |
1909 | 1913 | | |
| |||
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1393 | 1393 | | |
1394 | 1394 | | |
1395 | 1395 | | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
1396 | 1411 | | |
1397 | 1412 | | |
1398 | 1413 | | |
| |||
| 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 | + | |
0 commit comments