diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-06 18:04:45 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-06 18:04:45 +0900 |
| commit | d5b313f388d424e60ae33ae58c1a65a65b24b8f1 (patch) | |
| tree | 849ada9b7319b8eb85aab28e02f614023fea2105 /crates/shirabe-external-packages | |
| parent | 71b432db3f115d17be498f36cd3efd40b4650a0b (diff) | |
| download | php-shirabe-d5b313f388d424e60ae33ae58c1a65a65b24b8f1.tar.gz php-shirabe-d5b313f388d424e60ae33ae58c1a65a65b24b8f1.tar.zst php-shirabe-d5b313f388d424e60ae33ae58c1a65a65b24b8f1.zip | |
refactor(command): share Input/OutputInterface via Rc<RefCell>
Convert InputInterface and OutputInterface parameters from &dyn/&mut dyn
references to Rc<RefCell<dyn ...>> shared ownership across the command,
console, and IO layers, matching the Phase C shared-ownership approach
already used for IOInterface.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-external-packages')
10 files changed, 22 insertions, 15 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/component/console/application.rs b/crates/shirabe-external-packages/src/symfony/component/console/application.rs index 65abce4..becf1a5 100644 --- a/crates/shirabe-external-packages/src/symfony/component/console/application.rs +++ b/crates/shirabe-external-packages/src/symfony/component/console/application.rs @@ -12,8 +12,8 @@ impl Application { pub fn run( &mut self, - _input: Option<&mut dyn InputInterface>, - _output: Option<&mut dyn OutputInterface>, + _input: Option<std::rc::Rc<std::cell::RefCell<dyn InputInterface>>>, + _output: Option<std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>>, ) -> anyhow::Result<i64> { todo!() } @@ -90,7 +90,11 @@ impl Application { todo!() } - pub fn render_throwable(&self, _exception: &anyhow::Error, _output: &mut dyn OutputInterface) { + pub fn render_throwable( + &self, + _exception: &anyhow::Error, + _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>, + ) { todo!() } diff --git a/crates/shirabe-external-packages/src/symfony/component/console/helper/progress_bar.rs b/crates/shirabe-external-packages/src/symfony/component/console/helper/progress_bar.rs index 1b896f9..77bc4fd 100644 --- a/crates/shirabe-external-packages/src/symfony/component/console/helper/progress_bar.rs +++ b/crates/shirabe-external-packages/src/symfony/component/console/helper/progress_bar.rs @@ -4,7 +4,7 @@ use crate::symfony::component::console::output::OutputInterface; pub struct ProgressBar; impl ProgressBar { - pub fn new(_output: &dyn OutputInterface, _max: i64) -> Self { + pub fn new(_output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>, _max: i64) -> Self { todo!() } diff --git a/crates/shirabe-external-packages/src/symfony/component/console/helper/question_helper.rs b/crates/shirabe-external-packages/src/symfony/component/console/helper/question_helper.rs index 5c723c2..5d452c7 100644 --- a/crates/shirabe-external-packages/src/symfony/component/console/helper/question_helper.rs +++ b/crates/shirabe-external-packages/src/symfony/component/console/helper/question_helper.rs @@ -9,8 +9,8 @@ pub struct QuestionHelper; impl QuestionHelper { pub fn ask( &self, - _input: &mut dyn InputInterface, - _output: &mut dyn OutputInterface, + _input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>, + _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>, _question: &Question, ) -> Option<PhpMixed> { todo!() diff --git a/crates/shirabe-external-packages/src/symfony/component/console/helper/table.rs b/crates/shirabe-external-packages/src/symfony/component/console/helper/table.rs index ca8b292..f580965 100644 --- a/crates/shirabe-external-packages/src/symfony/component/console/helper/table.rs +++ b/crates/shirabe-external-packages/src/symfony/component/console/helper/table.rs @@ -5,7 +5,7 @@ use shirabe_php_shim::PhpMixed; pub struct Table; impl Table { - pub fn new(_output: &dyn OutputInterface) -> Self { + pub fn new(_output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>) -> Self { todo!() } diff --git a/crates/shirabe-external-packages/src/symfony/component/console/input/input_interface.rs b/crates/shirabe-external-packages/src/symfony/component/console/input/input_interface.rs index f38d524..a556198 100644 --- a/crates/shirabe-external-packages/src/symfony/component/console/input/input_interface.rs +++ b/crates/shirabe-external-packages/src/symfony/component/console/input/input_interface.rs @@ -1,6 +1,6 @@ use shirabe_php_shim::PhpMixed; -pub trait InputInterface { +pub trait InputInterface: std::fmt::Debug { fn get_first_argument(&self) -> Option<String>; fn has_parameter_option(&self, values: &[&str], only_params: bool) -> bool; fn get_parameter_option( diff --git a/crates/shirabe-external-packages/src/symfony/component/console/output/console_output.rs b/crates/shirabe-external-packages/src/symfony/component/console/output/console_output.rs index 332cbd1..00b9324 100644 --- a/crates/shirabe-external-packages/src/symfony/component/console/output/console_output.rs +++ b/crates/shirabe-external-packages/src/symfony/component/console/output/console_output.rs @@ -16,11 +16,11 @@ impl ConsoleOutput { } impl ConsoleOutputInterface for ConsoleOutput { - fn get_error_output(&self) -> &dyn OutputInterface { + fn get_error_output(&self) -> std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> { todo!() } - fn set_error_output(&mut self, _error: Box<dyn OutputInterface>) { + fn set_error_output(&mut self, _error: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>) { todo!() } } diff --git a/crates/shirabe-external-packages/src/symfony/component/console/output/console_output_interface.rs b/crates/shirabe-external-packages/src/symfony/component/console/output/console_output_interface.rs index 8e68396..83ec1de 100644 --- a/crates/shirabe-external-packages/src/symfony/component/console/output/console_output_interface.rs +++ b/crates/shirabe-external-packages/src/symfony/component/console/output/console_output_interface.rs @@ -1,6 +1,6 @@ use crate::symfony::component::console::output::OutputInterface; pub trait ConsoleOutputInterface: OutputInterface { - fn get_error_output(&self) -> &dyn OutputInterface; - fn set_error_output(&mut self, error: Box<dyn OutputInterface>); + fn get_error_output(&self) -> std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>; + fn set_error_output(&mut self, error: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>); } diff --git a/crates/shirabe-external-packages/src/symfony/component/console/output/output_interface.rs b/crates/shirabe-external-packages/src/symfony/component/console/output/output_interface.rs index 11fb82e..9e58a3e 100644 --- a/crates/shirabe-external-packages/src/symfony/component/console/output/output_interface.rs +++ b/crates/shirabe-external-packages/src/symfony/component/console/output/output_interface.rs @@ -1,7 +1,7 @@ use crate::symfony::component::console::formatter::OutputFormatter; use crate::symfony::component::console::output::ConsoleOutputInterface; -pub trait OutputInterface { +pub trait OutputInterface: std::fmt::Debug { // PHP class semantics: OutputInterface methods take &self with interior mutability, // because output objects are shared by reference across the PHP code. fn write(&self, messages: &str, newline: bool, r#type: i64); diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/table.rs b/crates/shirabe-external-packages/src/symfony/console/helper/table.rs index df4978c..30c008c 100644 --- a/crates/shirabe-external-packages/src/symfony/console/helper/table.rs +++ b/crates/shirabe-external-packages/src/symfony/console/helper/table.rs @@ -5,7 +5,7 @@ use shirabe_php_shim::PhpMixed; pub struct Table; impl Table { - pub fn new(_output: &dyn OutputInterface) -> Self { + pub fn new(_output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>) -> Self { todo!() } diff --git a/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs b/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs index 92e9e67..b5dfded 100644 --- a/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs +++ b/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs @@ -6,7 +6,10 @@ use shirabe_php_shim::PhpMixed; pub struct SymfonyStyle; impl SymfonyStyle { - pub fn new(_input: &dyn InputInterface, _output: &dyn OutputInterface) -> Self { + pub fn new( + _input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>, + _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>, + ) -> Self { todo!() } |
