Skip to content

Commit 0bc49df

Browse files
committed
fix build
1 parent 9e8f834 commit 0bc49df

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/PHPStan/Analyser/InstanceMethodsParameterRule.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
<?php declare(strict_types = 1); // lint >= 8.0
1+
<?php declare(strict_types = 1);
22

33
namespace PHPStan\Analyser;
44

55
use PhpParser\Node;
66
use PhpParser\Node\Name\FullyQualified;
77
use PHPStan\Rules\Rule;
88
use PHPStan\Rules\RuleErrorBuilder;
9+
use PHPStan\ShouldNotHappenException;
910
use function sprintf;
1011

1112
/**
@@ -21,8 +22,12 @@ public function getNodeType(): string
2122

2223
public function processNode(Node $node, Scope $scope): array
2324
{
25+
if ($scope->getFunction() !== null) {
26+
throw new ShouldNotHappenException('All names in the tests should not have a scope function.');
27+
}
28+
2429
return [
25-
RuleErrorBuilder::message(sprintf('Name %s found in method %s', $node->toString(), $scope->getFunction()?->getName() ?? 'null'))->identifier('test.instanceOfMethodsParameterRule')->build(),
30+
RuleErrorBuilder::message(sprintf('Name %s found in method null', $node->toString()))->identifier('test.instanceOfMethodsParameterRule')->build(),
2631
];
2732
}
2833

0 commit comments

Comments
 (0)