aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/command/licenses_command.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/command/licenses_command.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/command/licenses_command.rs')
-rw-r--r--crates/shirabe/src/command/licenses_command.rs56
1 files changed, 15 insertions, 41 deletions
diff --git a/crates/shirabe/src/command/licenses_command.rs b/crates/shirabe/src/command/licenses_command.rs
index 1f054d1..46cbd02 100644
--- a/crates/shirabe/src/command/licenses_command.rs
+++ b/crates/shirabe/src/command/licenses_command.rs
@@ -226,19 +226,18 @@ impl Command for LicensesCommand {
pkg_licenses.join(", ")
};
table.add_row(PhpMixed::List(vec![
- Box::new(PhpMixed::String(name)),
- Box::new(PhpMixed::String(package.get_full_pretty_version(
+ PhpMixed::String(name),
+ PhpMixed::String(package.get_full_pretty_version(
true,
crate::package::DisplayMode::SourceRefIfDev,
- ))),
- Box::new(PhpMixed::String(licenses_str)),
+ )),
+ PhpMixed::String(licenses_str),
]));
}
table.render();
}
"json" => {
- let mut dependencies: IndexMap<String, IndexMap<String, PhpMixed>> =
- IndexMap::new();
+ let mut dependencies: IndexMap<String, PhpMixed> = IndexMap::new();
for package in &packages {
let pkg_licenses = if let Some(complete_pkg) = package.as_complete_package() {
complete_pkg.get_license()
@@ -255,14 +254,12 @@ impl Command for LicensesCommand {
);
dep_info.insert(
"license".to_string(),
- PhpMixed::List(
- pkg_licenses
- .into_iter()
- .map(|l| Box::new(PhpMixed::String(l)))
- .collect(),
- ),
+ PhpMixed::List(pkg_licenses.into_iter().map(PhpMixed::String).collect()),
+ );
+ dependencies.insert(
+ package.get_pretty_name().to_string(),
+ PhpMixed::Array(dep_info),
);
- dependencies.insert(package.get_pretty_name().to_string(), dep_info);
}
let mut output_map: IndexMap<String, PhpMixed> = IndexMap::new();
@@ -283,34 +280,11 @@ impl Command for LicensesCommand {
let root_licenses = root.get_license();
output_map.insert(
"license".to_string(),
- PhpMixed::List(
- root_licenses
- .into_iter()
- .map(|l| Box::new(PhpMixed::String(l)))
- .collect(),
- ),
- );
- output_map.insert(
- "dependencies".to_string(),
- PhpMixed::Array(
- dependencies
- .into_iter()
- .map(|(k, v)| {
- (
- k,
- Box::new(PhpMixed::Array(
- v.into_iter().map(|(k2, v2)| (k2, Box::new(v2))).collect(),
- )),
- )
- })
- .collect(),
- ),
+ PhpMixed::List(root_licenses.into_iter().map(PhpMixed::String).collect()),
);
+ output_map.insert("dependencies".to_string(), PhpMixed::Array(dependencies));
io.write(&JsonFile::encode(&PhpMixed::Array(
- output_map
- .into_iter()
- .map(|(k, v)| (k, Box::new(v)))
- .collect(),
+ output_map.into_iter().collect(),
)));
}
"summary" => {
@@ -336,8 +310,8 @@ impl Command for LicensesCommand {
.iter()
.map(|(license, count)| {
PhpMixed::List(vec![
- Box::new(PhpMixed::String(license.clone())),
- Box::new(PhpMixed::String(count.to_string())),
+ PhpMixed::String(license.clone()),
+ PhpMixed::String(count.to_string()),
])
})
.collect();