src/Language/Parser.php
private function parseField()
    {
        $start       = $this->lexer->token;
        $nameOrAlias = $this->parseName();

        if ($this->skip(Token::COLON)) {
            $alias = $nameOrAlias;
            $name  = $this->parseName();
        } else {
            $alias = null;
            $name  = $nameOrAlias;
        }

        return new FieldNode([
            'alias'        => $alias,
            'name'         => $name,
            'arguments'    => $this->parseArguments(false),
            'directives'   => $this->parseDirectives(false),
            'selectionSet' => $this->peek(Token::BRACE_L) ? $this->parseSelectionSet() : null,
            'loc'          => $this->loc($start),
        ]);
    }
private function parseField()
    {
        $start       = $this->lexer->token;
        $nameOrAlias = $this->parseName();

        if ($this->skip(Token::COLON)) {
            $alias = $nameOrAlias;
            $name  = $this->parseName();
        } else {
            $alias = null;
            $name  = $nameOrAlias;
        }

        return new FieldNode([
            'alias'        => $alias,
            'name'         => $name,
            'arguments'    => $this->parseArguments(false),
            'directives'   => $this->parseDirectives(false),
            'selectionSet' => $this->peek(Token::BRACE_L) ? $this->parseSelectionSet() : null,
            'loc'          => $this->loc($start),
        ]);
    }
private function parseField ( ) { $ start = $ this -> lexer -> token ; $ nameOrAlias = $ this -> parseName ( ) ; if ( $ this -> skip ( Token :: COLON ) ) { $ alias = $ nameOrAlias ; $ name = $ this -> parseName ( ) ; } else { $ alias = null ; $ name = $ nameOrAlias ; } return new FieldNode ( [ 'alias' => $ alias , 'name' => $ name , 'arguments' => $ this -> parseArguments ( false ) , 'directives' => $ this -> parseDirectives ( false ) , 'selectionSet' => $ this -> peek ( Token :: BRACE_L ) ? $ this -> parseSelectionSet ( ) : null , 'loc' => $ this -> loc ( $ start ) , ] ) ; }
@return FieldNode

@throws SyntaxError
@return FieldNode