Skip to content

Commit 386f1db

Browse files
committed
test nullsafe
1 parent de17c04 commit 386f1db

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/Analyser/NodeScopeResolver.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2929,8 +2929,7 @@ static function (): void {
29292929
$exprResult->getThrowPoints(),
29302930
$exprResult->getImpurePoints(),
29312931
static fn (): MutatingScope => $scope->filterByTruthyValue($expr),
2932-
static fn (): MutatingScope => $scope->filterByFalseyValue($expr),
2933-
$exprResult->isAlwaysTerminating(),
2932+
static fn (): MutatingScope => $scope->filterByFalseyValue($expr)
29342933
);
29352934
} elseif ($expr instanceof StaticCall) {
29362935
$hasYield = false;

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ static public function sayStaticHello(): void
2020
echo 'this will never happen';
2121
}
2222

23+
public function sayNullsafeHello(?self $x): void
24+
{
25+
echo 'Hello, ' . $x?->mightReturnNever()
26+
. ' no way';
27+
28+
echo 'this might happen, in case $x is null';
29+
}
30+
2331
function mightReturnNever(): never
2432

2533
{

0 commit comments

Comments
 (0)