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 {
3208
3208
$ hasYield = $ hasYield || $ result ->hasYield ();
3209
3209
$ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
3210
3210
$ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3211
+ $ isAlwaysTerminating = $ isAlwaysTerminating || $ result ->isAlwaysTerminating ();
3211
3212
$ scope = $ result ->getScope ();
3212
3213
}
3213
3214
} elseif ($ expr instanceof ArrayDimFetch) {
Original file line number Diff line number Diff line change @@ -250,6 +250,10 @@ public function testBug13232a(): void
250
250
'Unreachable statement - code above always terminates. ' ,
251
251
11 ,
252
252
],
253
+ [
254
+ 'Unreachable statement - code above always terminates. ' ,
255
+ 17 ,
256
+ ],
253
257
]);
254
258
}
255
259
Original file line number Diff line number Diff line change @@ -10,6 +10,14 @@ public function sayHi(): void
10
10
. ' no way ' ;
11
11
echo 'this will never happen ' ;
12
12
}
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 {}
13
21
}
14
22
function neverReturns (): never {}
15
23
You can’t perform that action at this time.
0 commit comments