Skip to content

Commit e68e93b

Browse files
Merge pull request #9 from DaveLiddament/bump/phpstan-2
BUMP support for PHPStan v2.
2 parents 137e895 + 0a65d47 commit e68e93b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "library",
55
"require": {
66
"php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
7-
"phpstan/phpstan": "^1.6"
7+
"phpstan/phpstan": "^1.6|^2.0"
88
},
99
"require-dev": {
1010
"phpunit/phpunit": "^9.0",

tests/Integration/NoGotoPhpstanRule.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use PhpParser\Node\Stmt\Goto_;
99
use PHPStan\Analyser\Scope;
1010
use PHPStan\Rules\Rule;
11+
use PHPStan\Rules\RuleErrorBuilder;
1112

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

2021
public function processNode(Node $node, Scope $scope): array
2122
{
22-
return ['goto statement is not allowed. Label: '.$node->name->toString()];
23+
return [
24+
RuleErrorBuilder::message('goto statement is not allowed. Label: '.$node->name->toString())
25+
->identifier('test.noGoto')
26+
->build(),
27+
];
2328
}
2429
}

0 commit comments

Comments
 (0)