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) --- .../src/style/style_interface.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'crates/shirabe-symfony-console/src/style/style_interface.rs') diff --git a/crates/shirabe-symfony-console/src/style/style_interface.rs b/crates/shirabe-symfony-console/src/style/style_interface.rs index 96745de1..14c7ba86 100644 --- a/crates/shirabe-symfony-console/src/style/style_interface.rs +++ b/crates/shirabe-symfony-console/src/style/style_interface.rs @@ -1,5 +1,7 @@ //! ref: composer/vendor/symfony/console/Style/StyleInterface.php +use crate::helper::Cell; +use crate::helper::Row; use shirabe_php_shim::PhpMixed; /// Output style helpers. @@ -11,28 +13,28 @@ pub trait StyleInterface { fn section(&mut self, message: &str); /// Formats a list. - fn listing(&mut self, elements: Vec); + fn listing(&mut self, elements: &[String]); /// Formats informational text. - fn text(&mut self, message: PhpMixed); + fn text(&mut self, message: &[String]); /// Formats a success result bar. - fn success(&mut self, message: PhpMixed); + fn success(&mut self, message: &[String]); /// Formats an error result bar. - fn error(&mut self, message: PhpMixed); + fn error(&mut self, message: &[String]); /// Formats an warning result bar. - fn warning(&mut self, message: PhpMixed); + fn warning(&mut self, message: &[String]); /// Formats a note admonition. - fn note(&mut self, message: PhpMixed); + fn note(&mut self, message: &[String]); /// Formats a caution admonition. - fn caution(&mut self, message: PhpMixed); + fn caution(&mut self, message: &[String]); /// Formats a table. - fn table(&mut self, headers: Vec, rows: Vec); + fn table(&mut self, headers: Vec, rows: Vec); /// Asks a question. fn ask( @@ -56,7 +58,7 @@ pub trait StyleInterface { fn choice( &mut self, question: &str, - choices: Vec, + choices: Vec, default: Option, ) -> PhpMixed; -- cgit v1.3.1-4-g156e