aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-external-packages
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe-external-packages')
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/application.rs10
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/command/command.rs96
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/command/complete_command.rs18
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/command/dump_completion_command.rs6
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/command/help_command.rs12
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/command/list_command.rs6
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/completion/completion_suggestions.rs9
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/cursor.rs6
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/descriptor/application_description.rs36
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/debug_formatter_helper.rs6
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/descriptor_helper.rs6
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/formatter_helper.rs6
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/helper.rs11
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/helper_interface.rs6
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/helper_set.rs32
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/process_helper.rs26
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/progress_bar.rs36
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs42
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/symfony_question_helper.rs6
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/table.rs18
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/table_cell.rs5
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs48
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/style/output_style.rs23
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs22
-rw-r--r--crates/shirabe-external-packages/src/symfony/finder/finder.rs9
25 files changed, 253 insertions, 248 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/application.rs b/crates/shirabe-external-packages/src/symfony/console/application.rs
index 605851fe..03fb0ced 100644
--- a/crates/shirabe-external-packages/src/symfony/console/application.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/application.rs
@@ -6,8 +6,6 @@ use crate::symfony::console::completion::completion_suggestions::CompletionSugge
use crate::symfony::console::helper::helper_set::HelperSet;
use crate::symfony::console::input::input_definition::InputDefinition;
use indexmap::IndexMap;
-use std::cell::RefCell;
-use std::rc::Rc;
/// `Symfony\Component\Console\Application` is a concrete class in PHP, but it is ported here as a
/// trait rather than a struct.
@@ -28,13 +26,13 @@ pub trait Application: std::fmt::Debug + shirabe_php_shim::AsAny {
fn all(
&mut self,
namespace: Option<&str>,
- ) -> anyhow::Result<IndexMap<String, Rc<RefCell<dyn Command>>>>;
+ ) -> anyhow::Result<IndexMap<String, std::rc::Rc<std::cell::RefCell<dyn Command>>>>;
- fn find(&mut self, name: &str) -> anyhow::Result<Rc<RefCell<dyn Command>>>;
+ fn find(&mut self, name: &str) -> anyhow::Result<std::rc::Rc<std::cell::RefCell<dyn Command>>>;
- fn get_definition(&mut self) -> Rc<RefCell<InputDefinition>>;
+ fn get_definition(&mut self) -> std::rc::Rc<std::cell::RefCell<InputDefinition>>;
- fn get_helper_set(&mut self) -> Rc<RefCell<HelperSet>>;
+ fn get_helper_set(&mut self) -> std::rc::Rc<std::cell::RefCell<HelperSet>>;
fn complete(
&mut self,
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<Option<Rc<RefCell<dyn Application>>>>,
- name: RefCell<Option<String>>,
- process_title: RefCell<Option<String>>,
- aliases: RefCell<Vec<String>>,
- definition: RefCell<Option<InputDefinition>>,
+ application: std::cell::RefCell<Option<std::rc::Rc<std::cell::RefCell<dyn Application>>>>,
+ name: std::cell::RefCell<Option<String>>,
+ process_title: std::cell::RefCell<Option<String>>,
+ aliases: std::cell::RefCell<Vec<String>>,
+ definition: std::cell::RefCell<Option<InputDefinition>>,
hidden: Cell<bool>,
- help: RefCell<String>,
- description: RefCell<String>,
- full_definition: RefCell<Option<InputDefinition>>,
+ help: std::cell::RefCell<String>,
+ description: std::cell::RefCell<String>,
+ full_definition: std::cell::RefCell<Option<InputDefinition>>,
ignore_validation_errors: Cell<bool>,
// A callable(InputInterface, OutputInterface) -> i64.
- code:
- RefCell<Option<Box<dyn Fn(&mut dyn InputInterface, &mut dyn OutputInterface) -> PhpMixed>>>,
- synopsis: RefCell<IndexMap<String, String>>,
- usages: RefCell<Vec<String>>,
- helper_set: RefCell<Option<Rc<RefCell<HelperSet>>>>,
+ code: std::cell::RefCell<
+ Option<Box<dyn Fn(&mut dyn InputInterface, &mut dyn OutputInterface) -> PhpMixed>>,
+ >,
+ synopsis: std::cell::RefCell<IndexMap<String, String>>,
+ usages: std::cell::RefCell<Vec<String>>,
+ helper_set: std::cell::RefCell<Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>>,
}
impl CommandData {
@@ -81,22 +81,22 @@ impl CommandData {
/// virtual dispatch of `$this->configure()` from the parent constructor.
pub fn new(name: Option<String>) -> 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<RefCell<dyn InputInterface>>,
- _output: Rc<RefCell<dyn OutputInterface>>,
+ _input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
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<RefCell<dyn InputInterface>>,
- _output: Rc<RefCell<dyn OutputInterface>>,
+ _input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) {
}
/// Initializes the command after the input has been bound and before it is validated.
fn initialize(
&self,
- _input: Rc<RefCell<dyn InputInterface>>,
- _output: Rc<RefCell<dyn OutputInterface>>,
+ _input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> 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<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
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<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
// 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<Rc<RefCell<dyn Application>>>);
+ fn set_application(
+ &self,
+ application: Option<std::rc::Rc<std::cell::RefCell<dyn Application>>>,
+ );
- fn get_application(&self) -> Option<Rc<RefCell<dyn Application>>>;
+ fn get_application(&self) -> Option<std::rc::Rc<std::cell::RefCell<dyn Application>>>;
- fn set_helper_set(&self, helper_set: Rc<RefCell<HelperSet>>);
+ fn set_helper_set(&self, helper_set: std::rc::Rc<std::cell::RefCell<HelperSet>>);
- fn get_helper_set(&self) -> Option<Rc<RefCell<HelperSet>>>;
+ fn get_helper_set(&self) -> Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>;
fn merge_application_definition(&self, merge_args: bool);
@@ -549,7 +552,10 @@ impl Command for CommandData {
true
}
- fn set_application(&self, application: Option<Rc<RefCell<dyn Application>>>) {
+ fn set_application(
+ &self,
+ application: Option<std::rc::Rc<std::cell::RefCell<dyn Application>>>,
+ ) {
*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<Rc<RefCell<dyn Application>>> {
+ fn get_application(&self) -> Option<std::rc::Rc<std::cell::RefCell<dyn Application>>> {
self.application.borrow().clone()
}
- fn set_helper_set(&self, helper_set: Rc<RefCell<HelperSet>>) {
+ fn set_helper_set(&self, helper_set: std::rc::Rc<std::cell::RefCell<HelperSet>>) {
*self.helper_set.borrow_mut() = Some(helper_set);
}
- fn get_helper_set(&self) -> Option<Rc<RefCell<HelperSet>>> {
+ fn get_helper_set(&self) -> Option<std::rc::Rc<std::cell::RefCell<HelperSet>>> {
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<Rc<RefCell<dyn Command>>> {
+ ) -> Option<std::rc::Rc<std::cell::RefCell<dyn Command>>> {
// 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<RefCell<dyn Command>>) -> String {
+fn get_class_of_command(command: &std::rc::Rc<std::cell::RefCell<dyn Command>>) -> 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<RefCell<dyn Command>>) -> Vec<Rc<InputOption>> {
+fn get_definition_options(
+ command: &std::rc::Rc<std::cell::RefCell<dyn Command>>,
+) -> Vec<std::rc::Rc<InputOption>> {
command
.borrow()
.get_definition()
@@ -209,8 +209,8 @@ impl Command for CompleteCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> 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<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
// try { ... } catch (\Throwable $e) { ...; if ($output->isDebug()) { throw $e; } return 2; }
let result: anyhow::Result<i64> = (|| {
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<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
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<Option<Rc<RefCell<dyn Command>>>>,
+ command: std::cell::RefCell<Option<std::rc::Rc<std::cell::RefCell<dyn Command>>>>,
}
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<RefCell<dyn Command>>) {
+ pub fn set_command(&self, command: std::rc::Rc<std::cell::RefCell<dyn Command>>) {
*self.command.borrow_mut() = Some(command);
}
@@ -135,8 +133,8 @@ impl Command for HelpCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
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<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let mut helper = DescriptorHelper::new();
let object = DescribableObject::Application(self.get_application().unwrap());
diff --git a/crates/shirabe-external-packages/src/symfony/console/completion/completion_suggestions.rs b/crates/shirabe-external-packages/src/symfony/console/completion/completion_suggestions.rs
index 512056aa..02938552 100644
--- a/crates/shirabe-external-packages/src/symfony/console/completion/completion_suggestions.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/completion/completion_suggestions.rs
@@ -2,7 +2,6 @@
use crate::symfony::console::completion::suggestion::Suggestion;
use crate::symfony::console::input::input_option::InputOption;
-use std::rc::Rc;
/// PHP union type `string|Suggestion` used by `suggestValue`/`suggestValues`.
#[derive(Debug)]
@@ -15,7 +14,7 @@ pub enum StringOrSuggestion {
#[derive(Debug)]
pub struct CompletionSuggestions {
value_suggestions: Vec<Suggestion>,
- option_suggestions: Vec<Rc<InputOption>>,
+ option_suggestions: Vec<std::rc::Rc<InputOption>>,
}
impl Default for CompletionSuggestions {
@@ -52,14 +51,14 @@ impl CompletionSuggestions {
}
/// Add a suggestion for an input option name.
- pub fn suggest_option(&mut self, option: Rc<InputOption>) -> &mut Self {
+ pub fn suggest_option(&mut self, option: std::rc::Rc<InputOption>) -> &mut Self {
self.option_suggestions.push(option);
self
}
/// Add multiple suggestions for input option names at once.
- pub fn suggest_options(&mut self, options: Vec<Rc<InputOption>>) -> &mut Self {
+ pub fn suggest_options(&mut self, options: Vec<std::rc::Rc<InputOption>>) -> &mut Self {
for option in options {
self.suggest_option(option);
}
@@ -67,7 +66,7 @@ impl CompletionSuggestions {
self
}
- pub fn get_option_suggestions(&self) -> &Vec<Rc<InputOption>> {
+ pub fn get_option_suggestions(&self) -> &Vec<std::rc::Rc<InputOption>> {
&self.option_suggestions
}
diff --git a/crates/shirabe-external-packages/src/symfony/console/cursor.rs b/crates/shirabe-external-packages/src/symfony/console/cursor.rs
index 05439df0..3ed9e3c2 100644
--- a/crates/shirabe-external-packages/src/symfony/console/cursor.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/cursor.rs
@@ -2,18 +2,16 @@
use crate::symfony::console::output::OutputInterface;
use crate::symfony::console::output::output_interface;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct Cursor {
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
input: shirabe_php_shim::PhpResource,
}
impl Cursor {
pub fn new(
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
input: Option<shirabe_php_shim::PhpResource>,
) -> Self {
let input = input.unwrap_or(shirabe_php_shim::STDIN);
diff --git a/crates/shirabe-external-packages/src/symfony/console/descriptor/application_description.rs b/crates/shirabe-external-packages/src/symfony/console/descriptor/application_description.rs
index 33f6a8ec..63127266 100644
--- a/crates/shirabe-external-packages/src/symfony/console/descriptor/application_description.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/descriptor/application_description.rs
@@ -5,13 +5,11 @@ use crate::symfony::console::command::command::Command;
use crate::symfony::console::exception::command_not_found_exception::CommandNotFoundException;
use indexmap::IndexMap;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
/// @internal
#[derive(Debug)]
pub struct ApplicationDescription {
- application: Rc<RefCell<dyn Application>>,
+ application: std::rc::Rc<std::cell::RefCell<dyn Application>>,
namespace: Option<String>,
show_hidden: bool,
@@ -20,17 +18,17 @@ pub struct ApplicationDescription {
namespaces: Option<IndexMap<String, IndexMap<String, PhpMixed>>>,
/// @var array<string, Command>
- commands: Option<IndexMap<String, Rc<RefCell<dyn Command>>>>,
+ commands: Option<IndexMap<String, std::rc::Rc<std::cell::RefCell<dyn Command>>>>,
/// @var array<string, Command>
- aliases: Option<IndexMap<String, Rc<RefCell<dyn Command>>>>,
+ aliases: Option<IndexMap<String, std::rc::Rc<std::cell::RefCell<dyn Command>>>>,
}
impl ApplicationDescription {
pub const GLOBAL_NAMESPACE: &'static str = "_global";
pub fn new(
- application: Rc<RefCell<dyn Application>>,
+ application: std::rc::Rc<std::cell::RefCell<dyn Application>>,
namespace: Option<String>,
show_hidden: bool,
) -> Self {
@@ -53,7 +51,9 @@ impl ApplicationDescription {
}
/// @return Command[]
- pub fn get_commands(&mut self) -> &IndexMap<String, Rc<RefCell<dyn Command>>> {
+ pub fn get_commands(
+ &mut self,
+ ) -> &IndexMap<String, std::rc::Rc<std::cell::RefCell<dyn Command>>> {
if self.commands.is_none() {
self.inspect_application();
}
@@ -62,7 +62,10 @@ impl ApplicationDescription {
}
/// @throws CommandNotFoundException
- pub fn get_command(&self, name: &str) -> anyhow::Result<Rc<RefCell<dyn Command>>> {
+ pub fn get_command(
+ &self,
+ name: &str,
+ ) -> anyhow::Result<std::rc::Rc<std::cell::RefCell<dyn Command>>> {
let in_commands = self
.commands
.as_ref()
@@ -144,13 +147,18 @@ impl ApplicationDescription {
fn sort_commands(
&self,
- commands: IndexMap<String, Rc<RefCell<dyn Command>>>,
- ) -> IndexMap<String, IndexMap<String, Rc<RefCell<dyn Command>>>> {
- let mut namespaced_commands: IndexMap<String, IndexMap<String, Rc<RefCell<dyn Command>>>> =
- IndexMap::new();
- let mut global_commands: IndexMap<String, Rc<RefCell<dyn Command>>> = IndexMap::new();
- let mut sorted_commands: IndexMap<String, IndexMap<String, Rc<RefCell<dyn Command>>>> =
+ commands: IndexMap<String, std::rc::Rc<std::cell::RefCell<dyn Command>>>,
+ ) -> IndexMap<String, IndexMap<String, std::rc::Rc<std::cell::RefCell<dyn Command>>>> {
+ let mut namespaced_commands: IndexMap<
+ String,
+ IndexMap<String, std::rc::Rc<std::cell::RefCell<dyn Command>>>,
+ > = IndexMap::new();
+ let mut global_commands: IndexMap<String, std::rc::Rc<std::cell::RefCell<dyn Command>>> =
IndexMap::new();
+ let mut sorted_commands: IndexMap<
+ String,
+ IndexMap<String, std::rc::Rc<std::cell::RefCell<dyn Command>>>,
+ > = IndexMap::new();
for (name, command) in commands {
let key = self.application.borrow().extract_namespace(&name, Some(1));
if ["", Self::GLOBAL_NAMESPACE].contains(&key.as_str()) {
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/debug_formatter_helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/debug_formatter_helper.rs
index d3731b1b..6fcbce8e 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/debug_formatter_helper.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/debug_formatter_helper.rs
@@ -4,8 +4,6 @@ use crate::symfony::console::helper::helper::Helper;
use crate::symfony::console::helper::helper_interface::HelperInterface;
use crate::symfony::console::helper::helper_set::HelperSet;
use indexmap::IndexMap;
-use std::cell::RefCell;
-use std::rc::Rc;
const COLORS: [&str; 9] = [
"black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "default",
@@ -163,11 +161,11 @@ impl DebugFormatterHelper {
}
impl HelperInterface for DebugFormatterHelper {
- fn set_helper_set(&mut self, helper_set: Option<Rc<RefCell<HelperSet>>>) {
+ fn set_helper_set(&mut self, helper_set: Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>) {
self.inner.set_helper_set(helper_set);
}
- fn get_helper_set(&self) -> Option<Rc<RefCell<HelperSet>>> {
+ fn get_helper_set(&self) -> Option<std::rc::Rc<std::cell::RefCell<HelperSet>>> {
self.inner.get_helper_set()
}
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/descriptor_helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/descriptor_helper.rs
index 83e946ca..d422f99f 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/descriptor_helper.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/descriptor_helper.rs
@@ -13,8 +13,6 @@ use crate::symfony::console::helper::helper_interface::HelperInterface;
use crate::symfony::console::helper::helper_set::HelperSet;
use crate::symfony::console::output::output_interface::OutputInterface;
use indexmap::IndexMap;
-use std::cell::RefCell;
-use std::rc::Rc;
/// This class adds helper method to describe objects in various formats.
#[derive(Default)]
@@ -113,11 +111,11 @@ impl DescriptorHelper {
}
impl HelperInterface for DescriptorHelper {
- fn set_helper_set(&mut self, helper_set: Option<Rc<RefCell<HelperSet>>>) {
+ fn set_helper_set(&mut self, helper_set: Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>) {
self.inner.set_helper_set(helper_set);
}
- fn get_helper_set(&self) -> Option<Rc<RefCell<HelperSet>>> {
+ fn get_helper_set(&self) -> Option<std::rc::Rc<std::cell::RefCell<HelperSet>>> {
self.inner.get_helper_set()
}
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/formatter_helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/formatter_helper.rs
index e26915e3..056a2ffe 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/formatter_helper.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/formatter_helper.rs
@@ -4,8 +4,6 @@ use crate::symfony::console::formatter::output_formatter::OutputFormatter;
use crate::symfony::console::helper::helper::Helper;
use crate::symfony::console::helper::helper_interface::HelperInterface;
use crate::symfony::console::helper::helper_set::HelperSet;
-use std::cell::RefCell;
-use std::rc::Rc;
/// The Formatter class provides helpers to format messages.
#[derive(Debug, Default)]
@@ -80,11 +78,11 @@ impl FormatterHelper {
}
impl HelperInterface for FormatterHelper {
- fn set_helper_set(&mut self, helper_set: Option<Rc<RefCell<HelperSet>>>) {
+ fn set_helper_set(&mut self, helper_set: Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>) {
self.inner.set_helper_set(helper_set);
}
- fn get_helper_set(&self) -> Option<Rc<RefCell<HelperSet>>> {
+ fn get_helper_set(&self) -> Option<std::rc::Rc<std::cell::RefCell<HelperSet>>> {
self.inner.get_helper_set()
}
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/helper.rs
index 64256591..be5eb050 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/helper.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/helper.rs
@@ -3,21 +3,22 @@
use crate::symfony::console::formatter::output_formatter_interface::OutputFormatterInterface;
use crate::symfony::console::helper::helper_set::HelperSet;
use crate::symfony::string::unicode_string::UnicodeString;
-use std::cell::RefCell;
-use std::rc::Rc;
/// Helper is the base class for all helper classes.
#[derive(Debug, Default)]
pub struct Helper {
- pub(crate) helper_set: Option<Rc<RefCell<HelperSet>>>,
+ pub(crate) helper_set: Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>,
}
impl Helper {
- pub fn set_helper_set(&mut self, helper_set: Option<Rc<RefCell<HelperSet>>>) {
+ pub fn set_helper_set(
+ &mut self,
+ helper_set: Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>,
+ ) {
self.helper_set = helper_set;
}
- pub fn get_helper_set(&self) -> Option<Rc<RefCell<HelperSet>>> {
+ pub fn get_helper_set(&self) -> Option<std::rc::Rc<std::cell::RefCell<HelperSet>>> {
self.helper_set.clone()
}
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/helper_interface.rs b/crates/shirabe-external-packages/src/symfony/console/helper/helper_interface.rs
index 4d767bfe..8dae6c85 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/helper_interface.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/helper_interface.rs
@@ -1,16 +1,14 @@
//! ref: composer/vendor/symfony/console/Helper/HelperInterface.php
use crate::symfony::console::helper::helper_set::HelperSet;
-use std::cell::RefCell;
-use std::rc::Rc;
/// HelperInterface is the interface all helpers must implement.
pub trait HelperInterface: std::fmt::Debug + shirabe_php_shim::AsAny {
/// Sets the helper set associated with this helper.
- fn set_helper_set(&mut self, helper_set: Option<Rc<RefCell<HelperSet>>>);
+ fn set_helper_set(&mut self, helper_set: Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>);
/// Gets the helper set associated with this helper.
- fn get_helper_set(&self) -> Option<Rc<RefCell<HelperSet>>>;
+ fn get_helper_set(&self) -> Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>;
/// Returns the canonical name of this helper.
fn get_name(&self) -> String;
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/helper_set.rs b/crates/shirabe-external-packages/src/symfony/console/helper/helper_set.rs
index d72b6277..b505fedf 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/helper_set.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/helper_set.rs
@@ -5,8 +5,6 @@ use crate::symfony::console::helper::formatter_helper::FormatterHelper;
use crate::symfony::console::helper::helper_interface::HelperInterface;
use crate::symfony::console::helper::process_helper::ProcessHelper;
use crate::symfony::console::helper::question_helper::QuestionHelper;
-use std::cell::RefCell;
-use std::rc::Rc;
/// HelperSet represents a set of helpers to be used with a command.
///
@@ -20,22 +18,24 @@ use std::rc::Rc;
/// lookup) is deferred until the plugin API is implemented.
#[derive(Debug)]
pub struct HelperSet {
- formatter_helper: Rc<RefCell<FormatterHelper>>,
- debug_formatter_helper: Rc<RefCell<DebugFormatterHelper>>,
- process_helper: Rc<RefCell<ProcessHelper>>,
- question_helper: Rc<RefCell<QuestionHelper>>,
+ formatter_helper: std::rc::Rc<std::cell::RefCell<FormatterHelper>>,
+ debug_formatter_helper: std::rc::Rc<std::cell::RefCell<DebugFormatterHelper>>,
+ process_helper: std::rc::Rc<std::cell::RefCell<ProcessHelper>>,
+ question_helper: std::rc::Rc<std::cell::RefCell<QuestionHelper>>,
}
impl HelperSet {
/// Builds the fixed set of helpers and wires each one's back-reference to the owning set,
/// mirroring the `$helper->setHelperSet($this)` call PHP's `HelperSet::set()` performs.
- pub fn new() -> Rc<RefCell<HelperSet>> {
- let formatter_helper = Rc::new(RefCell::new(FormatterHelper::default()));
- let debug_formatter_helper = Rc::new(RefCell::new(DebugFormatterHelper::default()));
- let process_helper = Rc::new(RefCell::new(ProcessHelper::default()));
- let question_helper = Rc::new(RefCell::new(QuestionHelper::default()));
+ pub fn new() -> std::rc::Rc<std::cell::RefCell<HelperSet>> {
+ let formatter_helper =
+ std::rc::Rc::new(std::cell::RefCell::new(FormatterHelper::default()));
+ let debug_formatter_helper =
+ std::rc::Rc::new(std::cell::RefCell::new(DebugFormatterHelper::default()));
+ let process_helper = std::rc::Rc::new(std::cell::RefCell::new(ProcessHelper::default()));
+ let question_helper = std::rc::Rc::new(std::cell::RefCell::new(QuestionHelper::default()));
- let this = Rc::new(RefCell::new(HelperSet {
+ let this = std::rc::Rc::new(std::cell::RefCell::new(HelperSet {
formatter_helper: formatter_helper.clone(),
debug_formatter_helper: debug_formatter_helper.clone(),
process_helper: process_helper.clone(),
@@ -58,19 +58,19 @@ impl HelperSet {
this
}
- pub fn get_formatter(&self) -> Rc<RefCell<FormatterHelper>> {
+ pub fn get_formatter(&self) -> std::rc::Rc<std::cell::RefCell<FormatterHelper>> {
self.formatter_helper.clone()
}
- pub fn get_debug_formatter(&self) -> Rc<RefCell<DebugFormatterHelper>> {
+ pub fn get_debug_formatter(&self) -> std::rc::Rc<std::cell::RefCell<DebugFormatterHelper>> {
self.debug_formatter_helper.clone()
}
- pub fn get_process(&self) -> Rc<RefCell<ProcessHelper>> {
+ pub fn get_process(&self) -> std::rc::Rc<std::cell::RefCell<ProcessHelper>> {
self.process_helper.clone()
}
- pub fn get_question(&self) -> Rc<RefCell<QuestionHelper>> {
+ pub fn get_question(&self) -> std::rc::Rc<std::cell::RefCell<QuestionHelper>> {
self.question_helper.clone()
}
}
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/process_helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/process_helper.rs
index 28e2329a..58d1ea3f 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/process_helper.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/process_helper.rs
@@ -8,8 +8,6 @@ use crate::symfony::console::output::ConsoleOutputInterface;
use crate::symfony::console::output::output_interface::{self, OutputInterface};
use crate::symfony::process::exception::process_failed_exception::ProcessFailedException;
use crate::symfony::process::process::Process;
-use std::cell::RefCell;
-use std::rc::Rc;
/// The ProcessHelper class provides helpers to run external processes.
///
@@ -41,7 +39,7 @@ impl ProcessHelper {
/// output available on STDOUT or STDERR
pub fn run(
&self,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
cmd: ProcessHelperCmd,
error: Option<&str>,
callback: Option<Box<dyn FnMut(&str, &str)>>,
@@ -54,14 +52,14 @@ impl ProcessHelper {
// $output->getErrorOutput(); }`. ConsoleOutput is the only OutputInterface
// implementor that also implements ConsoleOutputInterface, so the check
// reduces to a downcast to the concrete type.
- let output: Rc<RefCell<dyn OutputInterface>> = {
+ let output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> = {
let redirected = shirabe_php_shim::AsAny::as_any(&*output.borrow())
.downcast_ref::<crate::symfony::console::output::console_output::ConsoleOutput>()
.map(|console| console.get_error_output());
redirected.unwrap_or(output)
};
- let formatter: Rc<RefCell<DebugFormatterHelper>> = self
+ let formatter: std::rc::Rc<std::cell::RefCell<DebugFormatterHelper>> = self
.get_helper_set()
.unwrap()
.borrow()
@@ -200,7 +198,7 @@ impl ProcessHelper {
/// @see run()
pub fn must_run(
&self,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
cmd: ProcessHelperCmd,
error: Option<&str>,
callback: Option<Box<dyn FnMut(&str, &str)>>,
@@ -223,7 +221,7 @@ impl ProcessHelper {
/// Wraps a Process callback to add debugging output.
pub fn wrap_callback(
&self,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
process: &Process,
mut callback: Option<Box<dyn FnMut(&str, &str)>>,
) -> Box<dyn FnMut(&str, &str)> {
@@ -231,14 +229,14 @@ impl ProcessHelper {
// $output->getErrorOutput(); }`. ConsoleOutput is the only OutputInterface
// implementor that also implements ConsoleOutputInterface, so the check
// reduces to a downcast to the concrete type.
- let output: Rc<RefCell<dyn OutputInterface>> = {
+ let output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> = {
let redirected = shirabe_php_shim::AsAny::as_any(&*output.borrow())
.downcast_ref::<crate::symfony::console::output::console_output::ConsoleOutput>()
.map(|console| console.get_error_output());
redirected.unwrap_or(output)
};
- let formatter: Rc<RefCell<DebugFormatterHelper>> = self
+ let formatter: std::rc::Rc<std::cell::RefCell<DebugFormatterHelper>> = self
.get_helper_set()
.unwrap()
.borrow()
@@ -272,7 +270,7 @@ impl ProcessHelper {
}
fn formatter_start(
- formatter: &Rc<RefCell<DebugFormatterHelper>>,
+ formatter: &std::rc::Rc<std::cell::RefCell<DebugFormatterHelper>>,
id: &str,
message: &str,
) -> String {
@@ -280,7 +278,7 @@ impl ProcessHelper {
}
fn formatter_stop(
- formatter: &Rc<RefCell<DebugFormatterHelper>>,
+ formatter: &std::rc::Rc<std::cell::RefCell<DebugFormatterHelper>>,
id: &str,
message: &str,
successful: bool,
@@ -289,7 +287,7 @@ impl ProcessHelper {
}
fn formatter_progress(
- formatter: &Rc<RefCell<DebugFormatterHelper>>,
+ formatter: &std::rc::Rc<std::cell::RefCell<DebugFormatterHelper>>,
id: &str,
buffer: &str,
error: bool,
@@ -301,11 +299,11 @@ impl ProcessHelper {
}
impl HelperInterface for ProcessHelper {
- fn set_helper_set(&mut self, helper_set: Option<Rc<RefCell<HelperSet>>>) {
+ fn set_helper_set(&mut self, helper_set: Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>) {
self.inner.set_helper_set(helper_set);
}
- fn get_helper_set(&self) -> Option<Rc<RefCell<HelperSet>>> {
+ fn get_helper_set(&self) -> Option<std::rc::Rc<std::cell::RefCell<HelperSet>>> {
self.inner.get_helper_set()
}
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/progress_bar.rs b/crates/shirabe-external-packages/src/symfony/console/helper/progress_bar.rs
index a18e62f5..0abee1e7 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/progress_bar.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/progress_bar.rs
@@ -9,8 +9,6 @@ use crate::symfony::console::output::OutputInterface;
use crate::symfony::console::output::output_interface;
use crate::symfony::console::terminal::Terminal;
use indexmap::IndexMap;
-use std::cell::RefCell;
-use std::rc::Rc;
pub const FORMAT_VERBOSE: &str = "verbose";
pub const FORMAT_VERY_VERBOSE: &str = "very_verbose";
@@ -26,7 +24,7 @@ const FORMAT_NORMAL_NOMAX: &str = "normal_nomax";
pub type PlaceholderFormatter = Box<
dyn Fn(
&ProgressBar,
- &Rc<RefCell<dyn OutputInterface>>,
+ &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<Result<shirabe_php_shim::PhpMixed, LogicException>>,
>;
@@ -44,7 +42,7 @@ pub struct ProgressBar {
last_write_time: f64,
min_seconds_between_redraws: f64,
max_seconds_between_redraws: f64,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
step: i64,
max: i64,
start_time: i64,
@@ -58,14 +56,14 @@ pub struct ProgressBar {
}
thread_local! {
- static FORMATTERS: RefCell<Option<IndexMap<String, PlaceholderFormatter>>> = const { RefCell::new(None) };
- static FORMATS: RefCell<Option<IndexMap<String, String>>> = const { RefCell::new(None) };
+ static FORMATTERS: std::cell::RefCell<Option<IndexMap<String, PlaceholderFormatter>>> = const { std::cell::RefCell::new(None) };
+ static FORMATS: std::cell::RefCell<Option<IndexMap<String, String>>> = const { std::cell::RefCell::new(None) };
}
impl ProgressBar {
/// `$max` Maximum steps (0 if unknown)
pub fn new(
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
max: i64,
min_seconds_between_redraws: f64,
) -> Self {
@@ -73,7 +71,7 @@ impl ProgressBar {
// $output->getErrorOutput(); }`. ConsoleOutput is the only OutputInterface
// implementor that also implements ConsoleOutputInterface, so the check
// reduces to a downcast to the concrete type.
- let output: Rc<RefCell<dyn OutputInterface>> = {
+ let output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> = {
let redirected = shirabe_php_shim::AsAny::as_any(&*output.borrow())
.downcast_ref::<crate::symfony::console::output::console_output::ConsoleOutput>()
.map(|console| console.get_error_output());
@@ -596,7 +594,8 @@ impl ProgressBar {
formatters.insert(
"bar".to_string(),
Box::new(
- |bar: &ProgressBar, output: &Rc<RefCell<dyn OutputInterface>>| {
+ |bar: &ProgressBar,
+ output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>| {
let complete_bars = bar.get_bar_offset();
let mut display = shirabe_php_shim::str_repeat(
&bar.get_bar_character(),
@@ -627,7 +626,8 @@ impl ProgressBar {
formatters.insert(
"elapsed".to_string(),
Box::new(
- |bar: &ProgressBar, _output: &Rc<RefCell<dyn OutputInterface>>| {
+ |bar: &ProgressBar,
+ _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>| {
Ok(Ok(shirabe_php_shim::PhpMixed::String(
Helper::format_time(
(shirabe_php_shim::time() - bar.get_start_time()) as f64,
@@ -640,7 +640,7 @@ impl ProgressBar {
formatters.insert(
"remaining".to_string(),
- Box::new(|bar: &ProgressBar, _output: &Rc<RefCell<dyn OutputInterface>>| {
+ Box::new(|bar: &ProgressBar, _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>| {
if bar.get_max_steps() == 0 {
return Ok(Err(LogicException(shirabe_php_shim::LogicException {
message: "Unable to display the remaining time if the maximum number of steps is not set.".to_string(),
@@ -656,7 +656,7 @@ impl ProgressBar {
formatters.insert(
"estimated".to_string(),
- Box::new(|bar: &ProgressBar, _output: &Rc<RefCell<dyn OutputInterface>>| {
+ Box::new(|bar: &ProgressBar, _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>| {
if bar.get_max_steps() == 0 {
return Ok(Err(LogicException(shirabe_php_shim::LogicException {
message: "Unable to display the estimated time if the maximum number of steps is not set.".to_string(),
@@ -673,7 +673,8 @@ impl ProgressBar {
formatters.insert(
"memory".to_string(),
Box::new(
- |_bar: &ProgressBar, _output: &Rc<RefCell<dyn OutputInterface>>| {
+ |_bar: &ProgressBar,
+ _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>| {
Ok(Ok(shirabe_php_shim::PhpMixed::String(
Helper::format_memory(shirabe_php_shim::memory_get_usage()),
)))
@@ -684,7 +685,8 @@ impl ProgressBar {
formatters.insert(
"current".to_string(),
Box::new(
- |bar: &ProgressBar, _output: &Rc<RefCell<dyn OutputInterface>>| {
+ |bar: &ProgressBar,
+ _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>| {
Ok(Ok(shirabe_php_shim::PhpMixed::String(
shirabe_php_shim::str_pad(
&bar.get_progress().to_string(),
@@ -700,7 +702,8 @@ impl ProgressBar {
formatters.insert(
"max".to_string(),
Box::new(
- |bar: &ProgressBar, _output: &Rc<RefCell<dyn OutputInterface>>| {
+ |bar: &ProgressBar,
+ _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>| {
Ok(Ok(shirabe_php_shim::PhpMixed::Int(bar.get_max_steps())))
},
),
@@ -709,7 +712,8 @@ impl ProgressBar {
formatters.insert(
"percent".to_string(),
Box::new(
- |bar: &ProgressBar, _output: &Rc<RefCell<dyn OutputInterface>>| {
+ |bar: &ProgressBar,
+ _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>| {
Ok(Ok(shirabe_php_shim::PhpMixed::Float(
(bar.get_progress_percent() * 100.0).floor(),
)))
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs
index b6d096aa..3f95f4da 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs
@@ -20,8 +20,6 @@ use crate::symfony::console::question::QuestionInterface;
use crate::symfony::console::terminal::Terminal;
use crate::symfony::string::s;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
/// The QuestionHelper class provides helpers to interact with the user.
#[derive(Debug, Default)]
@@ -46,7 +44,7 @@ impl QuestionHelper {
pub fn ask(
&mut self,
input: &mut dyn InputInterface,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
question: &impl QuestionInterface,
) -> anyhow::Result<Result<PhpMixed, MissingInputException>> {
let mut output = output;
@@ -73,12 +71,12 @@ impl QuestionHelper {
let result: anyhow::Result<Result<PhpMixed, MissingInputException>> = (|| {
if question.get_validator().is_none() {
- return self.do_ask(Rc::clone(&output), question);
+ return self.do_ask(std::rc::Rc::clone(&output), question);
}
- let interviewer = || self.do_ask(Rc::clone(&output), question);
+ let interviewer = || self.do_ask(std::rc::Rc::clone(&output), question);
- self.validate_attempts(&interviewer, Rc::clone(&output), question)
+ self.validate_attempts(&interviewer, std::rc::Rc::clone(&output), question)
})();
let result = result?;
@@ -113,10 +111,10 @@ impl QuestionHelper {
/// @throws RuntimeException In case the fallback is deactivated and the response cannot be hidden
fn do_ask(
&self,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
question: &impl QuestionInterface,
) -> anyhow::Result<Result<PhpMixed, MissingInputException>> {
- self.write_prompt(Rc::clone(&output), question);
+ self.write_prompt(std::rc::Rc::clone(&output), question);
let input_stream = self
.input_stream
@@ -134,8 +132,12 @@ impl QuestionHelper {
// The autocompleter callback yields an iterable (Option here); PHP
// treats a null result as an empty list of suggestions.
let callback = move |input: &str| callback(input).unwrap_or_default();
- let autocomplete =
- self.autocomplete(Rc::clone(&output), question, &input_stream, &callback);
+ let autocomplete = self.autocomplete(
+ std::rc::Rc::clone(&output),
+ question,
+ &input_stream,
+ &callback,
+ );
ret = PhpMixed::String(if question.is_trimmable() {
shirabe_php_shim::trim(&autocomplete, None)
} else {
@@ -145,7 +147,7 @@ impl QuestionHelper {
let mut r: PhpMixed = PhpMixed::Bool(false);
if question.is_hidden() {
match self.get_hidden_response(
- Rc::clone(&output),
+ std::rc::Rc::clone(&output),
&input_stream,
question.is_trimmable(),
)? {
@@ -261,7 +263,7 @@ impl QuestionHelper {
/// Outputs the question prompt.
pub(crate) fn write_prompt(
&self,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
question: &impl QuestionInterface,
) {
let mut message = question.get_question().to_string();
@@ -313,7 +315,7 @@ impl QuestionHelper {
/// Outputs an error message.
pub(crate) fn write_error(
&self,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
error: &shirabe_php_shim::Exception,
) {
let message = if let Some(helper_set) = self.get_helper_set() {
@@ -338,12 +340,12 @@ impl QuestionHelper {
/// @param resource $inputStream
fn autocomplete(
&self,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
question: &impl QuestionInterface,
input_stream: &shirabe_php_shim::PhpResource,
autocomplete: &dyn Fn(&str) -> Vec<PhpMixed>,
) -> String {
- let cursor = Cursor::new(Rc::clone(&output), Some(input_stream.clone()));
+ let cursor = Cursor::new(std::rc::Rc::clone(&output), Some(input_stream.clone()));
let mut full_choice = String::new();
let mut ret = String::new();
@@ -594,7 +596,7 @@ impl QuestionHelper {
/// @throws RuntimeException In case the fallback is deactivated and the response cannot be hidden
fn get_hidden_response(
&self,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
input_stream: &shirabe_php_shim::PhpResource,
trimmable: bool,
) -> anyhow::Result<Result<String, RuntimeException>> {
@@ -679,7 +681,7 @@ impl QuestionHelper {
fn validate_attempts(
&self,
interviewer: &dyn Fn() -> anyhow::Result<Result<PhpMixed, MissingInputException>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
question: &impl QuestionInterface,
) -> anyhow::Result<Result<PhpMixed, MissingInputException>> {
let mut error: Option<shirabe_php_shim::Exception> = None;
@@ -694,7 +696,7 @@ impl QuestionHelper {
}
if let Some(ref error) = error {
- self.write_error(Rc::clone(&output), error);
+ self.write_error(std::rc::Rc::clone(&output), error);
}
let interviewed = match interviewer()? {
@@ -876,11 +878,11 @@ fn magic_file() -> String {
}
impl HelperInterface for QuestionHelper {
- fn set_helper_set(&mut self, helper_set: Option<Rc<RefCell<HelperSet>>>) {
+ fn set_helper_set(&mut self, helper_set: Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>) {
self.inner.set_helper_set(helper_set);
}
- fn get_helper_set(&self) -> Option<Rc<RefCell<HelperSet>>> {
+ fn get_helper_set(&self) -> Option<std::rc::Rc<std::cell::RefCell<HelperSet>>> {
self.inner.get_helper_set()
}
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/symfony_question_helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/symfony_question_helper.rs
index a5118f4e..786141e9 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/symfony_question_helper.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/symfony_question_helper.rs
@@ -7,9 +7,7 @@ use crate::symfony::console::output::output_interface::OutputInterface;
use crate::symfony::console::question::QuestionInterface;
use crate::symfony::console::style::symfony_style::SymfonyStyle;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
use std::ops::{Deref, DerefMut};
-use std::rc::Rc;
/// Symfony Style Guide compliant question helper.
#[derive(Debug, Default)]
@@ -24,7 +22,7 @@ impl SymfonyQuestionHelper {
pub(crate) fn write_prompt(
&self,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
question: &impl QuestionInterface,
) {
let mut text = OutputFormatter::escape_trailing_backslash(question.get_question());
@@ -112,7 +110,7 @@ impl SymfonyQuestionHelper {
pub(crate) fn write_error(
&self,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
error: &shirabe_php_shim::Exception,
) {
let is_symfony_style = {
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 04d5f1f6..cae3f896 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/table.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/table.rs
@@ -15,8 +15,6 @@ use crate::symfony::console::output::console_section_output::ConsoleSectionOutpu
use crate::symfony::console::output::output_interface::OutputInterface;
use indexmap::IndexMap;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
/// A single cell within a table row.
///
@@ -58,7 +56,7 @@ impl Cell {
}
}
- fn style(&self) -> Option<Rc<TableCellStyle>> {
+ fn style(&self) -> Option<std::rc::Rc<TableCellStyle>> {
match self {
Cell::Cell(c) => c.get_style(),
Cell::Separator(s) => s.get_style(),
@@ -246,7 +244,7 @@ pub struct Table {
/// Number of columns cache.
number_of_columns: Option<i64>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
style: TableStyle,
@@ -276,7 +274,7 @@ fn styles() -> &'static std::sync::Mutex<Option<IndexMap<String, TableStyle>>> {
}
impl Table {
- pub fn new(output: Rc<RefCell<dyn OutputInterface>>) -> Self {
+ pub fn new(output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>) -> Self {
let mut styles_guard = styles().lock().unwrap();
if styles_guard.is_none() {
*styles_guard = Some(Self::init_styles());
@@ -1383,7 +1381,9 @@ impl Table {
)))
}
- fn formatter_is_wrappable(_output: &Rc<RefCell<dyn OutputInterface>>) -> bool {
+ fn formatter_is_wrappable(
+ _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
+ ) -> bool {
// PHP: $this->output->getFormatter() instanceof WrappableOutputFormatterInterface
// TODO(phase-c/d): instanceof on `dyn OutputFormatterInterface` needs an AsAny supertrait
// on OutputFormatterInterface to downcast to the concrete wrappable formatter; adding it
@@ -1399,7 +1399,9 @@ impl Table {
Helper::remove_decoration(&mut *formatter, string)
}
- fn output_is_console_section(output: &Rc<RefCell<dyn OutputInterface>>) -> bool {
+ fn output_is_console_section(
+ output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
+ ) -> bool {
// PHP: $this->output instanceof ConsoleSectionOutput
let borrowed = output.borrow();
(*borrowed)
@@ -1417,7 +1419,7 @@ impl Table {
fn table_cell_options_colspan_style(
colspan: i64,
- style: Option<Rc<TableCellStyle>>,
+ style: Option<std::rc::Rc<TableCellStyle>>,
) -> IndexMap<String, TableCellOption> {
// PHP: ['colspan' => $colspan, 'style' => $style]
let mut options = IndexMap::new();
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/table_cell.rs b/crates/shirabe-external-packages/src/symfony/console/helper/table_cell.rs
index b85b7d1d..2b1e592b 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/table_cell.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/table_cell.rs
@@ -3,13 +3,12 @@
use crate::symfony::console::exception::invalid_argument_exception::InvalidArgumentException;
use crate::symfony::console::helper::table_cell_style::TableCellStyle;
use indexmap::IndexMap;
-use std::rc::Rc;
/// A `TableCell` option value: an integer span, a `TableCellStyle`, or null.
#[derive(Debug, Clone)]
pub enum TableCellOption {
Int(i64),
- Style(Rc<TableCellStyle>),
+ Style(std::rc::Rc<TableCellStyle>),
Null,
}
@@ -94,7 +93,7 @@ impl TableCell {
}
}
- pub fn get_style(&self) -> Option<Rc<TableCellStyle>> {
+ pub fn get_style(&self) -> Option<std::rc::Rc<TableCellStyle>> {
match &self.options["style"] {
TableCellOption::Style(style) => Some(style.clone()),
_ => None,
diff --git a/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs b/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs
index 279811fb..2c06b05f 100644
--- a/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs
@@ -6,7 +6,6 @@ use crate::symfony::console::input::input_argument::InputArgument;
use crate::symfony::console::input::input_option::InputOption;
use indexmap::IndexMap;
use shirabe_php_shim::PhpMixed;
-use std::rc::Rc;
/// A InputDefinition represents a set of valid command line arguments and options.
///
@@ -15,11 +14,11 @@ use std::rc::Rc;
/// (PHP `bind` assigns the definition by reference).
#[derive(Debug, Clone)]
pub struct InputDefinition {
- arguments: IndexMap<String, Rc<InputArgument>>,
+ arguments: IndexMap<String, std::rc::Rc<InputArgument>>,
required_count: i64,
- last_array_argument: Option<Rc<InputArgument>>,
- last_optional_argument: Option<Rc<InputArgument>>,
- options: IndexMap<String, Rc<InputOption>>,
+ last_array_argument: Option<std::rc::Rc<InputArgument>>,
+ last_optional_argument: Option<std::rc::Rc<InputArgument>>,
+ options: IndexMap<String, std::rc::Rc<InputOption>>,
negations: IndexMap<String, String>,
shortcuts: IndexMap<String, String>,
}
@@ -50,7 +49,7 @@ impl InputDefinition {
/// reference, mirroring `new InputDefinition($definition->getOptions())`.
/// `InputOption` is not `Clone` and lives behind `Rc`, so the options are
/// reused rather than reconstructed by value.
- pub fn from_options(options: Vec<Rc<InputOption>>) -> anyhow::Result<Self> {
+ pub fn from_options(options: Vec<std::rc::Rc<InputOption>>) -> anyhow::Result<Self> {
let mut input_definition = InputDefinition {
arguments: IndexMap::new(),
required_count: 0,
@@ -108,7 +107,7 @@ impl InputDefinition {
}
pub fn add_argument(&mut self, argument: InputArgument) -> anyhow::Result<()> {
- let argument = Rc::new(argument);
+ let argument = std::rc::Rc::new(argument);
if self.arguments.contains_key(argument.get_name()) {
return Err(LogicException(shirabe_php_shim::LogicException {
@@ -148,13 +147,13 @@ impl InputDefinition {
}
if argument.is_array() {
- self.last_array_argument = Some(Rc::clone(&argument));
+ self.last_array_argument = Some(std::rc::Rc::clone(&argument));
}
if argument.is_required() {
self.required_count += 1;
} else {
- self.last_optional_argument = Some(Rc::clone(&argument));
+ self.last_optional_argument = Some(std::rc::Rc::clone(&argument));
}
self.arguments
@@ -164,7 +163,7 @@ impl InputDefinition {
}
/// Returns an InputArgument by name or by position.
- pub fn get_argument(&self, name: &PhpMixed) -> anyhow::Result<Rc<InputArgument>> {
+ pub fn get_argument(&self, name: &PhpMixed) -> anyhow::Result<std::rc::Rc<InputArgument>> {
if !self.has_argument(name) {
return Err(
InvalidArgumentException(shirabe_php_shim::InvalidArgumentException {
@@ -177,12 +176,13 @@ impl InputDefinition {
match name {
PhpMixed::Int(index) => {
- let arguments: Vec<Rc<InputArgument>> = self.arguments.values().cloned().collect();
- Ok(Rc::clone(&arguments[*index as usize]))
+ let arguments: Vec<std::rc::Rc<InputArgument>> =
+ self.arguments.values().cloned().collect();
+ Ok(std::rc::Rc::clone(&arguments[*index as usize]))
}
_ => {
let key = shirabe_php_shim::php_to_string(name);
- Ok(Rc::clone(&self.arguments[&key]))
+ Ok(std::rc::Rc::clone(&self.arguments[&key]))
}
}
}
@@ -191,7 +191,8 @@ impl InputDefinition {
pub fn has_argument(&self, name: &PhpMixed) -> bool {
match name {
PhpMixed::Int(index) => {
- let arguments: Vec<Rc<InputArgument>> = self.arguments.values().cloned().collect();
+ let arguments: Vec<std::rc::Rc<InputArgument>> =
+ self.arguments.values().cloned().collect();
*index >= 0 && (*index as usize) < arguments.len()
}
_ => {
@@ -202,7 +203,7 @@ impl InputDefinition {
}
/// Gets the array of InputArgument objects.
- pub fn get_arguments(&self) -> &IndexMap<String, Rc<InputArgument>> {
+ pub fn get_arguments(&self) -> &IndexMap<String, std::rc::Rc<InputArgument>> {
&self.arguments
}
@@ -250,12 +251,12 @@ impl InputDefinition {
}
pub fn add_option(&mut self, option: InputOption) -> anyhow::Result<()> {
- self.add_option_rc(Rc::new(option))
+ self.add_option_rc(std::rc::Rc::new(option))
}
/// Adds an option that is already shared behind `Rc`, mirroring PHP passing
/// `InputOption` objects by reference.
- pub fn add_option_rc(&mut self, option: Rc<InputOption>) -> anyhow::Result<()> {
+ pub fn add_option_rc(&mut self, option: std::rc::Rc<InputOption>) -> anyhow::Result<()> {
if let Some(existing) = self.options.get(option.get_name())
&& !option.equals(existing)
{
@@ -291,7 +292,7 @@ impl InputDefinition {
}
self.options
- .insert(option.get_name().to_string(), Rc::clone(&option));
+ .insert(option.get_name().to_string(), std::rc::Rc::clone(&option));
if let Some(shortcut) = option.get_shortcut() {
for shortcut in shirabe_php_shim::explode("|", shortcut) {
self.shortcuts
@@ -319,7 +320,7 @@ impl InputDefinition {
}
/// Returns an InputOption by name.
- pub fn get_option(&self, name: &str) -> anyhow::Result<Rc<InputOption>> {
+ pub fn get_option(&self, name: &str) -> anyhow::Result<std::rc::Rc<InputOption>> {
if !self.has_option(name) {
return Err(
InvalidArgumentException(shirabe_php_shim::InvalidArgumentException {
@@ -330,7 +331,7 @@ impl InputDefinition {
);
}
- Ok(Rc::clone(&self.options[name]))
+ Ok(std::rc::Rc::clone(&self.options[name]))
}
/// Returns true if an InputOption object exists by name.
@@ -342,7 +343,7 @@ impl InputDefinition {
}
/// Gets the array of InputOption objects.
- pub fn get_options(&self) -> &IndexMap<String, Rc<InputOption>> {
+ pub fn get_options(&self) -> &IndexMap<String, std::rc::Rc<InputOption>> {
&self.options
}
@@ -357,7 +358,10 @@ impl InputDefinition {
}
/// Gets an InputOption by shortcut.
- pub fn get_option_for_shortcut(&self, shortcut: &str) -> anyhow::Result<Rc<InputOption>> {
+ pub fn get_option_for_shortcut(
+ &self,
+ shortcut: &str,
+ ) -> anyhow::Result<std::rc::Rc<InputOption>> {
self.get_option(&self.shortcut_to_name(shortcut)?)
}
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 9a162746..12fd3dcb 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
@@ -7,17 +7,15 @@ use crate::symfony::console::output::OutputInterface;
use crate::symfony::console::output::output_interface::OUTPUT_NORMAL;
use crate::symfony::console::style::style_interface::StyleInterface;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
/// Decorates output to add console style guide helpers.
#[derive(Debug)]
pub struct OutputStyle {
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
}
impl OutputStyle {
- pub fn new(output: Rc<RefCell<dyn OutputInterface>>) -> Self {
+ pub fn new(output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>) -> Self {
Self { output }
}
@@ -25,7 +23,7 @@ impl OutputStyle {
ProgressBar::new(self.output.clone(), max, 1.0 / 25.0)
}
- pub(crate) fn get_error_output(&self) -> Rc<RefCell<dyn OutputInterface>> {
+ pub(crate) fn get_error_output(&self) -> std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> {
// PHP checks `$this->output instanceof ConsoleOutputInterface`; this requires
// runtime type information that the OutputInterface trait object lacks.
if !Self::is_console_output_interface(&self.output) {
@@ -38,7 +36,9 @@ impl OutputStyle {
.get_error_output()
}
- fn is_console_output_interface(output: &Rc<RefCell<dyn OutputInterface>>) -> bool {
+ fn is_console_output_interface(
+ output: &std::rc::Rc<std::cell::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())
@@ -47,8 +47,8 @@ impl OutputStyle {
}
fn as_console_output_interface(
- _output: &Rc<RefCell<dyn OutputInterface>>,
- ) -> Option<Rc<RefCell<dyn ConsoleOutputInterface>>> {
+ _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
+ ) -> Option<std::rc::Rc<std::cell::RefCell<dyn ConsoleOutputInterface>>> {
todo!()
}
}
@@ -94,11 +94,14 @@ impl OutputInterface for OutputStyle {
self.output.borrow().is_decorated()
}
- fn set_formatter(&self, formatter: Rc<RefCell<dyn OutputFormatterInterface>>) {
+ fn set_formatter(
+ &self,
+ formatter: std::rc::Rc<std::cell::RefCell<dyn OutputFormatterInterface>>,
+ ) {
self.output.borrow().set_formatter(formatter);
}
- fn get_formatter(&self) -> Rc<RefCell<dyn OutputFormatterInterface>> {
+ fn get_formatter(&self) -> std::rc::Rc<std::cell::RefCell<dyn OutputFormatterInterface>> {
self.output.borrow().get_formatter()
}
}
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 425c815b..69cd4191 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
@@ -24,15 +24,13 @@ use crate::symfony::console::style::output_style::OutputStyle;
use crate::symfony::console::style::style_interface::StyleInterface;
use crate::symfony::console::terminal::Terminal;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
/// Output decorator helpers for the Symfony Style Guide.
#[derive(Debug)]
pub struct SymfonyStyle {
inner: OutputStyle,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
question_helper: Option<SymfonyQuestionHelper>,
progress_bar: Option<ProgressBar>,
line_length: i64,
@@ -43,8 +41,8 @@ pub const MAX_LINE_LENGTH: i64 = 120;
impl SymfonyStyle {
pub fn new(
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> Self {
let buffered_output = TrimmedBufferOutput::new(
if std::path::MAIN_SEPARATOR == '\\' {
@@ -260,7 +258,7 @@ impl SymfonyStyle {
Self::as_console_output_interface(&self.output)
.unwrap()
.borrow()
- .section() as Rc<RefCell<dyn OutputInterface>>
+ .section() as std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>
} else {
self.output.clone()
};
@@ -435,11 +433,13 @@ impl SymfonyStyle {
lines
}
- fn get_formatter(&self) -> Rc<RefCell<dyn OutputFormatterInterface>> {
+ fn get_formatter(&self) -> std::rc::Rc<std::cell::RefCell<dyn OutputFormatterInterface>> {
self.output.borrow().get_formatter()
}
- fn is_console_output_interface(output: &Rc<RefCell<dyn OutputInterface>>) -> bool {
+ fn is_console_output_interface(
+ output: &std::rc::Rc<std::cell::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())
@@ -448,8 +448,8 @@ impl SymfonyStyle {
}
fn as_console_output_interface(
- _output: &Rc<RefCell<dyn OutputInterface>>,
- ) -> Option<Rc<RefCell<dyn ConsoleOutputInterface>>> {
+ _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
+ ) -> Option<std::rc::Rc<std::cell::RefCell<dyn ConsoleOutputInterface>>> {
todo!()
}
diff --git a/crates/shirabe-external-packages/src/symfony/finder/finder.rs b/crates/shirabe-external-packages/src/symfony/finder/finder.rs
index 2a7e5442..7d3bdc10 100644
--- a/crates/shirabe-external-packages/src/symfony/finder/finder.rs
+++ b/crates/shirabe-external-packages/src/symfony/finder/finder.rs
@@ -11,7 +11,6 @@ use crate::symfony::finder::glob::Glob;
use chrono::{NaiveDate, NaiveDateTime};
use indexmap::{IndexMap, IndexSet};
use shirabe_php_shim::{file_exists, glob, is_dir, preg_quote, rtrim};
-use std::cell::RefCell;
use std::path::{Path, PathBuf};
use std::time::UNIX_EPOCH;
@@ -75,7 +74,7 @@ enum Sort {
None,
ByName,
ByAccessedTime,
- Closure(RefCell<Box<dyn FnMut(&PathBuf, &PathBuf) -> i64>>),
+ Closure(std::cell::RefCell<Box<dyn FnMut(&PathBuf, &PathBuf) -> i64>>),
}
/// One traversal result, replacing `Symfony\Component\Finder\SplFileInfo`.
@@ -97,7 +96,7 @@ pub struct Finder {
names: Vec<String>,
not_names: Vec<String>,
exclude: Vec<String>,
- filters: Vec<RefCell<Box<dyn FnMut(&Path) -> bool>>>,
+ filters: Vec<std::cell::RefCell<Box<dyn FnMut(&Path) -> bool>>>,
depths: Vec<(String, i64)>,
follow_links: bool,
reverse_sorting: bool,
@@ -204,7 +203,7 @@ impl Finder {
}
pub fn filter(&mut self, closure: Box<dyn FnMut(&std::path::Path) -> bool>) -> &mut Self {
- self.filters.push(RefCell::new(closure));
+ self.filters.push(std::cell::RefCell::new(closure));
self
}
@@ -263,7 +262,7 @@ impl Finder {
where
F: FnMut(&PathBuf, &PathBuf) -> i64 + 'static,
{
- self.sort = Sort::Closure(RefCell::new(Box::new(comparator)));
+ self.sort = Sort::Closure(std::cell::RefCell::new(Box::new(comparator)));
self
}