Skip to content

Commit

Permalink
[Php70][Visibility] Avoid error Argument #1 ($scope) must be of type …
Browse files Browse the repository at this point in the history
…PHPStan\Analyser\Scope, null given
  • Loading branch information
samsonasik committed Nov 1, 2021
1 parent 20291b2 commit 67c4666
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ private function shouldSkip(string $methodName, string $className, StaticCall $s
}

$scope = $staticCall->getAttribute(AttributeKey::SCOPE);
if (! $scope instanceof \PHPStan\Analyser\Scope) {
return true;
}

$parentClassName = $this->parentClassScopeResolver->resolveParentClassName($scope);
return $className === $parentClassName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ public function getNodeTypes(): array
public function refactor(Node $node): ?Node
{
$scope = $node->getAttribute(AttributeKey::SCOPE);
if (! $scope instanceof \PHPStan\Analyser\Scope) {
return true;
}

$parentClassName = $this->parentClassScopeResolver->resolveParentClassName($scope);
if ($parentClassName === null) {
Expand Down

0 comments on commit 67c4666

Please sign in to comment.