From 27d00055df8691a6bd99aaf38633a7338b16cc6a Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 11 Jul 2026 16:33:05 +0900 Subject: chore: use fully-qualified name for Rc/RefCell --- .../src/symfony/console/command/command.rs | 96 ++++++++++++---------- .../symfony/console/command/complete_command.rs | 18 ++-- .../console/command/dump_completion_command.rs | 6 +- .../src/symfony/console/command/help_command.rs | 12 ++- .../src/symfony/console/command/list_command.rs | 6 +- 5 files changed, 69 insertions(+), 69 deletions(-) (limited to 'crates/shirabe-external-packages/src/symfony/console/command') diff --git a/crates/shirabe-external-packages/src/symfony/console/command/command.rs b/crates/shirabe-external-packages/src/symfony/console/command/command.rs index 527f0c54..81eb3c08 100644 --- a/crates/shirabe-external-packages/src/symfony/console/command/command.rs +++ b/crates/shirabe-external-packages/src/symfony/console/command/command.rs @@ -12,8 +12,7 @@ use crate::symfony::console::input::input_option::InputOption; use crate::symfony::console::output::output_interface::{self, OutputInterface}; use indexmap::IndexMap; use shirabe_php_shim::PhpMixed; -use std::cell::{Cell, Ref, RefCell}; -use std::rc::Rc; +use std::cell::{Cell, Ref}; /// The base-class state of the PHP `Command` class. /// @@ -28,22 +27,23 @@ use std::rc::Rc; /// command does not lock the object, so a command can be re-entered (e.g. the help command /// describing itself) without the borrow conflicts a `&mut self` design would cause. pub struct CommandData { - application: RefCell>>>, - name: RefCell>, - process_title: RefCell>, - aliases: RefCell>, - definition: RefCell>, + application: std::cell::RefCell>>>, + name: std::cell::RefCell>, + process_title: std::cell::RefCell>, + aliases: std::cell::RefCell>, + definition: std::cell::RefCell>, hidden: Cell, - help: RefCell, - description: RefCell, - full_definition: RefCell>, + help: std::cell::RefCell, + description: std::cell::RefCell, + full_definition: std::cell::RefCell>, ignore_validation_errors: Cell, // A callable(InputInterface, OutputInterface) -> i64. - code: - RefCell PhpMixed>>>, - synopsis: RefCell>, - usages: RefCell>, - helper_set: RefCell>>>, + code: std::cell::RefCell< + Option PhpMixed>>, + >, + synopsis: std::cell::RefCell>, + usages: std::cell::RefCell>, + helper_set: std::cell::RefCell>>>, } impl CommandData { @@ -81,22 +81,22 @@ impl CommandData { /// virtual dispatch of `$this->configure()` from the parent constructor. pub fn new(name: Option) -> Self { let this = CommandData { - application: RefCell::new(None), - name: RefCell::new(None), - process_title: RefCell::new(None), - aliases: RefCell::new(Vec::new()), - definition: RefCell::new(Some( + application: std::cell::RefCell::new(None), + name: std::cell::RefCell::new(None), + process_title: std::cell::RefCell::new(None), + aliases: std::cell::RefCell::new(Vec::new()), + definition: std::cell::RefCell::new(Some( InputDefinition::new(Vec::new()).expect("an empty InputDefinition cannot fail"), )), hidden: Cell::new(false), - help: RefCell::new(String::new()), - description: RefCell::new(String::new()), - full_definition: RefCell::new(None), + help: std::cell::RefCell::new(String::new()), + description: std::cell::RefCell::new(String::new()), + full_definition: std::cell::RefCell::new(None), ignore_validation_errors: Cell::new(false), - code: RefCell::new(None), - synopsis: RefCell::new(IndexMap::new()), - usages: RefCell::new(Vec::new()), - helper_set: RefCell::new(None), + code: std::cell::RefCell::new(None), + synopsis: std::cell::RefCell::new(IndexMap::new()), + usages: std::cell::RefCell::new(Vec::new()), + helper_set: std::cell::RefCell::new(None), }; // PHP's __construct also derives the name from getDefaultName() when null and @@ -345,8 +345,8 @@ pub trait Command: std::fmt::Debug + shirabe_php_shim::AsAny { /// forgot to implement it (PHP throws LogicException — a programming error here). fn execute( &self, - _input: Rc>, - _output: Rc>, + _input: std::rc::Rc>, + _output: std::rc::Rc>, ) -> anyhow::Result { panic!("You must override the execute() method in the concrete command class."); } @@ -354,16 +354,16 @@ pub trait Command: std::fmt::Debug + shirabe_php_shim::AsAny { /// Interacts with the user before the InputDefinition is validated. fn interact( &self, - _input: Rc>, - _output: Rc>, + _input: std::rc::Rc>, + _output: std::rc::Rc>, ) { } /// Initializes the command after the input has been bound and before it is validated. fn initialize( &self, - _input: Rc>, - _output: Rc>, + _input: std::rc::Rc>, + _output: std::rc::Rc>, ) -> anyhow::Result<()> { Ok(()) } @@ -387,8 +387,8 @@ pub trait Command: std::fmt::Debug + shirabe_php_shim::AsAny { /// or that late binding breaks. fn run( &self, - input: Rc>, - output: Rc>, + input: std::rc::Rc>, + output: std::rc::Rc>, ) -> anyhow::Result { self.base_run(input, output) } @@ -399,8 +399,8 @@ pub trait Command: std::fmt::Debug + shirabe_php_shim::AsAny { /// binding of `initialize`/`interact`/`execute` to the concrete command breaks. fn base_run( &self, - input: Rc>, - output: Rc>, + input: std::rc::Rc>, + output: std::rc::Rc>, ) -> anyhow::Result { // add the application arguments and options self.merge_application_definition(true); @@ -477,13 +477,16 @@ pub trait Command: std::fmt::Debug + shirabe_php_shim::AsAny { fn is_enabled(&self) -> bool; - fn set_application(&self, application: Option>>); + fn set_application( + &self, + application: Option>>, + ); - fn get_application(&self) -> Option>>; + fn get_application(&self) -> Option>>; - fn set_helper_set(&self, helper_set: Rc>); + fn set_helper_set(&self, helper_set: std::rc::Rc>); - fn get_helper_set(&self) -> Option>>; + fn get_helper_set(&self) -> Option>>; fn merge_application_definition(&self, merge_args: bool); @@ -549,7 +552,10 @@ impl Command for CommandData { true } - fn set_application(&self, application: Option>>) { + fn set_application( + &self, + application: Option>>, + ) { *self.application.borrow_mut() = application.clone(); if let Some(application) = application { self.set_helper_set(application.borrow_mut().get_helper_set()); @@ -560,15 +566,15 @@ impl Command for CommandData { *self.full_definition.borrow_mut() = None; } - fn get_application(&self) -> Option>> { + fn get_application(&self) -> Option>> { self.application.borrow().clone() } - fn set_helper_set(&self, helper_set: Rc>) { + fn set_helper_set(&self, helper_set: std::rc::Rc>) { *self.helper_set.borrow_mut() = Some(helper_set); } - fn get_helper_set(&self) -> Option>> { + fn get_helper_set(&self) -> Option>> { self.helper_set.borrow().clone() } diff --git a/crates/shirabe-external-packages/src/symfony/console/command/complete_command.rs b/crates/shirabe-external-packages/src/symfony/console/command/complete_command.rs index d64e4a99..5d8b1a98 100644 --- a/crates/shirabe-external-packages/src/symfony/console/command/complete_command.rs +++ b/crates/shirabe-external-packages/src/symfony/console/command/complete_command.rs @@ -11,9 +11,7 @@ use crate::symfony::console::input::input_option::InputOption; use crate::symfony::console::output::output_interface::OutputInterface; use indexmap::IndexMap; use shirabe_php_shim::PhpMixed; -use std::cell::RefCell; use std::ops::{Deref, DerefMut}; -use std::rc::Rc; /// Responsible for providing the values to the shell completion. #[derive(Debug)] @@ -105,7 +103,7 @@ impl CompleteCommand { &self, completion_input: &CompletionInput, _output: &dyn OutputInterface, - ) -> Option>> { + ) -> Option>> { // try { ... } catch (CommandNotFoundException $e) {} let input_name = completion_input.get_first_argument()?; @@ -144,14 +142,16 @@ impl CompleteCommand { } } -fn get_class_of_command(command: &Rc>) -> String { +fn get_class_of_command(command: &std::rc::Rc>) -> String { // LazyCommand is intentionally not ported. // TODO: get_class() takes a PhpMixed but the command is a `dyn Command`; reflecting the // concrete class name of a trait object requires a class-name hook on Command (Phase C). todo!() } -fn get_definition_options(command: &Rc>) -> Vec> { +fn get_definition_options( + command: &std::rc::Rc>, +) -> Vec> { command .borrow() .get_definition() @@ -209,8 +209,8 @@ impl Command for CompleteCommand { fn initialize( &self, - input: Rc>, - output: Rc>, + input: std::rc::Rc>, + output: std::rc::Rc>, ) -> anyhow::Result<()> { let _ = (input, output); self.is_debug.set(shirabe_php_shim::filter_var_boolean( @@ -224,8 +224,8 @@ impl Command for CompleteCommand { fn execute( &self, - input: Rc>, - output: Rc>, + input: std::rc::Rc>, + output: std::rc::Rc>, ) -> anyhow::Result { // try { ... } catch (\Throwable $e) { ...; if ($output->isDebug()) { throw $e; } return 2; } let result: anyhow::Result = (|| { diff --git a/crates/shirabe-external-packages/src/symfony/console/command/dump_completion_command.rs b/crates/shirabe-external-packages/src/symfony/console/command/dump_completion_command.rs index 8e2583e9..23ce06f7 100644 --- a/crates/shirabe-external-packages/src/symfony/console/command/dump_completion_command.rs +++ b/crates/shirabe-external-packages/src/symfony/console/command/dump_completion_command.rs @@ -10,9 +10,7 @@ use crate::symfony::console::input::input_interface::InputInterface; use crate::symfony::console::input::input_option::InputOption; use crate::symfony::console::output::output_interface::{self, OutputInterface}; use shirabe_php_shim::PhpMixed; -use std::cell::RefCell; use std::ops::{Deref, DerefMut}; -use std::rc::Rc; /// Dumps the completion script for the current shell. #[derive(Debug)] @@ -180,8 +178,8 @@ impl Command for DumpCompletionCommand { fn execute( &self, - input: Rc>, - output: Rc>, + input: std::rc::Rc>, + output: std::rc::Rc>, ) -> anyhow::Result { let command_name = shirabe_php_shim::basename( &shirabe_php_shim::PHP_SERVER diff --git a/crates/shirabe-external-packages/src/symfony/console/command/help_command.rs b/crates/shirabe-external-packages/src/symfony/console/command/help_command.rs index 8ef488f7..7c32a733 100644 --- a/crates/shirabe-external-packages/src/symfony/console/command/help_command.rs +++ b/crates/shirabe-external-packages/src/symfony/console/command/help_command.rs @@ -14,15 +14,13 @@ use crate::symfony::console::input::input_interface::InputInterface; use crate::symfony::console::input::input_option::InputOption; use crate::symfony::console::output::output_interface::OutputInterface; use shirabe_php_shim::PhpMixed; -use std::cell::RefCell; use std::ops::{Deref, DerefMut}; -use std::rc::Rc; /// HelpCommand displays the help for a given command. #[derive(Debug)] pub struct HelpCommand { inner: CommandData, - command: RefCell>>>, + command: std::cell::RefCell>>>, } impl Deref for HelpCommand { @@ -49,7 +47,7 @@ impl HelpCommand { pub fn new() -> Self { let command = HelpCommand { inner: CommandData::new(None), - command: RefCell::new(None), + command: std::cell::RefCell::new(None), }; command .configure() @@ -57,7 +55,7 @@ impl HelpCommand { command } - pub fn set_command(&self, command: Rc>) { + pub fn set_command(&self, command: std::rc::Rc>) { *self.command.borrow_mut() = Some(command); } @@ -135,8 +133,8 @@ impl Command for HelpCommand { fn execute( &self, - input: Rc>, - output: Rc>, + input: std::rc::Rc>, + output: std::rc::Rc>, ) -> anyhow::Result { if self.command.borrow().is_none() { let application = self.get_application().unwrap(); diff --git a/crates/shirabe-external-packages/src/symfony/console/command/list_command.rs b/crates/shirabe-external-packages/src/symfony/console/command/list_command.rs index 4f6e9231..4153a20b 100644 --- a/crates/shirabe-external-packages/src/symfony/console/command/list_command.rs +++ b/crates/shirabe-external-packages/src/symfony/console/command/list_command.rs @@ -14,9 +14,7 @@ use crate::symfony::console::input::input_interface::InputInterface; use crate::symfony::console::input::input_option::InputOption; use crate::symfony::console::output::output_interface::OutputInterface; use shirabe_php_shim::PhpMixed; -use std::cell::RefCell; use std::ops::{Deref, DerefMut}; -use std::rc::Rc; /// ListCommand displays the list of all available commands for the application. #[derive(Debug)] @@ -140,8 +138,8 @@ impl Command for ListCommand { fn execute( &self, - input: Rc>, - output: Rc>, + input: std::rc::Rc>, + output: std::rc::Rc>, ) -> anyhow::Result { let mut helper = DescriptorHelper::new(); let object = DescribableObject::Application(self.get_application().unwrap()); -- cgit v1.3.1