Skip to content

Commit c9e7f53

Browse files
committed
fix string interpolation
1 parent 7d6f9a8 commit c9e7f53

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/Analyser/NodeScopeResolver.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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) {

tests/PHPStan/Rules/DeadCode/UnreachableStatementRuleTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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

tests/PHPStan/Rules/DeadCode/data/bug-13232a.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}
1422
function neverReturns(): never {}
1523

0 commit comments

Comments
 (0)