File tree Expand file tree Collapse file tree 3 files changed +13
-0
lines changed
tests/PHPStan/Rules/DeadCode Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -3211,6 +3211,7 @@ static function (): void {
32113211$ hasYield = $ hasYield || $ result ->hasYield ();
32123212$ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
32133213$ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3214+ $ isAlwaysTerminating = $ isAlwaysTerminating || $ result ->isAlwaysTerminating ();
32143215$ scope = $ result ->getScope ();
32153216}
32163217} elseif ($ expr instanceof ArrayDimFetch) {
Original file line number Diff line number Diff line change @@ -261,6 +261,10 @@ public function testBug13232a(): void
261261'Unreachable statement - code above always terminates. ' ,
26226211 ,
263263],
264+ [
265+ 'Unreachable statement - code above always terminates. ' ,
266+ 17 ,
267+ ],
264268]);
265269}
266270
Original file line number Diff line number Diff line change @@ -10,6 +10,14 @@ public function sayHi(): void
1010. ' no way ' ;
1111echo 'this will never happen ' ;
1212}
13+
14+ public function sayHo (): void
15+ {
16+ echo "Hello, {$ this ->neverReturnsMethod ()} no way " ;
17+ echo 'this will never happen ' ;
18+ }
19+
20+ function neverReturnsMethod (): never {}
1321}
1422function neverReturns (): never {}
1523
You can’t perform that action at this time.
0 commit comments