Skip to content

Commit

Permalink
Merge pull request #9 from DaveLiddament/bump/phpstan-2
Browse files Browse the repository at this point in the history
BUMP support for PHPStan v2.
  • Loading branch information
DaveLiddament authored Dec 16, 2024
2 parents 137e895 + 0a65d47 commit e68e93b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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(),
];
}
}

0 comments on commit e68e93b

Please sign in to comment.