knownOperationNames = []; return [ NodeKind::OPERATION_DEFINITION => function(OperationDefinitionNode $node) use ($context) { $operationName = $node->name; if ($operationName) { if (!empty($this->knownOperationNames[$operationName->value])) { $context->reportError(new Error( self::duplicateOperationNameMessage($operationName->value), [ $this->knownOperationNames[$operationName->value], $operationName ] )); } else { $this->knownOperationNames[$operationName->value] = $operationName; } } return Visitor::skipNode(); }, NodeKind::FRAGMENT_DEFINITION => function() { return Visitor::skipNode(); } ]; } }