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