99use PhpParser \Node \Identifier ;
1010use PHPStan \Analyser \Scope ;
1111use PHPStan \Rules \Rule ;
12- use PHPStan \Rules \RuleError ;
1312use PHPStan \Rules \RuleErrorBuilder ;
13+ use Symplify \PHPStanRules \Enum \RuleIdentifier ;
1414
1515/**
16- * Check if abstract controller has constructor, as it should use
17- * #[Require] instead to avoid parent constructor override
18- *
19- * @see \Symplify\PHPStanRules\Tests\PHPStan\Rule\NoGetRepositoryOutsideServiceRule\NoGetRepositoryOutsideServiceRuleTest
16+ * @see \Symplify\PHPStanRules\Tests\Rules\Doctrine\NoGetRepositoryOutsideServiceRule\NoGetRepositoryOutsideServiceRuleTest
2017 *
2118 * @implements Rule<MethodCall>
2219 */
@@ -34,7 +31,6 @@ public function getNodeType(): string
3431
3532 /**
3633 * @param MethodCall $node
37- * @return RuleError[]
3834 */
3935 public function processNode (Node $ node , Scope $ scope ): array
4036 {
@@ -47,7 +43,10 @@ public function processNode(Node $node, Scope $scope): array
4743 }
4844
4945 if (! $ scope ->isInClass ()) {
50- $ ruleError = RuleErrorBuilder::message (self ::ERROR_MESSAGE )->build ();
46+ $ ruleError = RuleErrorBuilder::message (self ::ERROR_MESSAGE )
47+ ->identifier (RuleIdentifier::DOCTRINE_NO_GET_REPOSITORY_OUTSIDE_SERVICE )
48+ ->build ();
49+
5150 return [$ ruleError ];
5251 }
5352
@@ -57,7 +56,10 @@ public function processNode(Node $node, Scope $scope): array
5756 return [];
5857 }
5958
60- $ ruleError = RuleErrorBuilder::message (self ::ERROR_MESSAGE )->build ();
59+ $ ruleError = RuleErrorBuilder::message (self ::ERROR_MESSAGE )
60+ ->identifier (RuleIdentifier::DOCTRINE_NO_GET_REPOSITORY_OUTSIDE_SERVICE )
61+ ->build ();
62+
6163 return [$ ruleError ];
6264 }
6365}
0 commit comments