Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test nullsafe
  • Loading branch information
staabm committed Jul 21, 2025
commit 602325067a0c8677737d045645951d49dd46b6fc
3 changes: 1 addition & 2 deletions src/Analyser/NodeScopeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -2932,8 +2932,7 @@ static function (): void {
$exprResult->getThrowPoints(),
$exprResult->getImpurePoints(),
static fn (): MutatingScope => $scope->filterByTruthyValue($expr),
static fn (): MutatingScope => $scope->filterByFalseyValue($expr),
$exprResult->isAlwaysTerminating(),
static fn (): MutatingScope => $scope->filterByFalseyValue($expr)
);
} elseif ($expr instanceof StaticCall) {
$hasYield = false;
Expand Down
8 changes: 8 additions & 0 deletions tests/PHPStan/Rules/DeadCode/data/bug-13232c.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ static public function sayStaticHello(): void
echo 'this will never happen';
}

public function sayNullsafeHello(?self $x): void
{
echo 'Hello, ' . $x?->mightReturnNever()
. ' no way';

echo 'this might happen, in case $x is null';
}

function mightReturnNever(): never

{
Expand Down