Skip to content

Commit

Permalink
FIX test by adding returning RuleError instead of string
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveLiddament committed Dec 16, 2024
1 parent 2b59f0b commit 0a65d47
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/Integration/NoGotoPhpstanRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use PhpParser\Node\Stmt\Goto_;
use PHPStan\Analyser\Scope;
use PHPStan\Rules\Rule;
use PHPStan\Rules\RuleErrorBuilder;

/** @implements Rule<Goto_> */
final class NoGotoPhpstanRule implements Rule
Expand All @@ -19,6 +20,10 @@ public function getNodeType(): string

public function processNode(Node $node, Scope $scope): array
{
return ['goto statement is not allowed. Label: '.$node->name->toString()];
return [
RuleErrorBuilder::message('goto statement is not allowed. Label: '.$node->name->toString())
->identifier('test.noGoto')
->build(),
];
}
}

0 comments on commit 0a65d47

Please sign in to comment.