public function getVisitor(ValidationContext $context)
    {
        return [
            NodeKind::OPERATION_DEFINITION => function (OperationDefinitionNode $node) use ($context) {
                if ($node->operation === 'subscription') {
                    if (count($node->selectionSet->selections) !== 1) {
                        $context->reportError(
                            new Error(
                                $this->singleFieldOnlyMessage($node->name ? $node->name->value : null),
                                array_slice($node->selectionSet->selections, 1)
                            )
                        );
                    }
                }
            }
        ];
    }
public function getVisitor(ValidationContext $context)
    {
        return [
            NodeKind::OPERATION_DEFINITION => function (OperationDefinitionNode $node) use ($context) {
                if ($node->operation === 'subscription') {
                    if (count($node->selectionSet->selections) !== 1) {
                        $context->reportError(
                            new Error(
                                $this->singleFieldOnlyMessage($node->name ? $node->name->value : null),
                                array_slice($node->selectionSet->selections, 1)
                            )
                        );
                    }
                }
            }
        ];
    }
public function getVisitor ( ValidationContext $ context ) { return [ NodeKind :: OPERATION_DEFINITION => function ( OperationDefinitionNode $ node ) use ( $ context ) { if ( $ node -> operation === 'subscription' ) { if ( count ( $ node -> selectionSet -> selections ) !== 1 ) { $ context -> reportError ( new Error ( $ this -> singleFieldOnlyMessage ( $ node -> name ? $ node -> name -> value : null ) , array_slice ( $ node -> selectionSet -> selections , 1 ) ) ) ; } } } ] ; }
Returns structure suitable for GraphQL\Language\Visitor

@see \GraphQL\Language\Visitor
@param ValidationContext $context
@return array
Returns structure suitable for GraphQL \ Language \ Visitor