diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-10 04:38:35 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-10 04:38:35 +0900 |
| commit | 9d9da0d1512202af7802d13b1c3c33a1a077a84e (patch) | |
| tree | abe363b266a61da1713c6a16702b84ea68c70882 /crates/shirabe-symfony-console/src/command/command.rs | |
| parent | f38080643d80b258393f2b7ab20349b122fe4591 (diff) | |
| download | php-shirabe-9d9da0d1512202af7802d13b1c3c33a1a077a84e.tar.gz php-shirabe-9d9da0d1512202af7802d13b1c3c33a1a077a84e.tar.zst php-shirabe-9d9da0d1512202af7802d13b1c3c33a1a077a84e.zip | |
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) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-symfony-console/src/command/command.rs')
| -rw-r--r-- | crates/shirabe-symfony-console/src/command/command.rs | 45 |
1 files changed, 22 insertions, 23 deletions
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<crate::input::input_definition::DefinitionItem>), + Array(Vec<crate::input::DefinitionItem>), 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<std::rc::Rc<std::cell::RefCell<dyn $crate::application::Application>>>)); $crate::delegate_to_inner!($field, fn get_application(&self) -> Option<std::rc::Rc<std::cell::RefCell<dyn $crate::application::Application>>>); - $crate::delegate_to_inner!($field, fn set_helper_set(&self, helper_set: std::rc::Rc<std::cell::RefCell<$crate::helper::helper_set::HelperSet>>)); - $crate::delegate_to_inner!($field, fn get_helper_set(&self) -> Option<std::rc::Rc<std::cell::RefCell<$crate::helper::helper_set::HelperSet>>>); + $crate::delegate_to_inner!($field, fn set_helper_set(&self, helper_set: std::rc::Rc<std::cell::RefCell<$crate::helper::HelperSet>>)); + $crate::delegate_to_inner!($field, fn get_helper_set(&self) -> Option<std::rc::Rc<std::cell::RefCell<$crate::helper::HelperSet>>>); $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<String>); $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<String>); - $crate::delegate_to_inner!($field, fn get_helper(&self, name: &str) -> anyhow::Result<Result<shirabe_php_shim::PhpMixed, $crate::exception::logic_exception::LogicException>>); + $crate::delegate_to_inner!($field, fn get_helper(&self, name: &str) -> anyhow::Result<Result<shirabe_php_shim::PhpMixed, $crate::exception::LogicException>>); $crate::delegate_to_inner!($field, fn set_code(&self, code: Box<dyn Fn(&mut dyn $crate::input::InputInterface, &mut dyn $crate::output::OutputInterface) -> shirabe_php_shim::PhpMixed>)); $crate::delegate_to_inner!($field, fn get_code(&self) -> std::cell::Ref<'_, Option<Box<dyn Fn(&mut dyn $crate::input::InputInterface, &mut dyn $crate::output::OutputInterface) -> 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<Result<PhpMixed, crate::exception::logic_exception::LogicException>>; + ) -> anyhow::Result<Result<PhpMixed, crate::exception::LogicException>>; fn set_code( &self, @@ -836,16 +837,14 @@ impl Command for CommandData { fn get_helper( &self, name: &str, - ) -> anyhow::Result<Result<PhpMixed, crate::exception::logic_exception::LogicException>> { + ) -> anyhow::Result<Result<PhpMixed, crate::exception::LogicException>> { 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, }; |
