From 05c38483041fb416ae1293a6579bb7c49b4e6954 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 16 Aug 2026 09:27:35 +0900 Subject: refactor(style): type SymfonyStyle messages as strings and cells SymfonyStyle modelled PHP's string|array message parameters, its array of listing elements and its table headers/rows as PhpMixed, then normalised and stringified them at every entry point. Take &[String] for the message and listing parameters, Vec/Vec for table (matching the horizontal_table signature) and Vec for the choice options, so the is_array/is_iterable normalisation and the php_string helper both go away. PhpMixed stays where PHP is genuinely mixed: the question answers returned by ask/ask_hidden/choice, their validators, choice's string|int|null default, and the progress_iterate elements. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/src/command/licenses_command.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'crates/shirabe') diff --git a/crates/shirabe/src/command/licenses_command.rs b/crates/shirabe/src/command/licenses_command.rs index 653987bf..4087e6e3 100644 --- a/crates/shirabe/src/command/licenses_command.rs +++ b/crates/shirabe/src/command/licenses_command.rs @@ -16,6 +16,7 @@ use indexmap::IndexMap; use shirabe_php_shim::{PhpMixed, RuntimeException, UnexpectedValueException, impl_php_class}; use shirabe_symfony_console::command::Command; use shirabe_symfony_console::formatter::OutputFormatter; +use shirabe_symfony_console::helper::Row; use shirabe_symfony_console::helper::Table; use shirabe_symfony_console::input::InputInterface; use shirabe_symfony_console::output::OutputInterface; @@ -291,22 +292,16 @@ impl Command for LicensesCommand { let mut entries: Vec<(String, i64)> = used_licenses.into_iter().collect(); entries.sort_by(|a, b| b.1.cmp(&a.1)); - let rows: Vec = entries + let rows: Vec = entries .iter() .map(|(license, count)| { - PhpMixed::List(vec![ - PhpMixed::String(license.clone()), - PhpMixed::String(count.to_string()), - ]) + Row::Cells(vec![license.clone().into(), count.to_string().into()]) }) .collect(); let mut symfony_io = SymfonyStyle::new(input, output); symfony_io.table( - vec![ - PhpMixed::String("License".to_string()), - PhpMixed::String("Number of dependencies".to_string()), - ], + vec!["License".into(), "Number of dependencies".into()], rows, ); } -- cgit v1.3.1-4-g156e