Skip to content

Commit

Permalink
Fix exit() impure points
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Apr 3, 2024
1 parent a647052 commit c16e491
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Analyser/NodeScopeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -2800,7 +2800,7 @@ static function (): void {
$result = $this->processExprNode($stmt, $expr->expr, $scope, $nodeCallback, $context->enterDeep());
$hasYield = $result->hasYield();
$throwPoints = $result->getThrowPoints();
$impurePoints = $result->getImpurePoints();
$impurePoints = array_merge($impurePoints, $result->getImpurePoints());
$scope = $result->getScope();
}
} elseif ($expr instanceof Node\Scalar\Encapsed) {
Expand Down
5 changes: 5 additions & 0 deletions tests/PHPStan/Rules/DeadCode/data/noop-impure-points.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,9 @@ public function doLorem(): bool
return true;
}

public function doExit(): void
{
exit(1);
}

}

0 comments on commit c16e491

Please sign in to comment.