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) --- .../shirabe-symfony-console/src/command/command.rs | 45 +++++++++++----------- 1 file changed, 22 insertions(+), 23 deletions(-) (limited to 'crates/shirabe-symfony-console/src/command/command.rs') diff --git a/crates/shirabe-symfony-console/src/command/command.rs b/crates/shirabe-symfony-console/src/command/command.rs index f0d9dfe0..831795e7 100644 --- a/crates/shirabe-symfony-console/src/command/command.rs +++ b/crates/shirabe-symfony-console/src/command/command.rs @@ -1,15 +1,16 @@ //! ref: composer/vendor/symfony/console/Command/Command.php use crate::application::Application; -use crate::completion::completion_input::CompletionInput; -use crate::completion::completion_suggestions::CompletionSuggestions; -use crate::exception::invalid_argument_exception::InvalidArgumentException; -use crate::helper::helper_set::HelperSet; -use crate::input::input_argument::InputArgument; -use crate::input::input_definition::InputDefinition; -use crate::input::input_interface::InputInterface; -use crate::input::input_option::InputOption; -use crate::output::output_interface::{self, OutputInterface}; +use crate::completion::CompletionInput; +use crate::completion::CompletionSuggestions; +use crate::exception::InvalidArgumentException; +use crate::helper::HelperSet; +use crate::input::InputArgument; +use crate::input::InputDefinition; +use crate::input::InputInterface; +use crate::input::InputOption; +use crate::output::OutputInterface; +use crate::output::output_interface; use indexmap::IndexMap; use shirabe_php_shim::{PhpMixed, php_regex}; use std::cell::{Cell, Ref}; @@ -241,7 +242,7 @@ impl CommandData { /// argument/option instances or an InputDefinition. #[derive(Debug)] pub enum SetDefinitionArg { - Array(Vec), + Array(Vec), Definition(InputDefinition), } @@ -296,11 +297,11 @@ macro_rules! delegate_command_trait_impls_to_inner { $crate::delegate_to_inner!($field, fn is_enabled(&self) -> bool); $crate::delegate_to_inner!($field, fn set_application(&self, application: Option>>)); $crate::delegate_to_inner!($field, fn get_application(&self) -> Option>>); - $crate::delegate_to_inner!($field, fn set_helper_set(&self, helper_set: std::rc::Rc>)); - $crate::delegate_to_inner!($field, fn get_helper_set(&self) -> Option>>); + $crate::delegate_to_inner!($field, fn set_helper_set(&self, helper_set: std::rc::Rc>)); + $crate::delegate_to_inner!($field, fn get_helper_set(&self) -> Option>>); $crate::delegate_to_inner!($field, fn merge_application_definition(&self, merge_args: bool)); - $crate::delegate_to_inner!($field, fn get_definition(&self) -> std::cell::Ref<'_, $crate::input::input_definition::InputDefinition>); - $crate::delegate_to_inner!($field, fn get_native_definition(&self) -> std::cell::Ref<'_, $crate::input::input_definition::InputDefinition>); + $crate::delegate_to_inner!($field, fn get_definition(&self) -> std::cell::Ref<'_, $crate::input::InputDefinition>); + $crate::delegate_to_inner!($field, fn get_native_definition(&self) -> std::cell::Ref<'_, $crate::input::InputDefinition>); $crate::delegate_to_inner!($field, fn set_name(&self, name: &str) -> anyhow::Result<()>); $crate::delegate_to_inner!($field, fn get_name(&self) -> Option); $crate::delegate_to_inner!($field, fn set_process_title(&self, title: &str)); @@ -317,7 +318,7 @@ macro_rules! delegate_command_trait_impls_to_inner { $crate::delegate_to_inner!($field, fn get_synopsis(&self, short: bool) -> String); $crate::delegate_to_inner!($field, fn add_usage(&self, usage: &str)); $crate::delegate_to_inner!($field, fn get_usages(&self) -> Vec); - $crate::delegate_to_inner!($field, fn get_helper(&self, name: &str) -> anyhow::Result>); + $crate::delegate_to_inner!($field, fn get_helper(&self, name: &str) -> anyhow::Result>); $crate::delegate_to_inner!($field, fn set_code(&self, code: Box shirabe_php_shim::PhpMixed>)); $crate::delegate_to_inner!($field, fn get_code(&self) -> std::cell::Ref<'_, Option shirabe_php_shim::PhpMixed>>>); $crate::delegate_to_inner!($field, fn ignore_validation_errors(&self)); @@ -538,7 +539,7 @@ pub trait Command: std::fmt::Debug + shirabe_php_shim::AsAny + shirabe_php_shim: fn get_helper( &self, name: &str, - ) -> anyhow::Result>; + ) -> anyhow::Result>; fn set_code( &self, @@ -836,16 +837,14 @@ impl Command for CommandData { fn get_helper( &self, name: &str, - ) -> anyhow::Result> { + ) -> anyhow::Result> { let helper_set_ref = self.helper_set.borrow(); let helper_set = match &*helper_set_ref { None => { - return Ok(Err(crate::exception::logic_exception::LogicException::new( - format!( - "Cannot retrieve helper \"{}\" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.", - name - ), - ))); + return Ok(Err(crate::exception::LogicException::new(format!( + "Cannot retrieve helper \"{}\" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.", + name + )))); } Some(helper_set) => helper_set, }; -- cgit v1.3.1-4-g156e