diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-29 04:40:40 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-29 04:40:40 +0900 |
| commit | fdc5e94fa85378755c6b8ac63abeb9389541bb33 (patch) | |
| tree | 9cb6ea36daca428bcdb7a960d8c6ddf48c450558 | |
| parent | e0e0f2c1fe97feeb002bda1f8ed712a0e1522bf3 (diff) | |
| download | php-shirabe-fdc5e94fa85378755c6b8ac63abeb9389541bb33.tar.gz php-shirabe-fdc5e94fa85378755c6b8ac63abeb9389541bb33.tar.zst php-shirabe-fdc5e94fa85378755c6b8ac63abeb9389541bb33.zip | |
feat(console): implement StringInput stringification in global proxy
StringInput inherits __toString from ArgvInput in PHP; mirror that with a
Display impl delegating to its inner ArgvInput, and use it in
GlobalCommand::input_to_string.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| -rw-r--r-- | crates/shirabe-external-packages/src/symfony/console/input/string_input.rs | 6 | ||||
| -rw-r--r-- | crates/shirabe/src/command/global_command.rs | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/input/string_input.rs b/crates/shirabe-external-packages/src/symfony/console/input/string_input.rs index 747ac0e..122e588 100644 --- a/crates/shirabe-external-packages/src/symfony/console/input/string_input.rs +++ b/crates/shirabe-external-packages/src/symfony/console/input/string_input.rs @@ -142,6 +142,12 @@ impl StringInput { } } +impl std::fmt::Display for StringInput { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.inner.fmt(f) + } +} + impl InputInterface for StringInput { fn dup(&self) -> std::rc::Rc<std::cell::RefCell<dyn InputInterface>> { std::rc::Rc::new(std::cell::RefCell::new(self.clone())) diff --git a/crates/shirabe/src/command/global_command.rs b/crates/shirabe/src/command/global_command.rs index 5769ebb..27331a7 100644 --- a/crates/shirabe/src/command/global_command.rs +++ b/crates/shirabe/src/command/global_command.rs @@ -53,10 +53,8 @@ impl GlobalCommand { Ok(argv_input.to_string()) } else if let Some(array_input) = input_any.downcast_ref::<ArrayInput>() { Ok(array_input.to_string()) - } else if input_any.is::<StringInput>() { - // StringInput's stringification is not exposed by shirabe-external-packages - // (its inner ArgvInput is pub(crate) and it defines no public __toString). - todo!("StringInput::__toString is not accessible from the shirabe crate") + } else if let Some(string_input) = input_any.downcast_ref::<StringInput>() { + Ok(string_input.to_string()) } else { Err(LogicException { message: "Expected an Input instance that is stringable".to_string(), |
