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 @@ -3208,6 +3208,7 @@ static function (): void {
32083208 $ hasYield = $ hasYield || $ result ->hasYield ();
32093209 $ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
32103210 $ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3211+ $ isAlwaysTerminating = $ isAlwaysTerminating || $ result ->isAlwaysTerminating ();
32113212 $ scope = $ result ->getScope ();
32123213 }
32133214 } elseif ($ expr instanceof ArrayDimFetch) {
Original file line number Diff line number Diff line change @@ -250,6 +250,10 @@ public function testBug13232a(): void
250250 'Unreachable statement - code above always terminates. ' ,
251251 11 ,
252252 ],
253+ [
254+ 'Unreachable statement - code above always terminates. ' ,
255+ 17 ,
256+ ],
253257 ]);
254258 }
255259
Original file line number Diff line number Diff line change @@ -10,6 +10,14 @@ public function sayHi(): void
1010 . ' no way ' ;
1111 echo '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