aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/plugin
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/plugin
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/plugin')
-rw-r--r--crates/shirabe/src/plugin/plugin_manager.rs17
-rw-r--r--crates/shirabe/src/plugin/pre_file_download_event.rs6
2 files changed, 9 insertions, 14 deletions
diff --git a/crates/shirabe/src/plugin/plugin_manager.rs b/crates/shirabe/src/plugin/plugin_manager.rs
index da64cee..3d9c461 100644
--- a/crates/shirabe/src/plugin/plugin_manager.rs
+++ b/crates/shirabe/src/plugin/plugin_manager.rs
@@ -900,8 +900,7 @@ impl PluginManager {
config.borrow_mut().get("allow-plugins").clone();
if let Some(arr) = allow_plugins_value.as_array() {
let mut allow_plugins = arr.clone();
- allow_plugins
- .insert(package.to_string(), Box::new(PhpMixed::Bool(allow)));
+ allow_plugins.insert(package.to_string(), PhpMixed::Bool(allow));
if config
.borrow_mut()
.get("sort-packages")
@@ -917,20 +916,16 @@ impl PluginManager {
"allow-plugins",
PhpMixed::Array(allow_plugins.clone()),
)?;
- let mut inner: IndexMap<String, Box<PhpMixed>> = IndexMap::new();
+ let mut inner = IndexMap::new();
inner.insert(
"allow-plugins".to_string(),
- Box::new(PhpMixed::Array(allow_plugins)),
+ PhpMixed::Array(allow_plugins),
);
- let mut config_section: IndexMap<String, Box<PhpMixed>> =
- IndexMap::new();
- config_section
- .insert("config".to_string(), Box::new(PhpMixed::Array(inner)));
- let wrap: IndexMap<String, PhpMixed> =
- config_section.into_iter().map(|(k, v)| (k, *v)).collect();
+ let mut config_section = IndexMap::new();
+ config_section.insert("config".to_string(), PhpMixed::Array(inner));
config
.borrow_mut()
- .merge(&wrap, crate::config::Config::SOURCE_UNKNOWN);
+ .merge(&config_section, crate::config::Config::SOURCE_UNKNOWN);
}
}
diff --git a/crates/shirabe/src/plugin/pre_file_download_event.rs b/crates/shirabe/src/plugin/pre_file_download_event.rs
index 3bf6296..0cd14d7 100644
--- a/crates/shirabe/src/plugin/pre_file_download_event.rs
+++ b/crates/shirabe/src/plugin/pre_file_download_event.rs
@@ -15,7 +15,7 @@ pub struct PreFileDownloadEvent {
custom_cache_key: Option<String>,
r#type: String,
context: PhpMixed,
- transport_options: IndexMap<String, Box<PhpMixed>>,
+ transport_options: IndexMap<String, PhpMixed>,
}
impl PreFileDownloadEvent {
@@ -69,11 +69,11 @@ impl PreFileDownloadEvent {
&self.context
}
- pub fn get_transport_options(&self) -> &IndexMap<String, Box<PhpMixed>> {
+ pub fn get_transport_options(&self) -> &IndexMap<String, PhpMixed> {
&self.transport_options
}
- pub fn set_transport_options(&mut self, options: IndexMap<String, Box<PhpMixed>>) {
+ pub fn set_transport_options(&mut self, options: IndexMap<String, PhpMixed>) {
self.transport_options = options;
}
}