GraphQL\Language\Parser::parseDirectiveDefinition PHP Method

parseDirectiveDefinition() public method

DirectiveDefinition : - directive @ Name ArgumentsDefinition? on DirectiveLocations
public parseDirectiveDefinition ( ) : DirectiveDefinitionNode
return GraphQL\Language\AST\DirectiveDefinitionNode
    function parseDirectiveDefinition()
    {
        $start = $this->lexer->token;
        $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)]);
    }