public function key()
    {
        $key = key($this->container);
        if ($this->key_type === GPBType::BOOL) {
            // PHP associative array stores bool as integer for key.
            return boolval($key);
        } elseif ($this->key_type === GPBType::STRING) {
            // PHP associative array stores int string as int for key.
            return strval($key);
        } else {
            return $key;
        }
    }