Skip to content

Commit a6017ac

Browse files
committed
Added regression test
1 parent f878d5e commit a6017ac

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

tests/PHPStan/Rules/DeadCode/UnreachableStatementRuleTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,4 +355,10 @@ public function testBug13288(): void
355355
$this->analyse([__DIR__ . '/data/bug-13288.php'], []);
356356
}
357357

358+
public function testBug13311(): void
359+
{
360+
$this->treatPhpDocTypesAsCertain = false;
361+
$this->analyse([__DIR__ . '/data/bug-13311.php'], []);
362+
}
363+
358364
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Bug13311;
4+
5+
use Exception;
6+
7+
$error_handler = static function () { throw new Exception(); };
8+
set_error_handler($error_handler, \E_NOTICE | \E_WARNING);
9+
10+
try {
11+
$out = iconv($from, $to . $iconv_options, $str);
12+
} catch (Throwable $e) {
13+
$out = false;
14+
}

0 commit comments

Comments
 (0)