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 {
3211
3211
$ hasYield = $ hasYield || $ result ->hasYield ();
3212
3212
$ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
3213
3213
$ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3214
+ $ isAlwaysTerminating = $ isAlwaysTerminating || $ result ->isAlwaysTerminating ();
3214
3215
$ scope = $ result ->getScope ();
3215
3216
}
3216
3217
} elseif ($ expr instanceof ArrayDimFetch) {
Original file line number Diff line number Diff line change @@ -261,6 +261,10 @@ public function testBug13232a(): void
261
261
'Unreachable statement - code above always terminates. ' ,
262
262
11 ,
263
263
],
264
+ [
265
+ 'Unreachable statement - code above always terminates. ' ,
266
+ 17 ,
267
+ ],
264
268
]);
265
269
}
266
270
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