aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-external-packages/src/symfony/console/input/array_input.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-14 00:15:52 +0900
committernsfisis <nsfisis@gmail.com>2026-06-14 00:15:52 +0900
commitfe15d4dba4530f574856a6c443a3f665aa5abe7a (patch)
treed7dc0433e40a2c38c50daf399ec8a3de5c2ac307 /crates/shirabe-external-packages/src/symfony/console/input/array_input.rs
parente165b2ffa32e21c50787ae7227dc5333131d1414 (diff)
downloadphp-shirabe-fe15d4dba4530f574856a6c443a3f665aa5abe7a.tar.gz
php-shirabe-fe15d4dba4530f574856a6c443a3f665aa5abe7a.tar.zst
php-shirabe-fe15d4dba4530f574856a6c443a3f665aa5abe7a.zip
feat(console): implement get_command_name_before_binding via input clone
Replace the todo!() stub with the real Symfony logic: clone the input, bind it against the application definition (ignoring binding errors), and read the first argument so the command name is detected even when global options precede it. Add a dup() method to InputInterface to model PHP's clone, derive Clone on the input types, and treat InvalidArgument/InvalidOption/MissingInput as ignorable ExceptionInterface errors during the pre-binding probe.
Diffstat (limited to 'crates/shirabe-external-packages/src/symfony/console/input/array_input.rs')
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/input/array_input.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/input/array_input.rs b/crates/shirabe-external-packages/src/symfony/console/input/array_input.rs
index ccc1916..705c997 100644
--- a/crates/shirabe-external-packages/src/symfony/console/input/array_input.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/input/array_input.rs
@@ -14,7 +14,7 @@ use shirabe_php_shim::PhpMixed;
///
/// PHP arrays can mix integer and string keys; `parameters` preserves both the
/// key type (`PhpMixed::Int` / `PhpMixed::String`) and the insertion order.
-#[derive(Debug)]
+#[derive(Debug, Clone)]
pub struct ArrayInput {
pub(crate) inner: Input,
parameters: Vec<(PhpMixed, PhpMixed)>,
@@ -298,6 +298,10 @@ impl ArrayInput {
}
impl InputInterface for ArrayInput {
+ fn dup(&self) -> std::rc::Rc<std::cell::RefCell<dyn InputInterface>> {
+ std::rc::Rc::new(std::cell::RefCell::new(self.clone()))
+ }
+
fn get_first_argument(&self) -> Option<String> {
ArrayInput::get_first_argument(self).map(|v| shirabe_php_shim::php_to_string(&v))
}