Skip to content

Commit dbdb6b9

Browse files
committed
Expect the ValueError of range() after a PHP 8 guard when analysing on PHP 7
After if (PHP_VERSION_ID < 80000) { return; } the rest of the method is analysed as PHP 8 with the reflection of PHP 7, which has no @throws. Since the ValueError fallback, the catches around the calls that throw on PHP 8 are no longer dead there.
1 parent 5789d36 commit dbdb6b9

1 file changed

Lines changed: 0 additions & 48 deletions

File tree

‎tests/PHPStan/Rules/Exceptions/CatchWithUnthrownExceptionRuleTest.php‎

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,58 +1624,10 @@ public function testRangeThrowTypeBeforePhp8(): void
16241624
'Dead catch - ValueError is never thrown in the try block.',
16251625
35,
16261626
],
1627-
[
1628-
'Dead catch - ValueError is never thrown in the try block.',
1629-
41,
1630-
],
1631-
[
1632-
'Dead catch - ValueError is never thrown in the try block.',
1633-
47,
1634-
],
1635-
[
1636-
'Dead catch - ValueError is never thrown in the try block.',
1637-
53,
1638-
],
1639-
[
1640-
'Dead catch - ValueError is never thrown in the try block.',
1641-
60,
1642-
],
1643-
[
1644-
'Dead catch - ValueError is never thrown in the try block.',
1645-
67,
1646-
],
1647-
[
1648-
'Dead catch - ValueError is never thrown in the try block.',
1649-
74,
1650-
],
1651-
[
1652-
'Dead catch - ValueError is never thrown in the try block.',
1653-
81,
1654-
],
16551627
[
16561628
'Dead catch - ValueError is never thrown in the try block.',
16571629
88,
16581630
],
1659-
[
1660-
'Dead catch - ValueError is never thrown in the try block.',
1661-
95,
1662-
],
1663-
[
1664-
'Dead catch - ValueError is never thrown in the try block.',
1665-
102,
1666-
],
1667-
[
1668-
'Dead catch - ValueError is never thrown in the try block.',
1669-
109,
1670-
],
1671-
[
1672-
'Dead catch - ValueError is never thrown in the try block.',
1673-
115,
1674-
],
1675-
[
1676-
'Dead catch - ValueError is never thrown in the try block.',
1677-
128,
1678-
],
16791631
[
16801632
'Dead catch - ValueError is never thrown in the try block.',
16811633
136,

0 commit comments

Comments
 (0)