| Conditions | 5 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | public function leaveNode(NodeInterface $node): ?NodeInterface |
||
| 38 | { |
||
| 39 | if ($node instanceof OperationDefinitionNode) { |
||
| 40 | $usages = $this->context->getVariableUsages($node); |
||
| 41 | |||
| 42 | foreach ($usages as ['node' => $variableNode]) { |
||
| 43 | /** @var VariableNode $variableNode */ |
||
| 44 | $variableName = $variableNode->getNameValue(); |
||
| 45 | |||
| 46 | if (!isset($this->definedVariableNames[$variableName])) { |
||
| 47 | $operationName = $node->getName(); |
||
| 48 | $this->context->reportError( |
||
| 49 | new ValidationException( |
||
| 50 | undefinedVariableMessage($variableName, $operationName ? $operationName->getValue() : null), |
||
| 51 | [$variableNode, $node] |
||
| 52 | ) |
||
| 53 | ); |
||
| 54 | } |
||
| 55 | } |
||
| 56 | } |
||
| 57 | |||
| 58 | return $node; |
||
| 59 | } |
||
| 61 |