diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-26 02:42:32 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-26 02:59:18 +0900 |
| commit | b8050d0f9af177d4c93aa096df7f759d027a0e66 (patch) | |
| tree | c821eca1cbb7165d3e2ba515910254da6bb987e8 /crates/shirabe-external-packages/src | |
| parent | c6b55e27643b162275cce7d160ca03d43efb0053 (diff) | |
| download | php-shirabe-b8050d0f9af177d4c93aa096df7f759d027a0e66.tar.gz php-shirabe-b8050d0f9af177d4c93aa096df7f759d027a0e66.tar.zst php-shirabe-b8050d0f9af177d4c93aa096df7f759d027a0e66.zip | |
feat(output-style): implement is_console_output_interface via AsAny downcast
Matches the SymfonyStyle fix: ConsoleOutput is the sole ConsoleOutputInterface
implementor, so the instanceof check reduces to an AsAny downcast. get_error_output
now resolves correctly for non-console outputs instead of hitting todo!().
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-external-packages/src')
| -rw-r--r-- | crates/shirabe-external-packages/src/symfony/console/style/output_style.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/style/output_style.rs b/crates/shirabe-external-packages/src/symfony/console/style/output_style.rs index 7899bbc..9a16274 100644 --- a/crates/shirabe-external-packages/src/symfony/console/style/output_style.rs +++ b/crates/shirabe-external-packages/src/symfony/console/style/output_style.rs @@ -38,8 +38,12 @@ impl OutputStyle { .get_error_output() } - fn is_console_output_interface(_output: &Rc<RefCell<dyn OutputInterface>>) -> bool { - todo!() + fn is_console_output_interface(output: &Rc<RefCell<dyn OutputInterface>>) -> bool { + // ConsoleOutput is the only OutputInterface implementor that also implements + // ConsoleOutputInterface, so `instanceof ConsoleOutputInterface` reduces to this downcast. + shirabe_php_shim::AsAny::as_any(&*output.borrow()) + .downcast_ref::<crate::symfony::console::output::console_output::ConsoleOutput>() + .is_some() } fn as_console_output_interface( |
