src/Language/Parser.php
private function parseDirectiveDefinition()
    {
        $start       = $this->lexer->token;
        $description = $this->parseDescription();
        $this->expectKeyword('directive');
        $this->expect(Token::AT);
        $name = $this->parseName();
        $args = $this->parseArgumentDefs();
        $this->expectKeyword('on');
        $locations = $this->parseDirectiveLocations();

        return new DirectiveDefinitionNode([
            'name'        => $name,
            'arguments'   => $args,
            'locations'   => $locations,
            'loc'         => $this->loc($start),
            'description' => $description,
        ]);
    }
private function parseDirectiveDefinition()
    {
        $start       = $this->lexer->token;
        $description = $this->parseDescription();
        $this->expectKeyword('directive');
        $this->expect(Token::AT);
        $name = $this->parseName();
        $args = $this->parseArgumentDefs();
        $this->expectKeyword('on');
        $locations = $this->parseDirectiveLocations();

        return new DirectiveDefinitionNode([
            'name'        => $name,
            'arguments'   => $args,
            'locations'   => $locations,
            'loc'         => $this->loc($start),
            'description' => $description,
        ]);
    }
DirectiveDefinition :
- directive @ Name ArgumentsDefinition? on DirectiveLocations

@return DirectiveDefinitionNode

@throws SyntaxError