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