diff --git a/composer.json b/composer.json index 9705cda..0357027 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "type": "library", "require": { "php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0", - "phpstan/phpstan": "^1.6" + "phpstan/phpstan": "^1.6|^2.0" }, "require-dev": { "phpunit/phpunit": "^9.0", diff --git a/tests/Integration/NoGotoPhpstanRule.php b/tests/Integration/NoGotoPhpstanRule.php index ee4622a..f750d11 100644 --- a/tests/Integration/NoGotoPhpstanRule.php +++ b/tests/Integration/NoGotoPhpstanRule.php @@ -8,6 +8,7 @@ use PhpParser\Node\Stmt\Goto_; use PHPStan\Analyser\Scope; use PHPStan\Rules\Rule; +use PHPStan\Rules\RuleErrorBuilder; /** @implements Rule */ final class NoGotoPhpstanRule implements Rule @@ -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(), + ]; } }