Skip to content

Commit 13e513f

Browse files
phpstan-botclaude
andcommitted
Add scope parameter to InternalThrowPoint::createFromPublic instead of replaceScope
Make the $scope parameter required (non-nullable) since it is always provided at the only call site. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 323d155 commit 13e513f

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

src/Analyser/InternalThrowPoint.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace PHPStan\Analyser;
44

55
use PhpParser\Node;
6-
use PHPStan\ShouldNotHappenException;
76
use PHPStan\Type\ObjectType;
87
use PHPStan\Type\Type;
98
use PHPStan\Type\TypeCombinator;
@@ -50,15 +49,8 @@ public static function createImplicit(MutatingScope $scope, Node $node): self
5049
return new self($scope, new ObjectType(Throwable::class), $node, explicit: false, canContainAnyThrowable: true);
5150
}
5251

53-
public static function createFromPublic(ThrowPoint $throwPoint, ?MutatingScope $scope = null): self
52+
public static function createFromPublic(ThrowPoint $throwPoint, MutatingScope $scope): self
5453
{
55-
if ($scope === null) {
56-
$scope = $throwPoint->getScope();
57-
if (!$scope instanceof MutatingScope) {
58-
throw new ShouldNotHappenException();
59-
}
60-
}
61-
6254
return new self($scope, $throwPoint->getType(), $throwPoint->getNode(), $throwPoint->isExplicit(), $throwPoint->canContainAnyThrowable());
6355
}
6456

0 commit comments

Comments
 (0)