aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-symfony-console/src/command
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-10 04:38:35 +0900
committernsfisis <nsfisis@gmail.com>2026-08-10 04:38:35 +0900
commit9d9da0d1512202af7802d13b1c3c33a1a077a84e (patch)
treeabe363b266a61da1713c6a16702b84ea68c70882 /crates/shirabe-symfony-console/src/command
parentf38080643d80b258393f2b7ab20349b122fe4591 (diff)
downloadphp-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')
-rw-r--r--crates/shirabe-symfony-console/src/command/command.rs45
-rw-r--r--crates/shirabe-symfony-console/src/command/complete_command.rs16
-rw-r--r--crates/shirabe-symfony-console/src/command/dump_completion_command.rs15
-rw-r--r--crates/shirabe-symfony-console/src/command/help_command.rs22
-rw-r--r--crates/shirabe-symfony-console/src/command/list_command.rs22
5 files changed, 60 insertions, 60 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,
};
diff --git a/crates/shirabe-symfony-console/src/command/complete_command.rs b/crates/shirabe-symfony-console/src/command/complete_command.rs
index 3dad2609..8058d698 100644
--- a/crates/shirabe-symfony-console/src/command/complete_command.rs
+++ b/crates/shirabe-symfony-console/src/command/complete_command.rs
@@ -1,13 +1,13 @@
//! ref: composer/vendor/symfony/console/Command/CompleteCommand.php
-use crate::command::command::{Command, CommandData};
-use crate::completion::completion_input::CompletionInput;
-use crate::completion::completion_suggestions::{CompletionSuggestions, StringOrSuggestion};
-use crate::completion::output::bash_completion_output::BashCompletionOutput;
-use crate::completion::output::completion_output_interface::CompletionOutputInterface;
-use crate::input::input_interface::InputInterface;
-use crate::input::input_option::InputOption;
-use crate::output::output_interface::OutputInterface;
+use crate::command::{Command, CommandData};
+use crate::completion::BashCompletionOutput;
+use crate::completion::CompletionInput;
+use crate::completion::CompletionOutputInterface;
+use crate::completion::{CompletionSuggestions, StringOrSuggestion};
+use crate::input::InputInterface;
+use crate::input::InputOption;
+use crate::output::OutputInterface;
use indexmap::IndexMap;
use shirabe_php_shim::{PhpMixed, impl_php_class};
use std::ops::{Deref, DerefMut};
diff --git a/crates/shirabe-symfony-console/src/command/dump_completion_command.rs b/crates/shirabe-symfony-console/src/command/dump_completion_command.rs
index efe116a9..4db6c233 100644
--- a/crates/shirabe-symfony-console/src/command/dump_completion_command.rs
+++ b/crates/shirabe-symfony-console/src/command/dump_completion_command.rs
@@ -1,12 +1,13 @@
//! ref: composer/vendor/symfony/console/Command/DumpCompletionCommand.php
-use crate::command::command::{Command, CommandData};
-use crate::completion::completion_input::CompletionInput;
-use crate::completion::completion_suggestions::{CompletionSuggestions, StringOrSuggestion};
-use crate::input::input_argument::InputArgument;
-use crate::input::input_interface::InputInterface;
-use crate::input::input_option::InputOption;
-use crate::output::output_interface::{self, OutputInterface};
+use crate::command::{Command, CommandData};
+use crate::completion::CompletionInput;
+use crate::completion::{CompletionSuggestions, StringOrSuggestion};
+use crate::input::InputArgument;
+use crate::input::InputInterface;
+use crate::input::InputOption;
+use crate::output::OutputInterface;
+use crate::output::output_interface;
use shirabe_php_shim::{PhpMixed, impl_php_class};
use shirabe_symfony_process::process::Process;
use std::ops::{Deref, DerefMut};
diff --git a/crates/shirabe-symfony-console/src/command/help_command.rs b/crates/shirabe-symfony-console/src/command/help_command.rs
index 9472d144..4f1447cb 100644
--- a/crates/shirabe-symfony-console/src/command/help_command.rs
+++ b/crates/shirabe-symfony-console/src/command/help_command.rs
@@ -1,16 +1,16 @@
//! ref: composer/vendor/symfony/console/Command/HelpCommand.php
-use crate::command::command::{Command, CommandData, SetDefinitionArg};
-use crate::completion::completion_input::CompletionInput;
-use crate::completion::completion_suggestions::{CompletionSuggestions, StringOrSuggestion};
-use crate::descriptor::application_description::ApplicationDescription;
-use crate::descriptor::descriptor_interface::DescribableObject;
-use crate::helper::descriptor_helper::DescriptorHelper;
-use crate::input::input_argument::InputArgument;
-use crate::input::input_definition::DefinitionItem;
-use crate::input::input_interface::InputInterface;
-use crate::input::input_option::InputOption;
-use crate::output::output_interface::OutputInterface;
+use crate::command::{Command, CommandData, SetDefinitionArg};
+use crate::completion::CompletionInput;
+use crate::completion::{CompletionSuggestions, StringOrSuggestion};
+use crate::descriptor::ApplicationDescription;
+use crate::descriptor::DescribableObject;
+use crate::helper::DescriptorHelper;
+use crate::input::DefinitionItem;
+use crate::input::InputArgument;
+use crate::input::InputInterface;
+use crate::input::InputOption;
+use crate::output::OutputInterface;
use shirabe_php_shim::{PhpMixed, impl_php_class};
use std::ops::{Deref, DerefMut};
diff --git a/crates/shirabe-symfony-console/src/command/list_command.rs b/crates/shirabe-symfony-console/src/command/list_command.rs
index fb0bb770..ead84d44 100644
--- a/crates/shirabe-symfony-console/src/command/list_command.rs
+++ b/crates/shirabe-symfony-console/src/command/list_command.rs
@@ -1,16 +1,16 @@
//! ref: composer/vendor/symfony/console/Command/ListCommand.php
-use crate::command::command::{Command, CommandData, SetDefinitionArg};
-use crate::completion::completion_input::CompletionInput;
-use crate::completion::completion_suggestions::{CompletionSuggestions, StringOrSuggestion};
-use crate::descriptor::application_description::ApplicationDescription;
-use crate::descriptor::descriptor_interface::DescribableObject;
-use crate::helper::descriptor_helper::DescriptorHelper;
-use crate::input::input_argument::InputArgument;
-use crate::input::input_definition::DefinitionItem;
-use crate::input::input_interface::InputInterface;
-use crate::input::input_option::InputOption;
-use crate::output::output_interface::OutputInterface;
+use crate::command::{Command, CommandData, SetDefinitionArg};
+use crate::completion::CompletionInput;
+use crate::completion::{CompletionSuggestions, StringOrSuggestion};
+use crate::descriptor::ApplicationDescription;
+use crate::descriptor::DescribableObject;
+use crate::helper::DescriptorHelper;
+use crate::input::DefinitionItem;
+use crate::input::InputArgument;
+use crate::input::InputInterface;
+use crate::input::InputOption;
+use crate::output::OutputInterface;
use shirabe_php_shim::{PhpMixed, impl_php_class};
use std::ops::{Deref, DerefMut};