Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUMP support for PHPStan v2. #9

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
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(),
];
}
}
Loading