aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/util/gitlab.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-20 18:34:54 +0900
committernsfisis <nsfisis@gmail.com>2026-06-20 18:34:54 +0900
commit81b9fc9d92bb74aa8428ae4db39bd84e8c16095c (patch)
tree3efb6476d797e2a95545c4c3abba468c3e3c8d52 /crates/shirabe/src/util/gitlab.rs
parentc09cd630afb4bb0ca10e926f93bf706ca828ae85 (diff)
downloadphp-shirabe-81b9fc9d92bb74aa8428ae4db39bd84e8c16095c.tar.gz
php-shirabe-81b9fc9d92bb74aa8428ae4db39bd84e8c16095c.tar.zst
php-shirabe-81b9fc9d92bb74aa8428ae4db39bd84e8c16095c.zip
refactor(php-shim): drop Box wrapping from PhpMixed List/Array
The List and Array variants of PhpMixed boxed their elements unnecessarily. Store PhpMixed values directly and update all callers accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util/gitlab.rs')
-rw-r--r--crates/shirabe/src/util/gitlab.rs69
1 files changed, 22 insertions, 47 deletions
diff --git a/crates/shirabe/src/util/gitlab.rs b/crates/shirabe/src/util/gitlab.rs
index 86b7620..71ff7e3 100644
--- a/crates/shirabe/src/util/gitlab.rs
+++ b/crates/shirabe/src/util/gitlab.rs
@@ -123,10 +123,10 @@ impl GitLab {
if let Some(map) = auth_tokens.as_array() {
if let Some(t) = map.get(origin_url) {
- token = Some(*t.clone());
+ token = Some(t.clone());
}
if let Some(t) = map.get(bc_origin_url.as_str()) {
- token = Some(*t.clone());
+ token = Some(t.clone());
}
}
@@ -439,34 +439,23 @@ impl GitLab {
"",
"&",
);
- let mut http_inner: IndexMap<String, Box<PhpMixed>> = IndexMap::new();
- http_inner.insert(
- "method".to_string(),
- Box::new(PhpMixed::String("POST".to_string())),
- );
+ let mut http_inner: IndexMap<String, PhpMixed> = IndexMap::new();
+ http_inner.insert("method".to_string(), PhpMixed::String("POST".to_string()));
http_inner.insert(
"header".to_string(),
- Box::new(PhpMixed::List(
- headers
- .into_iter()
- .map(|h| Box::new(PhpMixed::String(h)))
- .collect(),
- )),
+ PhpMixed::List(headers.into_iter().map(PhpMixed::String).collect()),
);
- http_inner.insert("content".to_string(), Box::new(PhpMixed::String(data)));
- let mut options: IndexMap<String, Box<PhpMixed>> = IndexMap::new();
- options.insert(
- "retry-auth-failure".to_string(),
- Box::new(PhpMixed::Bool(false)),
- );
- options.insert("http".to_string(), Box::new(PhpMixed::Array(http_inner)));
+ http_inner.insert("content".to_string(), PhpMixed::String(data));
+ let mut options: IndexMap<String, PhpMixed> = IndexMap::new();
+ options.insert("retry-auth-failure".to_string(), PhpMixed::Bool(false));
+ options.insert("http".to_string(), PhpMixed::Array(http_inner));
let token = self
.http_downloader
.borrow_mut()
.get(
&format!("{}://{}/oauth/token", scheme, api_url),
- options.into_iter().map(|(k, v)| (k, *v)).collect(),
+ options.into_iter().collect(),
)?
.decode_json()?;
@@ -522,34 +511,23 @@ impl GitLab {
"",
"&",
);
- let mut http_inner: IndexMap<String, Box<PhpMixed>> = IndexMap::new();
- http_inner.insert(
- "method".to_string(),
- Box::new(PhpMixed::String("POST".to_string())),
- );
+ let mut http_inner = IndexMap::new();
+ http_inner.insert("method".to_string(), PhpMixed::String("POST".to_string()));
http_inner.insert(
"header".to_string(),
- Box::new(PhpMixed::List(
- headers
- .into_iter()
- .map(|h| Box::new(PhpMixed::String(h)))
- .collect(),
- )),
- );
- http_inner.insert("content".to_string(), Box::new(PhpMixed::String(data)));
- let mut options: IndexMap<String, Box<PhpMixed>> = IndexMap::new();
- options.insert(
- "retry-auth-failure".to_string(),
- Box::new(PhpMixed::Bool(false)),
+ PhpMixed::List(headers.into_iter().map(PhpMixed::String).collect()),
);
- options.insert("http".to_string(), Box::new(PhpMixed::Array(http_inner)));
+ http_inner.insert("content".to_string(), PhpMixed::String(data));
+ let mut options: IndexMap<String, PhpMixed> = IndexMap::new();
+ options.insert("retry-auth-failure".to_string(), PhpMixed::Bool(false));
+ options.insert("http".to_string(), PhpMixed::Array(http_inner));
let token = self
.http_downloader
.borrow_mut()
.get(
&format!("{}://{}/oauth/token", scheme, origin_url),
- options.into_iter().map(|(k, v)| (k, *v)).collect(),
+ options.into_iter().collect(),
)?
.decode_json()?;
@@ -587,18 +565,15 @@ impl GitLab {
.and_then(|v| v.as_string())
.unwrap_or("")
.to_string();
- let mut setting: IndexMap<String, Box<PhpMixed>> = IndexMap::new();
+ let mut setting = IndexMap::new();
setting.insert(
"expires-at".to_string(),
- Box::new(PhpMixed::Int(created_at + expires_in)),
- );
- setting.insert(
- "refresh-token".to_string(),
- Box::new(PhpMixed::String(refresh_token)),
+ PhpMixed::Int(created_at + expires_in),
);
+ setting.insert("refresh-token".to_string(), PhpMixed::String(refresh_token));
setting.insert(
"token".to_string(),
- Box::new(PhpMixed::String(access_token.to_string())),
+ PhpMixed::String(access_token.to_string()),
);
PhpMixed::Array(setting)
}