Conditions | 6 |
Paths | 6 |
Total Lines | 28 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
24 | public function enterNode(NodeInterface $node): ?NodeInterface |
||
25 | { |
||
26 | if ($node instanceof FieldNode) { |
||
27 | $type = $this->validationContext->getType(); |
||
28 | $selectionSet = $node->getSelectionSet(); |
||
29 | |||
30 | if (null !== $type) { |
||
31 | if (getNamedType($type) instanceof LeafTypeInterface) { |
||
32 | if (null !== $selectionSet) { |
||
33 | $this->validationContext->reportError( |
||
34 | new ValidationException( |
||
35 | noSubselectionAllowedMessage((string)$node, (string)$type), |
||
36 | [$selectionSet] |
||
37 | ) |
||
38 | ); |
||
39 | } |
||
40 | } elseif (null === $selectionSet) { |
||
41 | $this->validationContext->reportError( |
||
42 | new ValidationException( |
||
43 | requiresSubselectionMessage((string)$node, (string)$type), |
||
44 | [$node] |
||
45 | ) |
||
46 | ); |
||
47 | } |
||
48 | } |
||
49 | } |
||
50 | |||
51 | return $node; |
||
52 | } |
||
54 |