protected function parseLongOption(string $token, array &$remainingTokens) : array
    {
        if (mb_strpos($token, '--') !== 0) {
            throw new RuntimeException("Invalid long option \"$token\"");
        }

        // Trim the "--"
        $option = mb_substr($token, 2);

        if (mb_strpos($option, '=') === false) {
            /**
             * The option is either of the form "--foo" or "--foo bar" or "--foo -b" or "--foo --bar"
             * So, we need to determine if the option has a value
             */
            $nextToken = array_shift($remainingTokens);

            // Check if the next token is also an option
            if (mb_substr($nextToken, 0, 1) === '-' || empty($nextToken)) {
                // The option must have not had a value, so put the next token back
                array_unshift($remainingTokens, $nextToken);

                return [$option, null];
            }

            // Make it "--foo=bar"
            $option .= '=' . $nextToken;
        }

        list($name, $value) = explode('=', $option);
        $value = $this->trimQuotes($value);

        return [$name, $value];
    }