Conditions | 5 |
Paths | 6 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
27 | public function enterNode(NodeInterface $node): ?NodeInterface |
||
28 | { |
||
29 | if ($node instanceof DocumentNode) { |
||
30 | $this->operationCount = \count(array_filter($node->getDefinitions(), function ($definition) { |
||
31 | return $definition instanceof OperationDefinitionNode; |
||
32 | })); |
||
33 | } |
||
34 | |||
35 | if ($node instanceof OperationDefinitionNode) { |
||
36 | if (null === $node->getName() && $this->operationCount > 1) { |
||
37 | $this->validationContext->reportError( |
||
38 | new ValidationException(anonymousOperationNotAloneMessage(), [$node]) |
||
39 | ); |
||
40 | } |
||
41 | } |
||
42 | |||
43 | return $node; |
||
44 | } |
||
46 |