From 9d9da0d1512202af7802d13b1c3c33a1a077a84e Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 10 Aug 2026 04:38:35 +0900 Subject: refactor(symfony): hide leaf modules behind their parent re-exports Every parent module in the symfony-* crates already re-exported its leaf modules with `pub use`, so each item was reachable by two paths. Make the leaf modules private and route all callers through the single re-exported path. Co-Authored-By: Claude Opus 5 (1M context) --- .../src/helper/debug_formatter_helper.rs | 6 ++--- .../src/helper/descriptor_helper.rs | 20 ++++++++--------- .../src/helper/formatter_helper.rs | 8 +++---- .../shirabe-symfony-console/src/helper/helper.rs | 4 ++-- .../src/helper/helper_interface.rs | 2 +- .../src/helper/helper_set.rs | 10 ++++----- .../src/helper/process_helper.rs | 16 ++++++------- .../src/helper/progress_bar.rs | 6 ++--- .../src/helper/question_helper.rs | 26 +++++++++++----------- .../src/helper/symfony_question_helper.rs | 10 ++++----- crates/shirabe-symfony-console/src/helper/table.rs | 17 +++++++------- .../src/helper/table_cell.rs | 4 ++-- .../src/helper/table_cell_style.rs | 2 +- .../src/helper/table_rows.rs | 2 +- .../src/helper/table_separator.rs | 8 +++---- 15 files changed, 69 insertions(+), 72 deletions(-) (limited to 'crates/shirabe-symfony-console/src/helper') diff --git a/crates/shirabe-symfony-console/src/helper/debug_formatter_helper.rs b/crates/shirabe-symfony-console/src/helper/debug_formatter_helper.rs index f7fd2157..ac5d1c47 100644 --- a/crates/shirabe-symfony-console/src/helper/debug_formatter_helper.rs +++ b/crates/shirabe-symfony-console/src/helper/debug_formatter_helper.rs @@ -1,8 +1,8 @@ //! ref: composer/vendor/symfony/console/Helper/DebugFormatterHelper.php -use crate::helper::helper::Helper; -use crate::helper::helper_interface::HelperInterface; -use crate::helper::helper_set::HelperSet; +use crate::helper::Helper; +use crate::helper::HelperInterface; +use crate::helper::HelperSet; use indexmap::IndexMap; const COLORS: [&str; 9] = [ diff --git a/crates/shirabe-symfony-console/src/helper/descriptor_helper.rs b/crates/shirabe-symfony-console/src/helper/descriptor_helper.rs index 23bb4f66..4ab5a93a 100644 --- a/crates/shirabe-symfony-console/src/helper/descriptor_helper.rs +++ b/crates/shirabe-symfony-console/src/helper/descriptor_helper.rs @@ -1,15 +1,15 @@ //! ref: composer/vendor/symfony/console/Helper/DescriptorHelper.php -use crate::descriptor::descriptor_interface::{DescribableObject, DescriptorInterface}; -use crate::descriptor::json_descriptor::JsonDescriptor; -use crate::descriptor::markdown_descriptor::MarkdownDescriptor; -use crate::descriptor::text_descriptor::TextDescriptor; -use crate::descriptor::xml_descriptor::XmlDescriptor; -use crate::exception::invalid_argument_exception::InvalidArgumentException; -use crate::helper::helper::Helper; -use crate::helper::helper_interface::HelperInterface; -use crate::helper::helper_set::HelperSet; -use crate::output::output_interface::OutputInterface; +use crate::descriptor::JsonDescriptor; +use crate::descriptor::MarkdownDescriptor; +use crate::descriptor::TextDescriptor; +use crate::descriptor::XmlDescriptor; +use crate::descriptor::{DescribableObject, DescriptorInterface}; +use crate::exception::InvalidArgumentException; +use crate::helper::Helper; +use crate::helper::HelperInterface; +use crate::helper::HelperSet; +use crate::output::OutputInterface; use indexmap::IndexMap; /// This class adds helper method to describe objects in various formats. diff --git a/crates/shirabe-symfony-console/src/helper/formatter_helper.rs b/crates/shirabe-symfony-console/src/helper/formatter_helper.rs index f4e1b643..546e0da2 100644 --- a/crates/shirabe-symfony-console/src/helper/formatter_helper.rs +++ b/crates/shirabe-symfony-console/src/helper/formatter_helper.rs @@ -1,9 +1,9 @@ //! ref: composer/vendor/symfony/console/Helper/FormatterHelper.php -use crate::formatter::output_formatter::OutputFormatter; -use crate::helper::helper::Helper; -use crate::helper::helper_interface::HelperInterface; -use crate::helper::helper_set::HelperSet; +use crate::formatter::OutputFormatter; +use crate::helper::Helper; +use crate::helper::HelperInterface; +use crate::helper::HelperSet; /// The Formatter class provides helpers to format messages. #[derive(Debug, Default)] diff --git a/crates/shirabe-symfony-console/src/helper/helper.rs b/crates/shirabe-symfony-console/src/helper/helper.rs index 0af2830f..c92b7cb1 100644 --- a/crates/shirabe-symfony-console/src/helper/helper.rs +++ b/crates/shirabe-symfony-console/src/helper/helper.rs @@ -1,7 +1,7 @@ //! ref: composer/vendor/symfony/console/Helper/Helper.php -use crate::formatter::output_formatter_interface::OutputFormatterInterface; -use crate::helper::helper_set::HelperSet; +use crate::formatter::OutputFormatterInterface; +use crate::helper::HelperSet; use shirabe_php_shim::php_regex; use shirabe_symfony_string::unicode_string::UnicodeString; diff --git a/crates/shirabe-symfony-console/src/helper/helper_interface.rs b/crates/shirabe-symfony-console/src/helper/helper_interface.rs index 41c0b680..9615dfa2 100644 --- a/crates/shirabe-symfony-console/src/helper/helper_interface.rs +++ b/crates/shirabe-symfony-console/src/helper/helper_interface.rs @@ -1,6 +1,6 @@ //! ref: composer/vendor/symfony/console/Helper/HelperInterface.php -use crate::helper::helper_set::HelperSet; +use crate::helper::HelperSet; /// HelperInterface is the interface all helpers must implement. pub trait HelperInterface: std::fmt::Debug + shirabe_php_shim::AsAny { diff --git a/crates/shirabe-symfony-console/src/helper/helper_set.rs b/crates/shirabe-symfony-console/src/helper/helper_set.rs index bf64f8b2..6726a4f1 100644 --- a/crates/shirabe-symfony-console/src/helper/helper_set.rs +++ b/crates/shirabe-symfony-console/src/helper/helper_set.rs @@ -1,10 +1,10 @@ //! ref: composer/vendor/symfony/console/Helper/HelperSet.php -use crate::helper::debug_formatter_helper::DebugFormatterHelper; -use crate::helper::formatter_helper::FormatterHelper; -use crate::helper::helper_interface::HelperInterface; -use crate::helper::process_helper::ProcessHelper; -use crate::helper::question_helper::QuestionHelper; +use crate::helper::DebugFormatterHelper; +use crate::helper::FormatterHelper; +use crate::helper::HelperInterface; +use crate::helper::ProcessHelper; +use crate::helper::QuestionHelper; /// HelperSet represents a set of helpers to be used with a command. /// diff --git a/crates/shirabe-symfony-console/src/helper/process_helper.rs b/crates/shirabe-symfony-console/src/helper/process_helper.rs index be1c1a84..e0e94c47 100644 --- a/crates/shirabe-symfony-console/src/helper/process_helper.rs +++ b/crates/shirabe-symfony-console/src/helper/process_helper.rs @@ -1,12 +1,12 @@ //! ref: composer/vendor/symfony/console/Helper/ProcessHelper.php -use crate::helper::debug_formatter_helper::DebugFormatterHelper; -use crate::helper::helper::Helper; -use crate::helper::helper_interface::HelperInterface; -use crate::helper::helper_set::HelperSet; +use crate::helper::DebugFormatterHelper; +use crate::helper::Helper; +use crate::helper::HelperInterface; +use crate::helper::HelperSet; use crate::output::ConsoleOutputInterface; -use crate::output::output_interface::{self, OutputInterface}; -use shirabe_symfony_process::exception::process_failed_exception::ProcessFailedException; +use crate::output::{OutputInterface, output_interface}; +use shirabe_symfony_process::exception::ProcessFailedException; use shirabe_symfony_process::process::Process; /// The ProcessHelper class provides helpers to run external processes. @@ -54,7 +54,7 @@ impl ProcessHelper { // reduces to a downcast to the concrete type. let output: std::rc::Rc> = { let redirected = shirabe_php_shim::AsAny::as_any(&*output.borrow()) - .downcast_ref::() + .downcast_ref::() .map(|console| console.get_error_output()); redirected.unwrap_or(output) }; @@ -228,7 +228,7 @@ impl ProcessHelper { // reduces to a downcast to the concrete type. let output: std::rc::Rc> = { let redirected = shirabe_php_shim::AsAny::as_any(&*output.borrow()) - .downcast_ref::() + .downcast_ref::() .map(|console| console.get_error_output()); redirected.unwrap_or(output) }; diff --git a/crates/shirabe-symfony-console/src/helper/progress_bar.rs b/crates/shirabe-symfony-console/src/helper/progress_bar.rs index 44e144cf..b0124419 100644 --- a/crates/shirabe-symfony-console/src/helper/progress_bar.rs +++ b/crates/shirabe-symfony-console/src/helper/progress_bar.rs @@ -1,8 +1,8 @@ //! ref: composer/vendor/symfony/console/Helper/ProgressBar.php use crate::cursor::Cursor; -use crate::exception::logic_exception::LogicException; -use crate::helper::helper::Helper; +use crate::exception::LogicException; +use crate::helper::Helper; use crate::output::ConsoleOutputInterface; use crate::output::ConsoleSectionOutput; use crate::output::OutputInterface; @@ -73,7 +73,7 @@ impl ProgressBar { // reduces to a downcast to the concrete type. let output: std::rc::Rc> = { let redirected = shirabe_php_shim::AsAny::as_any(&*output.borrow()) - .downcast_ref::() + .downcast_ref::() .map(|console| console.get_error_output()); redirected.unwrap_or(output) }; diff --git a/crates/shirabe-symfony-console/src/helper/question_helper.rs b/crates/shirabe-symfony-console/src/helper/question_helper.rs index 6ee83702..662edf40 100644 --- a/crates/shirabe-symfony-console/src/helper/question_helper.rs +++ b/crates/shirabe-symfony-console/src/helper/question_helper.rs @@ -1,20 +1,20 @@ //! ref: composer/vendor/symfony/console/Helper/QuestionHelper.php use crate::cursor::Cursor; -use crate::exception::missing_input_exception::MissingInputException; -use crate::exception::runtime_exception::RuntimeException; -use crate::formatter::output_formatter::OutputFormatter; -use crate::formatter::output_formatter_style::OutputFormatterStyle; -use crate::helper::formatter_helper::FormatBlockMessages; -use crate::helper::helper::Helper; -use crate::helper::helper_interface::HelperInterface; -use crate::helper::helper_set::HelperSet; -use crate::input::input_interface::InputInterface; -use crate::output::console_output::ConsoleOutput; -use crate::output::console_output_interface::ConsoleOutputInterface; -use crate::output::console_section_output::ConsoleSectionOutput; +use crate::exception::MissingInputException; +use crate::exception::RuntimeException; +use crate::formatter::OutputFormatter; +use crate::formatter::OutputFormatterStyle; +use crate::helper::FormatBlockMessages; +use crate::helper::Helper; +use crate::helper::HelperInterface; +use crate::helper::HelperSet; +use crate::input::InputInterface; +use crate::output::ConsoleOutput; +use crate::output::ConsoleOutputInterface; +use crate::output::ConsoleSectionOutput; +use crate::output::OutputInterface; use crate::output::output_interface; -use crate::output::output_interface::OutputInterface; use crate::question::ChoiceQuestion; use crate::question::QuestionInterface; use crate::terminal::Terminal; diff --git a/crates/shirabe-symfony-console/src/helper/symfony_question_helper.rs b/crates/shirabe-symfony-console/src/helper/symfony_question_helper.rs index 9de40dd4..5b4b3ba0 100644 --- a/crates/shirabe-symfony-console/src/helper/symfony_question_helper.rs +++ b/crates/shirabe-symfony-console/src/helper/symfony_question_helper.rs @@ -1,12 +1,12 @@ //! ref: composer/vendor/symfony/console/Helper/SymfonyQuestionHelper.php -use crate::formatter::output_formatter::OutputFormatter; -use crate::helper::question_helper::{QuestionHelper, QuestionHelperInterface}; +use crate::formatter::OutputFormatter; +use crate::helper::{QuestionHelper, QuestionHelperInterface}; +use crate::output::OutputInterface; use crate::output::output_interface; -use crate::output::output_interface::OutputInterface; use crate::question::QuestionInterface; -use crate::style::style_interface::StyleInterface; -use crate::style::symfony_style::SymfonyStyle; +use crate::style::StyleInterface; +use crate::style::SymfonyStyle; use shirabe_php_shim::PhpMixed; use std::ops::{Deref, DerefMut}; diff --git a/crates/shirabe-symfony-console/src/helper/table.rs b/crates/shirabe-symfony-console/src/helper/table.rs index 8f82c357..177e23c0 100644 --- a/crates/shirabe-symfony-console/src/helper/table.rs +++ b/crates/shirabe-symfony-console/src/helper/table.rs @@ -1,12 +1,12 @@ //! ref: composer/vendor/symfony/console/Helper/Table.php -use crate::exception::invalid_argument_exception::InvalidArgumentException; -use crate::formatter::output_formatter::OutputFormatter; -use crate::formatter::wrappable_output_formatter_interface::WrappableOutputFormatterInterface; +use crate::exception::InvalidArgumentException; +use crate::formatter::OutputFormatter; +use crate::formatter::WrappableOutputFormatterInterface; use crate::helper::{ Helper, TableCell, TableCellOption, TableCellStyle, TableRows, TableSeparator, TableStyle, }; -use crate::output::output_interface::OutputInterface; +use crate::output::OutputInterface; use indexmap::IndexMap; use shirabe_pcre::preg::Preg; use shirabe_php_shim::{PhpMixed, php_regex}; @@ -568,7 +568,7 @@ impl Table { &self.style.get_border_format(), &[PhpMixed::from(markup)], )], - crate::output::output_interface::OUTPUT_NORMAL, + crate::output::OUTPUT_NORMAL, ); } @@ -608,10 +608,9 @@ impl Table { BORDER_INSIDE })); } - self.output.borrow().writeln( - &[row_content], - crate::output::output_interface::OUTPUT_NORMAL, - ); + self.output + .borrow() + .writeln(&[row_content], crate::output::OUTPUT_NORMAL); } /// Renders table cell with padding. diff --git a/crates/shirabe-symfony-console/src/helper/table_cell.rs b/crates/shirabe-symfony-console/src/helper/table_cell.rs index 100872ca..fdcda7b8 100644 --- a/crates/shirabe-symfony-console/src/helper/table_cell.rs +++ b/crates/shirabe-symfony-console/src/helper/table_cell.rs @@ -1,7 +1,7 @@ //! ref: composer/vendor/symfony/console/Helper/TableCell.php -use crate::exception::invalid_argument_exception::InvalidArgumentException; -use crate::helper::table_cell_style::TableCellStyle; +use crate::exception::InvalidArgumentException; +use crate::helper::TableCellStyle; use indexmap::IndexMap; /// A `TableCell` option value: an integer span, a `TableCellStyle`, or null. diff --git a/crates/shirabe-symfony-console/src/helper/table_cell_style.rs b/crates/shirabe-symfony-console/src/helper/table_cell_style.rs index 6f0d6b5c..3a95e2ce 100644 --- a/crates/shirabe-symfony-console/src/helper/table_cell_style.rs +++ b/crates/shirabe-symfony-console/src/helper/table_cell_style.rs @@ -1,6 +1,6 @@ //! ref: composer/vendor/symfony/console/Helper/TableCellStyle.php -use crate::exception::invalid_argument_exception::InvalidArgumentException; +use crate::exception::InvalidArgumentException; use indexmap::IndexMap; pub const DEFAULT_ALIGN: &str = "left"; diff --git a/crates/shirabe-symfony-console/src/helper/table_rows.rs b/crates/shirabe-symfony-console/src/helper/table_rows.rs index dea05384..214ebab0 100644 --- a/crates/shirabe-symfony-console/src/helper/table_rows.rs +++ b/crates/shirabe-symfony-console/src/helper/table_rows.rs @@ -1,6 +1,6 @@ //! ref: composer/vendor/symfony/console/Helper/TableRows.php -use crate::helper::table::Row; +use crate::helper::Row; /// @internal /// diff --git a/crates/shirabe-symfony-console/src/helper/table_separator.rs b/crates/shirabe-symfony-console/src/helper/table_separator.rs index 898a6630..7c1735c6 100644 --- a/crates/shirabe-symfony-console/src/helper/table_separator.rs +++ b/crates/shirabe-symfony-console/src/helper/table_separator.rs @@ -1,7 +1,7 @@ //! ref: composer/vendor/symfony/console/Helper/TableSeparator.php -use crate::exception::invalid_argument_exception::InvalidArgumentException; -use crate::helper::table_cell::{TableCell, TableCellOption}; +use crate::exception::InvalidArgumentException; +use crate::helper::{TableCell, TableCellOption}; use indexmap::IndexMap; /// Marks a row as being a separator. @@ -30,9 +30,7 @@ impl TableSeparator { self.inner.get_rowspan() } - pub fn get_style( - &self, - ) -> Option> { + pub fn get_style(&self) -> Option> { self.inner.get_style() } } -- cgit v1.3.1-4-g156e