aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/io/base_io.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/io/base_io.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/io/base_io.rs')
-rw-r--r--crates/shirabe/src/io/base_io.rs40
1 files changed, 19 insertions, 21 deletions
diff --git a/crates/shirabe/src/io/base_io.rs b/crates/shirabe/src/io/base_io.rs
index f8e4d32..99c3d70 100644
--- a/crates/shirabe/src/io/base_io.rs
+++ b/crates/shirabe/src/io/base_io.rs
@@ -13,10 +13,10 @@ use shirabe_php_shim::{
UnexpectedValueException, array_merge, in_array, json_encode_ex,
};
-fn log_context(context: &[(&str, &str)]) -> IndexMap<String, Box<PhpMixed>> {
+fn log_context(context: &[(&str, &str)]) -> IndexMap<String, PhpMixed> {
context
.iter()
- .map(|(k, v)| (k.to_string(), Box::new(PhpMixed::String(v.to_string()))))
+ .map(|(k, v)| (k.to_string(), PhpMixed::String(v.to_string())))
.collect()
}
@@ -132,11 +132,11 @@ pub trait BaseIO: IOInterface {
);
let merged = array_merge(
github_domains.unwrap_or(PhpMixed::List(vec![])),
- PhpMixed::List(vec![Box::new(PhpMixed::String(domain.clone()))]),
+ PhpMixed::List(vec![PhpMixed::String(domain.clone())]),
);
let mut inner = IndexMap::new();
- inner.insert("github-domains".to_string(), Box::new(merged));
- let mut config_outer: IndexMap<String, PhpMixed> = IndexMap::new();
+ inner.insert("github-domains".to_string(), merged);
+ let mut config_outer = IndexMap::new();
config_outer.insert("config".to_string(), PhpMixed::Array(inner));
config.merge(&config_outer, "implicit-due-to-auth");
}
@@ -178,10 +178,10 @@ pub trait BaseIO: IOInterface {
);
let merged = array_merge(
gitlab_domains.unwrap_or(PhpMixed::List(vec![])),
- PhpMixed::List(vec![Box::new(PhpMixed::String(domain.clone()))]),
+ PhpMixed::List(vec![PhpMixed::String(domain.clone())]),
);
let mut inner = IndexMap::new();
- inner.insert("gitlab-domains".to_string(), Box::new(merged));
+ inner.insert("gitlab-domains".to_string(), merged);
let mut config_outer: IndexMap<String, PhpMixed> = IndexMap::new();
config_outer.insert("config".to_string(), PhpMixed::Array(inner));
config.merge(&config_outer, "implicit-due-to-auth");
@@ -219,10 +219,10 @@ pub trait BaseIO: IOInterface {
);
let merged = array_merge(
gitlab_domains.unwrap_or(PhpMixed::List(vec![])),
- PhpMixed::List(vec![Box::new(PhpMixed::String(domain.clone()))]),
+ PhpMixed::List(vec![PhpMixed::String(domain.clone())]),
);
let mut inner = IndexMap::new();
- inner.insert("gitlab-domains".to_string(), Box::new(merged));
+ inner.insert("gitlab-domains".to_string(), merged);
let mut config_outer: IndexMap<String, PhpMixed> = IndexMap::new();
config_outer.insert("config".to_string(), PhpMixed::Array(inner));
config.merge(&config_outer, "implicit-due-to-auth");
@@ -267,10 +267,10 @@ pub trait BaseIO: IOInterface {
);
let merged = array_merge(
forgejo_domains.unwrap_or(PhpMixed::List(vec![])),
- PhpMixed::List(vec![Box::new(PhpMixed::String(domain.clone()))]),
+ PhpMixed::List(vec![PhpMixed::String(domain.clone())]),
);
let mut inner = IndexMap::new();
- inner.insert("forgejo-domains".to_string(), Box::new(merged));
+ inner.insert("forgejo-domains".to_string(), merged);
let mut config_outer: IndexMap<String, PhpMixed> = IndexMap::new();
config_outer.insert("config".to_string(), PhpMixed::Array(inner));
config.merge(&config_outer, "implicit-due-to-auth");
@@ -344,17 +344,15 @@ pub trait BaseIO: IOInterface {
.and_then(|v| v.as_string())
.map(|s| s.to_string());
- let mut ssl_options: IndexMap<String, Box<PhpMixed>> = IndexMap::new();
+ let mut ssl_options = IndexMap::new();
if let Some(cert) = local_cert {
- ssl_options
- .insert("local_cert".to_string(), Box::new(PhpMixed::String(cert)));
+ ssl_options.insert("local_cert".to_string(), PhpMixed::String(cert));
}
if let Some(pk) = local_pk {
- ssl_options.insert("local_pk".to_string(), Box::new(PhpMixed::String(pk)));
+ ssl_options.insert("local_pk".to_string(), PhpMixed::String(pk));
}
if let Some(pass) = passphrase {
- ssl_options
- .insert("passphrase".to_string(), Box::new(PhpMixed::String(pass)));
+ ssl_options.insert("passphrase".to_string(), PhpMixed::String(pass));
}
if !ssl_options.contains_key("local_cert") {
@@ -465,10 +463,10 @@ pub trait BaseIO: IOInterface {
if in_array(
level.clone(),
&PhpMixed::List(vec![
- Box::new(PhpMixed::String(LogLevel::EMERGENCY.to_string())),
- Box::new(PhpMixed::String(LogLevel::ALERT.to_string())),
- Box::new(PhpMixed::String(LogLevel::CRITICAL.to_string())),
- Box::new(PhpMixed::String(LogLevel::ERROR.to_string())),
+ PhpMixed::String(LogLevel::EMERGENCY.to_string()),
+ PhpMixed::String(LogLevel::ALERT.to_string()),
+ PhpMixed::String(LogLevel::CRITICAL.to_string()),
+ PhpMixed::String(LogLevel::ERROR.to_string()),
]),
false,
) {