public function nextIfType(string $type, $value = null): bool
    {
        $currentToken = $this->getCurrent();
        $typeMatches = $currentToken !== null && $currentToken->type === $type;

        if ($typeMatches && ($value === null || $currentToken->value === $value)) {
            $this->next();

            return true;
        }

        return false;
    }
public function nextIfType(string $type, $value = null): bool
    {
        $currentToken = $this->getCurrent();
        $typeMatches = $currentToken !== null && $currentToken->type === $type;

        if ($typeMatches && ($value === null || $currentToken->value === $value)) {
            $this->next();

            return true;
        }

        return false;
    }
public function nextIfType ( string $ type , $ value = null ) : bool { $ currentToken = $ this -> getCurrent ( ) ; $ typeMatches = $ currentToken !== null && $ currentToken -> type === $ type ; if ( $ typeMatches && ( $ value === null || $ currentToken -> value === $ value ) ) { $ this -> next ( ) ; return true ; } return false ; }
Gets the next token if the current one matches the input type, and optionally performs a value check

@param string $type The type to check for
@param mixed $value The optional value to match against
@return bool True if the current token is of the input type, otherwise false
Gets the next token if the current one matches the input type and optionally performs a value check