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 ++++++++++++---------- 1 file changed, 51 insertions(+), 45 deletions(-) (limited to 'crates/shirabe-external-packages/src/symfony/console/command/command.rs') 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() } -- cgit v1.3.1