Conditions | 4 |
Paths | 1 |
Total Lines | 19 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
27 | 326 | public function getASTVisitor(ASTValidationContext $context) |
|
28 | { |
||
29 | return [ |
||
30 | 'enter' => static function (Node $node) use ($context) { |
||
31 | 326 | if (! isset($node->directives)) { |
|
32 | 326 | return; |
|
33 | } |
||
34 | |||
35 | 310 | $knownDirectives = []; |
|
36 | 310 | foreach ($node->directives as $directive) { |
|
37 | /** @var DirectiveNode $directive */ |
||
38 | 26 | $directiveName = $directive->name->value; |
|
39 | 26 | if (isset($knownDirectives[$directiveName])) { |
|
40 | 5 | $context->reportError(new Error( |
|
41 | 5 | self::duplicateDirectiveMessage($directiveName), |
|
42 | 5 | [$knownDirectives[$directiveName], $directive] |
|
43 | )); |
||
44 | } else { |
||
45 | 26 | $knownDirectives[$directiveName] = $directive; |
|
46 | } |
||
57 |