From 06368584a9277022d9cfc42d22c37f4cc6e580f8 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 8 Jun 2026 02:23:31 +0900 Subject: refactor(external-packages): drop component segment from symfony paths Align the Symfony namespace mapping with the documented convention (symfony::component::X -> symfony::X) and remove now-unused console stub files. Update all import paths across the workspace. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../src/symfony/component/console/application.rs | 108 -------------- .../symfony/component/console/command/command.rs | 18 --- .../src/symfony/component/console/command/mod.rs | 3 - .../console/completion/completion_input.rs | 24 --- .../console/completion/completion_suggestions.rs | 14 -- .../symfony/component/console/completion/mod.rs | 5 - .../exception/command_not_found_exception.rs | 13 -- .../console/exception/exception_interface.rs | 1 - .../exception/invalid_argument_exception.rs | 13 -- .../src/symfony/component/console/exception/mod.rs | 7 - .../src/symfony/component/console/formatter/mod.rs | 5 - .../console/formatter/output_formatter.rs | 36 ----- .../console/formatter/output_formatter_style.rs | 12 -- .../component/console/helper/formatter_helper.rs | 12 -- .../src/symfony/component/console/helper/helper.rs | 3 - .../symfony/component/console/helper/helper_set.rs | 22 --- .../src/symfony/component/console/helper/mod.rs | 15 -- .../component/console/helper/progress_bar.rs | 38 ----- .../component/console/helper/question_helper.rs | 18 --- .../src/symfony/component/console/helper/table.rs | 47 ------ .../component/console/helper/table_separator.rs | 14 -- .../symfony/component/console/input/array_input.rs | 69 --------- .../component/console/input/input_definition.rs | 30 ---- .../component/console/input/input_interface.rs | 32 ---- .../component/console/input/input_option.rs | 46 ------ .../src/symfony/component/console/input/mod.rs | 11 -- .../component/console/input/string_input.rs | 66 --------- .../src/symfony/component/console/mod.rs | 23 --- .../component/console/output/console_output.rs | 73 --------- .../console/output/console_output_interface.rs | 6 - .../src/symfony/component/console/output/mod.rs | 7 - .../component/console/output/output_interface.rs | 45 ------ .../component/console/question/choice_question.rs | 19 --- .../src/symfony/component/console/question/mod.rs | 5 - .../symfony/component/console/question/question.rs | 49 ------- .../console/single_command_application.rs | 33 ----- .../src/symfony/component/console/terminal.rs | 22 --- .../component/filesystem/exception/io_exception.rs | 29 ---- .../symfony/component/filesystem/exception/mod.rs | 3 - .../src/symfony/component/filesystem/filesystem.rs | 137 ----------------- .../src/symfony/component/filesystem/mod.rs | 5 - .../src/symfony/component/finder/finder.rs | 163 --------------------- .../src/symfony/component/finder/glob.rs | 12 -- .../src/symfony/component/finder/mod.rs | 7 - .../src/symfony/component/finder/spl_file_info.rs | 62 -------- .../src/symfony/component/mod.rs | 9 -- .../src/symfony/component/process/exception/mod.rs | 7 - .../exception/process_signaled_exception.rs | 13 -- .../exception/process_timed_out_exception.rs | 13 -- .../process/exception/runtime_exception.rs | 13 -- .../symfony/component/process/executable_finder.rs | 22 --- .../src/symfony/component/process/mod.rs | 9 -- .../component/process/php_executable_finder.rs | 22 --- .../src/symfony/component/process/process.rs | 116 --------------- .../src/symfony/console/application.rs | 108 ++++++++++++++ .../src/symfony/console/command/command.rs | 18 +++ .../src/symfony/console/command/mod.rs | 3 + .../exception/command_not_found_exception.rs | 13 ++ .../console/exception/exception_interface.rs | 1 + .../src/symfony/console/exception/mod.rs | 4 + .../symfony/console/formatter/output_formatter.rs | 11 +- .../src/symfony/console/helper/formatter_helper.rs | 12 ++ .../src/symfony/console/helper/helper.rs | 3 + .../src/symfony/console/helper/mod.rs | 8 + .../src/symfony/console/helper/progress_bar.rs | 38 +++++ .../src/symfony/console/helper/question_helper.rs | 9 +- .../src/symfony/console/helper/table.rs | 26 +++- .../src/symfony/console/helper/table_separator.rs | 14 ++ .../src/symfony/console/input/array_input.rs | 9 +- .../src/symfony/console/input/input_definition.rs | 30 ++++ .../src/symfony/console/input/input_interface.rs | 11 +- .../src/symfony/console/input/mod.rs | 2 + .../src/symfony/console/input/string_input.rs | 4 + .../src/symfony/console/mod.rs | 8 + .../src/symfony/console/output/console_output.rs | 73 +++++++++ .../console/output/console_output_interface.rs | 6 + .../src/symfony/console/output/mod.rs | 4 + .../src/symfony/console/output/output_interface.rs | 23 ++- .../src/symfony/console/output/stream_output.rs | 15 +- .../symfony/console/question/choice_question.rs | 19 +++ .../src/symfony/console/question/mod.rs | 2 + .../src/symfony/console/question/question.rs | 16 +- .../symfony/console/single_command_application.rs | 33 +++++ .../src/symfony/console/style/symfony_style.rs | 4 +- .../src/symfony/console/terminal.rs | 22 +++ .../symfony/filesystem/exception/io_exception.rs | 29 ++++ .../src/symfony/filesystem/exception/mod.rs | 3 + .../src/symfony/filesystem/filesystem.rs | 137 +++++++++++++++++ .../src/symfony/filesystem/mod.rs | 5 + .../src/symfony/finder/finder.rs | 163 +++++++++++++++++++++ .../src/symfony/finder/glob.rs | 12 ++ .../src/symfony/finder/mod.rs | 7 + .../src/symfony/finder/spl_file_info.rs | 62 ++++++++ .../shirabe-external-packages/src/symfony/mod.rs | 6 +- .../src/symfony/process/exception/mod.rs | 7 + .../exception/process_signaled_exception.rs | 13 ++ .../exception/process_timed_out_exception.rs | 13 ++ .../symfony/process/exception/runtime_exception.rs | 13 ++ .../src/symfony/process/mod.rs | 6 + .../src/symfony/process/php_executable_finder.rs | 22 +++ .../src/symfony/process/process.rs | 116 +++++++++++++++ 101 files changed, 1128 insertions(+), 1641 deletions(-) delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/application.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/command/command.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/command/mod.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/completion/completion_input.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/completion/completion_suggestions.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/completion/mod.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/exception/command_not_found_exception.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/exception/exception_interface.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/exception/invalid_argument_exception.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/exception/mod.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/formatter/mod.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/formatter/output_formatter.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/formatter/output_formatter_style.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/helper/formatter_helper.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/helper/helper.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/helper/helper_set.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/helper/mod.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/helper/progress_bar.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/helper/question_helper.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/helper/table.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/helper/table_separator.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/input/array_input.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/input/input_definition.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/input/input_interface.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/input/input_option.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/input/mod.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/input/string_input.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/mod.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/output/console_output.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/output/console_output_interface.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/output/mod.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/output/output_interface.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/question/choice_question.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/question/mod.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/question/question.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/single_command_application.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/console/terminal.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/filesystem/exception/io_exception.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/filesystem/exception/mod.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/filesystem/filesystem.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/filesystem/mod.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/finder/finder.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/finder/glob.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/finder/mod.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/finder/spl_file_info.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/mod.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/process/exception/mod.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/process/exception/process_signaled_exception.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/process/exception/process_timed_out_exception.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/process/exception/runtime_exception.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/process/executable_finder.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/process/mod.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/process/php_executable_finder.rs delete mode 100644 crates/shirabe-external-packages/src/symfony/component/process/process.rs create mode 100644 crates/shirabe-external-packages/src/symfony/console/application.rs create mode 100644 crates/shirabe-external-packages/src/symfony/console/command/command.rs create mode 100644 crates/shirabe-external-packages/src/symfony/console/command/mod.rs create mode 100644 crates/shirabe-external-packages/src/symfony/console/exception/command_not_found_exception.rs create mode 100644 crates/shirabe-external-packages/src/symfony/console/exception/exception_interface.rs create mode 100644 crates/shirabe-external-packages/src/symfony/console/helper/formatter_helper.rs create mode 100644 crates/shirabe-external-packages/src/symfony/console/helper/helper.rs create mode 100644 crates/shirabe-external-packages/src/symfony/console/helper/progress_bar.rs create mode 100644 crates/shirabe-external-packages/src/symfony/console/helper/table_separator.rs create mode 100644 crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs create mode 100644 crates/shirabe-external-packages/src/symfony/console/output/console_output.rs create mode 100644 crates/shirabe-external-packages/src/symfony/console/output/console_output_interface.rs create mode 100644 crates/shirabe-external-packages/src/symfony/console/question/choice_question.rs create mode 100644 crates/shirabe-external-packages/src/symfony/console/single_command_application.rs create mode 100644 crates/shirabe-external-packages/src/symfony/console/terminal.rs create mode 100644 crates/shirabe-external-packages/src/symfony/filesystem/exception/io_exception.rs create mode 100644 crates/shirabe-external-packages/src/symfony/filesystem/exception/mod.rs create mode 100644 crates/shirabe-external-packages/src/symfony/filesystem/filesystem.rs create mode 100644 crates/shirabe-external-packages/src/symfony/filesystem/mod.rs create mode 100644 crates/shirabe-external-packages/src/symfony/finder/finder.rs create mode 100644 crates/shirabe-external-packages/src/symfony/finder/glob.rs create mode 100644 crates/shirabe-external-packages/src/symfony/finder/mod.rs create mode 100644 crates/shirabe-external-packages/src/symfony/finder/spl_file_info.rs create mode 100644 crates/shirabe-external-packages/src/symfony/process/exception/mod.rs create mode 100644 crates/shirabe-external-packages/src/symfony/process/exception/process_signaled_exception.rs create mode 100644 crates/shirabe-external-packages/src/symfony/process/exception/process_timed_out_exception.rs create mode 100644 crates/shirabe-external-packages/src/symfony/process/exception/runtime_exception.rs create mode 100644 crates/shirabe-external-packages/src/symfony/process/php_executable_finder.rs create mode 100644 crates/shirabe-external-packages/src/symfony/process/process.rs (limited to 'crates/shirabe-external-packages') diff --git a/crates/shirabe-external-packages/src/symfony/component/console/application.rs b/crates/shirabe-external-packages/src/symfony/component/console/application.rs deleted file mode 100644 index becf1a5..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/application.rs +++ /dev/null @@ -1,108 +0,0 @@ -use crate::symfony::component::console::input::InputInterface; -use crate::symfony::component::console::output::OutputInterface; -use shirabe_php_shim::PhpMixed; - -#[derive(Debug)] -pub struct Application; - -impl Application { - pub fn new(_name: &str, _version: &str) -> Self { - todo!() - } - - pub fn run( - &mut self, - _input: Option>>, - _output: Option>>, - ) -> anyhow::Result { - todo!() - } - - pub fn set_name(&mut self, _name: &str) { - todo!() - } - - pub fn get_name(&self) -> String { - todo!() - } - - pub fn set_version(&mut self, _version: &str) { - todo!() - } - - pub fn get_version(&self) -> String { - todo!() - } - - pub fn add(&mut self, _command: PhpMixed) -> Option { - todo!() - } - - pub fn get(&self, _name: &str) -> anyhow::Result { - todo!() - } - - pub fn set_auto_exit(&mut self, _auto_exit: bool) { - todo!() - } - - pub fn set_catch_exceptions(&mut self, _catch_exceptions: bool) { - todo!() - } - - pub fn get_helper_set(&self) -> PhpMixed { - todo!() - } - - pub fn set_helper_set(&mut self, _helper_set: PhpMixed) { - todo!() - } - - pub fn get_definition(&self) -> PhpMixed { - todo!() - } - - pub fn get_long_version(&self) -> String { - todo!() - } - - pub fn find(&self, _name: &str) -> anyhow::Result { - todo!() - } - - pub fn all(&self, _namespace: Option<&str>) -> Vec { - todo!() - } - - pub fn get_namespaces(&self) -> Vec { - todo!() - } - - pub fn set_default_command( - &mut self, - _command_name: &str, - _is_single_command: bool, - ) -> &mut Self { - todo!() - } - - pub fn is_single_command(&self) -> bool { - todo!() - } - - pub fn render_throwable( - &self, - _exception: &anyhow::Error, - _output: std::rc::Rc>, - ) { - todo!() - } - - pub fn set_catch_errors(&mut self, _catch_errors: bool) { - todo!() - } - - pub fn has(&self, _name: &str) -> bool { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/command/command.rs b/crates/shirabe-external-packages/src/symfony/component/console/command/command.rs deleted file mode 100644 index 32965cf..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/command/command.rs +++ /dev/null @@ -1,18 +0,0 @@ -/// Stub for \Symfony\Component\Console\Command\Command. -pub trait Command { - fn get_name(&self) -> Option { - todo!() - } - - fn set_name(&mut self, _name: &str) { - todo!() - } - - fn get_description(&self) -> String { - todo!() - } - - fn set_description(&mut self, _description: &str) { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/command/mod.rs b/crates/shirabe-external-packages/src/symfony/component/console/command/mod.rs deleted file mode 100644 index 375170c..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/command/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod command; - -pub use command::*; diff --git a/crates/shirabe-external-packages/src/symfony/component/console/completion/completion_input.rs b/crates/shirabe-external-packages/src/symfony/component/console/completion/completion_input.rs deleted file mode 100644 index 1203ec8..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/completion/completion_input.rs +++ /dev/null @@ -1,24 +0,0 @@ -#[derive(Debug)] -pub struct CompletionInput; - -impl CompletionInput { - pub fn get_completion_type(&self) -> String { - todo!() - } - - pub fn get_completion_name(&self) -> Option { - todo!() - } - - pub fn get_completion_value(&self) -> String { - todo!() - } - - pub fn must_suggest_option_values_for(&self, _name: &str) -> bool { - todo!() - } - - pub fn must_suggest_argument_values_for(&self, _name: &str) -> bool { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/completion/completion_suggestions.rs b/crates/shirabe-external-packages/src/symfony/component/console/completion/completion_suggestions.rs deleted file mode 100644 index 7dae1fc..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/completion/completion_suggestions.rs +++ /dev/null @@ -1,14 +0,0 @@ -use shirabe_php_shim::PhpMixed; - -#[derive(Debug)] -pub struct CompletionSuggestions; - -impl CompletionSuggestions { - pub fn suggest_values(&mut self, _values: Vec) { - todo!() - } - - pub fn suggest_value(&mut self, _value: PhpMixed) { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/completion/mod.rs b/crates/shirabe-external-packages/src/symfony/component/console/completion/mod.rs deleted file mode 100644 index 0d15845..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/completion/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub mod completion_input; -pub mod completion_suggestions; - -pub use completion_input::*; -pub use completion_suggestions::*; diff --git a/crates/shirabe-external-packages/src/symfony/component/console/exception/command_not_found_exception.rs b/crates/shirabe-external-packages/src/symfony/component/console/exception/command_not_found_exception.rs deleted file mode 100644 index f1ed60b..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/exception/command_not_found_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -#[derive(Debug)] -pub struct CommandNotFoundException { - pub message: String, - pub code: i64, -} - -impl std::fmt::Display for CommandNotFoundException { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.message) - } -} - -impl std::error::Error for CommandNotFoundException {} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/exception/exception_interface.rs b/crates/shirabe-external-packages/src/symfony/component/console/exception/exception_interface.rs deleted file mode 100644 index 3c42009..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/exception/exception_interface.rs +++ /dev/null @@ -1 +0,0 @@ -pub trait ExceptionInterface: std::error::Error {} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/exception/invalid_argument_exception.rs b/crates/shirabe-external-packages/src/symfony/component/console/exception/invalid_argument_exception.rs deleted file mode 100644 index 658ed8c..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/exception/invalid_argument_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -#[derive(Debug)] -pub struct InvalidArgumentException { - pub message: String, - pub code: i64, -} - -impl std::fmt::Display for InvalidArgumentException { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.message) - } -} - -impl std::error::Error for InvalidArgumentException {} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/exception/mod.rs b/crates/shirabe-external-packages/src/symfony/component/console/exception/mod.rs deleted file mode 100644 index 25750a1..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/exception/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -pub mod command_not_found_exception; -pub mod exception_interface; -pub mod invalid_argument_exception; - -pub use command_not_found_exception::*; -pub use exception_interface::*; -pub use invalid_argument_exception::*; diff --git a/crates/shirabe-external-packages/src/symfony/component/console/formatter/mod.rs b/crates/shirabe-external-packages/src/symfony/component/console/formatter/mod.rs deleted file mode 100644 index 540d3b3..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/formatter/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub mod output_formatter; -pub mod output_formatter_style; - -pub use output_formatter::*; -pub use output_formatter_style::*; diff --git a/crates/shirabe-external-packages/src/symfony/component/console/formatter/output_formatter.rs b/crates/shirabe-external-packages/src/symfony/component/console/formatter/output_formatter.rs deleted file mode 100644 index 9c78e14..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/formatter/output_formatter.rs +++ /dev/null @@ -1,36 +0,0 @@ -#[derive(Debug)] -pub struct OutputFormatter; - -impl OutputFormatter { - pub fn new(_decorated: bool) -> Self { - todo!() - } - - pub fn format(&self, _message: &str) -> String { - todo!() - } - - pub fn is_decorated(&self) -> bool { - todo!() - } - - pub fn set_decorated(&mut self, _decorated: bool) { - todo!() - } - - pub fn escape(_text: &str) -> String { - todo!() - } - - pub fn escape_trailing_backslash(_text: &str) -> String { - todo!() - } - - pub fn set_style( - &mut self, - _name: &str, - _style: crate::symfony::component::console::formatter::OutputFormatterStyle, - ) { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/formatter/output_formatter_style.rs b/crates/shirabe-external-packages/src/symfony/component/console/formatter/output_formatter_style.rs deleted file mode 100644 index 6299157..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/formatter/output_formatter_style.rs +++ /dev/null @@ -1,12 +0,0 @@ -#[derive(Debug)] -pub struct OutputFormatterStyle; - -impl OutputFormatterStyle { - pub fn new( - _foreground: Option<&str>, - _background: Option<&str>, - _options: Option>, - ) -> Self { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/helper/formatter_helper.rs b/crates/shirabe-external-packages/src/symfony/component/console/helper/formatter_helper.rs deleted file mode 100644 index 656828e..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/helper/formatter_helper.rs +++ /dev/null @@ -1,12 +0,0 @@ -#[derive(Debug)] -pub struct FormatterHelper; - -impl FormatterHelper { - pub fn format_section(&self, _section: &str, _message: &str, _style: &str) -> String { - todo!() - } - - pub fn format_block(&self, _messages: &[&str], _style: &str, _large: bool) -> String { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/helper/helper.rs b/crates/shirabe-external-packages/src/symfony/component/console/helper/helper.rs deleted file mode 100644 index 881aabd..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/helper/helper.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub trait Helper { - fn get_name(&self) -> String; -} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/helper/helper_set.rs b/crates/shirabe-external-packages/src/symfony/component/console/helper/helper_set.rs deleted file mode 100644 index 26af492..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/helper/helper_set.rs +++ /dev/null @@ -1,22 +0,0 @@ -use shirabe_php_shim::PhpMixed; - -#[derive(Debug)] -pub struct HelperSet; - -impl HelperSet { - pub fn new(_helpers: Vec) -> Self { - todo!() - } - - pub fn get(&self, _name: &str) -> PhpMixed { - todo!() - } - - pub fn set(&mut self, _helper: PhpMixed, _alias: Option<&str>) { - todo!() - } - - pub fn has(&self, _name: &str) -> bool { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/helper/mod.rs b/crates/shirabe-external-packages/src/symfony/component/console/helper/mod.rs deleted file mode 100644 index b31517a..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/helper/mod.rs +++ /dev/null @@ -1,15 +0,0 @@ -pub mod formatter_helper; -pub mod helper; -pub mod helper_set; -pub mod progress_bar; -pub mod question_helper; -pub mod table; -pub mod table_separator; - -pub use formatter_helper::*; -pub use helper::*; -pub use helper_set::*; -pub use progress_bar::*; -pub use question_helper::*; -pub use table::*; -pub use table_separator::*; 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 deleted file mode 100644 index 77bc4fd..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/helper/progress_bar.rs +++ /dev/null @@ -1,38 +0,0 @@ -use crate::symfony::component::console::output::OutputInterface; - -#[derive(Debug)] -pub struct ProgressBar; - -impl ProgressBar { - pub fn new(_output: std::rc::Rc>, _max: i64) -> Self { - todo!() - } - - pub fn start(&mut self, _max: Option) { - todo!() - } - - pub fn advance(&mut self, _step: i64) { - todo!() - } - - pub fn finish(&mut self) { - todo!() - } - - pub fn set_format(&mut self, _format: &str) { - todo!() - } - - pub fn get_progress(&self) -> i64 { - todo!() - } - - pub fn get_max_steps(&self) -> i64 { - todo!() - } - - pub fn set_progress(&mut self, _step: i64) { - 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 deleted file mode 100644 index 5d452c7..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/helper/question_helper.rs +++ /dev/null @@ -1,18 +0,0 @@ -use crate::symfony::component::console::input::InputInterface; -use crate::symfony::component::console::output::OutputInterface; -use crate::symfony::component::console::question::Question; -use shirabe_php_shim::PhpMixed; - -#[derive(Debug)] -pub struct QuestionHelper; - -impl QuestionHelper { - pub fn ask( - &self, - _input: std::rc::Rc>, - _output: std::rc::Rc>, - _question: &Question, - ) -> Option { - 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 deleted file mode 100644 index f580965..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/helper/table.rs +++ /dev/null @@ -1,47 +0,0 @@ -use crate::symfony::component::console::output::OutputInterface; -use shirabe_php_shim::PhpMixed; - -#[derive(Debug)] -pub struct Table; - -impl Table { - pub fn new(_output: std::rc::Rc>) -> Self { - todo!() - } - - pub fn set_headers(&mut self, _headers: Vec) -> &mut Self { - todo!() - } - - pub fn set_rows(&mut self, _rows: Vec) -> &mut Self { - todo!() - } - - pub fn add_row(&mut self, _row: PhpMixed) -> &mut Self { - todo!() - } - - pub fn render(&mut self) { - todo!() - } - - pub fn set_style(&mut self, _style: &str) -> &mut Self { - todo!() - } - - pub fn set_column_width(&mut self, _column_index: usize, _width: i64) -> &mut Self { - todo!() - } - - pub fn set_column_widths(&mut self, _widths: Vec) -> &mut Self { - todo!() - } - - pub fn set_column_max_width(&mut self, _column_index: usize, _width: i64) -> &mut Self { - todo!() - } - - pub fn set_horizontal(&mut self, _horizontal: bool) -> &mut Self { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/helper/table_separator.rs b/crates/shirabe-external-packages/src/symfony/component/console/helper/table_separator.rs deleted file mode 100644 index 22ac013..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/helper/table_separator.rs +++ /dev/null @@ -1,14 +0,0 @@ -#[derive(Debug)] -pub struct TableSeparator; - -impl Default for TableSeparator { - fn default() -> Self { - Self::new() - } -} - -impl TableSeparator { - pub fn new() -> Self { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/input/array_input.rs b/crates/shirabe-external-packages/src/symfony/component/console/input/array_input.rs deleted file mode 100644 index 86c982d..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/input/array_input.rs +++ /dev/null @@ -1,69 +0,0 @@ -use crate::symfony::component::console::input::InputDefinition; -use crate::symfony::component::console::input::InputInterface; -use indexmap::IndexMap; -use shirabe_php_shim::PhpMixed; - -#[derive(Debug)] -pub struct ArrayInput; - -impl ArrayInput { - pub fn new( - _parameters: IndexMap, - _definition: Option, - ) -> Self { - todo!() - } -} - -impl InputInterface for ArrayInput { - fn get_first_argument(&self) -> Option { - todo!() - } - fn has_parameter_option(&self, _values: &[&str], _only_params: bool) -> bool { - todo!() - } - fn get_parameter_option( - &self, - _values: &[&str], - _default: PhpMixed, - _only_params: bool, - ) -> PhpMixed { - todo!() - } - fn bind(&mut self, _definition: &InputDefinition) -> anyhow::Result<()> { - todo!() - } - fn validate(&self) -> anyhow::Result<()> { - todo!() - } - fn get_arguments(&self) -> IndexMap { - todo!() - } - fn get_argument(&self, _name: &str) -> PhpMixed { - todo!() - } - fn set_argument(&mut self, _name: &str, _value: PhpMixed) -> anyhow::Result<()> { - todo!() - } - fn has_argument(&self, _name: &str) -> bool { - todo!() - } - fn get_options(&self) -> IndexMap { - todo!() - } - fn get_option(&self, _name: &str) -> PhpMixed { - todo!() - } - fn set_option(&mut self, _name: &str, _value: PhpMixed) -> anyhow::Result<()> { - todo!() - } - fn has_option(&self, _name: &str) -> bool { - todo!() - } - fn is_interactive(&self) -> bool { - todo!() - } - fn set_interactive(&mut self, _interactive: bool) { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/input/input_definition.rs b/crates/shirabe-external-packages/src/symfony/component/console/input/input_definition.rs deleted file mode 100644 index 74839fc..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/input/input_definition.rs +++ /dev/null @@ -1,30 +0,0 @@ -use shirabe_php_shim::PhpMixed; - -#[derive(Debug)] -pub struct InputDefinition; - -impl InputDefinition { - pub fn new(_definition: Vec) -> Self { - todo!() - } - - pub fn add_argument(&mut self, _argument: PhpMixed) { - todo!() - } - - pub fn add_option(&mut self, _option: PhpMixed) { - todo!() - } - - pub fn has_option(&self, _name: &str) -> bool { - todo!() - } - - pub fn get_option(&self, _name: &str) -> anyhow::Result { - todo!() - } - - pub fn has_argument(&self, _name: &str) -> bool { - 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 deleted file mode 100644 index a556198..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/input/input_interface.rs +++ /dev/null @@ -1,32 +0,0 @@ -use shirabe_php_shim::PhpMixed; - -pub trait InputInterface: std::fmt::Debug { - fn get_first_argument(&self) -> Option; - fn has_parameter_option(&self, values: &[&str], only_params: bool) -> bool; - fn get_parameter_option( - &self, - values: &[&str], - default: PhpMixed, - only_params: bool, - ) -> PhpMixed; - fn bind( - &mut self, - definition: &crate::symfony::component::console::input::InputDefinition, - ) -> anyhow::Result<()>; - fn validate(&self) -> anyhow::Result<()>; - fn get_arguments(&self) -> indexmap::IndexMap; - fn get_argument(&self, name: &str) -> PhpMixed; - fn set_argument(&mut self, name: &str, value: PhpMixed) -> anyhow::Result<()>; - fn has_argument(&self, name: &str) -> bool; - fn get_options(&self) -> indexmap::IndexMap; - fn get_option(&self, name: &str) -> PhpMixed; - fn set_option(&mut self, name: &str, value: PhpMixed) -> anyhow::Result<()>; - fn has_option(&self, name: &str) -> bool; - fn is_interactive(&self) -> bool; - fn set_interactive(&mut self, interactive: bool); - - /// Equivalent to PHP `(string) $input` (Input::__toString). - fn to_input_string(&self) -> String { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/input/input_option.rs b/crates/shirabe-external-packages/src/symfony/component/console/input/input_option.rs deleted file mode 100644 index 673ca07..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/input/input_option.rs +++ /dev/null @@ -1,46 +0,0 @@ -use shirabe_php_shim::PhpMixed; - -#[derive(Debug)] -pub struct InputOption; - -impl InputOption { - pub const VALUE_NONE: i64 = 1; - pub const VALUE_REQUIRED: i64 = 2; - pub const VALUE_OPTIONAL: i64 = 4; - pub const VALUE_IS_ARRAY: i64 = 8; - pub const VALUE_NEGATABLE: i64 = 16; - - pub fn new( - _name: &str, - _shortcut: Option<&str>, - _mode: Option, - _description: &str, - _default: PhpMixed, - ) -> Self { - todo!() - } - - pub fn get_name(&self) -> String { - todo!() - } - - pub fn accept_value(&self) -> bool { - todo!() - } - - pub fn is_value_required(&self) -> bool { - todo!() - } - - pub fn is_value_optional(&self) -> bool { - todo!() - } - - pub fn is_array(&self) -> bool { - todo!() - } - - pub fn get_default(&self) -> PhpMixed { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/input/mod.rs b/crates/shirabe-external-packages/src/symfony/component/console/input/mod.rs deleted file mode 100644 index 2071388..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/input/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub mod array_input; -pub mod input_definition; -pub mod input_interface; -pub mod input_option; -pub mod string_input; - -pub use array_input::*; -pub use input_definition::*; -pub use input_interface::*; -pub use input_option::*; -pub use string_input::*; diff --git a/crates/shirabe-external-packages/src/symfony/component/console/input/string_input.rs b/crates/shirabe-external-packages/src/symfony/component/console/input/string_input.rs deleted file mode 100644 index 140082e..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/input/string_input.rs +++ /dev/null @@ -1,66 +0,0 @@ -use crate::symfony::component::console::input::InputDefinition; -use crate::symfony::component::console::input::InputInterface; -use indexmap::IndexMap; -use shirabe_php_shim::PhpMixed; - -#[derive(Debug)] -pub struct StringInput; - -impl StringInput { - pub fn new(_input: &str) -> Self { - todo!() - } -} - -impl InputInterface for StringInput { - fn get_first_argument(&self) -> Option { - todo!() - } - fn has_parameter_option(&self, _values: &[&str], _only_params: bool) -> bool { - todo!() - } - fn get_parameter_option( - &self, - _values: &[&str], - _default: PhpMixed, - _only_params: bool, - ) -> PhpMixed { - todo!() - } - fn bind(&mut self, _definition: &InputDefinition) -> anyhow::Result<()> { - todo!() - } - fn validate(&self) -> anyhow::Result<()> { - todo!() - } - fn get_arguments(&self) -> IndexMap { - todo!() - } - fn get_argument(&self, _name: &str) -> PhpMixed { - todo!() - } - fn set_argument(&mut self, _name: &str, _value: PhpMixed) -> anyhow::Result<()> { - todo!() - } - fn has_argument(&self, _name: &str) -> bool { - todo!() - } - fn get_options(&self) -> IndexMap { - todo!() - } - fn get_option(&self, _name: &str) -> PhpMixed { - todo!() - } - fn set_option(&mut self, _name: &str, _value: PhpMixed) -> anyhow::Result<()> { - todo!() - } - fn has_option(&self, _name: &str) -> bool { - todo!() - } - fn is_interactive(&self) -> bool { - todo!() - } - fn set_interactive(&mut self, _interactive: bool) { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/mod.rs b/crates/shirabe-external-packages/src/symfony/component/console/mod.rs deleted file mode 100644 index ffb85d3..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/mod.rs +++ /dev/null @@ -1,23 +0,0 @@ -pub mod application; -pub mod command; -pub mod completion; -pub mod exception; -pub mod formatter; -pub mod helper; -pub mod input; -pub mod output; -pub mod question; -pub mod single_command_application; -pub mod terminal; - -pub use application::*; -pub use command::*; -pub use completion::*; -pub use exception::*; -pub use formatter::*; -pub use helper::*; -pub use input::*; -pub use output::*; -pub use question::*; -pub use single_command_application::*; -pub use terminal::*; 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 deleted file mode 100644 index 00b9324..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/output/console_output.rs +++ /dev/null @@ -1,73 +0,0 @@ -use crate::symfony::component::console::formatter::OutputFormatter; -use crate::symfony::component::console::output::ConsoleOutputInterface; -use crate::symfony::component::console::output::OutputInterface; - -#[derive(Debug)] -pub struct ConsoleOutput; - -impl ConsoleOutput { - pub fn new( - _verbosity: i64, - _decorated: Option, - _formatter: Option, - ) -> Self { - todo!() - } -} - -impl ConsoleOutputInterface for ConsoleOutput { - fn get_error_output(&self) -> std::rc::Rc> { - todo!() - } - - fn set_error_output(&mut self, _error: std::rc::Rc>) { - todo!() - } -} - -impl OutputInterface for ConsoleOutput { - fn is_console_output_interface(&self) -> bool { - true - } - - fn as_console_output_interface(&self) -> Option<&dyn ConsoleOutputInterface> { - Some(self) - } - - fn write(&self, _messages: &str, _newline: bool, _type: i64) { - todo!() - } - fn writeln(&self, _messages: &str, _type: i64) { - todo!() - } - fn set_verbosity(&self, _level: i64) { - todo!() - } - fn get_verbosity(&self) -> i64 { - todo!() - } - fn is_quiet(&self) -> bool { - todo!() - } - fn is_verbose(&self) -> bool { - todo!() - } - fn is_very_verbose(&self) -> bool { - todo!() - } - fn is_debug(&self) -> bool { - todo!() - } - fn set_decorated(&self, _decorated: bool) { - todo!() - } - fn is_decorated(&self) -> bool { - todo!() - } - fn set_formatter(&self, _formatter: OutputFormatter) { - todo!() - } - fn get_formatter(&self) -> &OutputFormatter { - 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 deleted file mode 100644 index 83ec1de..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/output/console_output_interface.rs +++ /dev/null @@ -1,6 +0,0 @@ -use crate::symfony::component::console::output::OutputInterface; - -pub trait ConsoleOutputInterface: OutputInterface { - fn get_error_output(&self) -> std::rc::Rc>; - fn set_error_output(&mut self, error: std::rc::Rc>); -} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/output/mod.rs b/crates/shirabe-external-packages/src/symfony/component/console/output/mod.rs deleted file mode 100644 index 92a0789..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/output/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -pub mod console_output; -pub mod console_output_interface; -pub mod output_interface; - -pub use console_output::*; -pub use console_output_interface::*; -pub use output_interface::*; 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 deleted file mode 100644 index 9e58a3e..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/output/output_interface.rs +++ /dev/null @@ -1,45 +0,0 @@ -use crate::symfony::component::console::formatter::OutputFormatter; -use crate::symfony::component::console::output::ConsoleOutputInterface; - -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); - fn writeln(&self, messages: &str, r#type: i64); - fn set_verbosity(&self, level: i64); - fn get_verbosity(&self) -> i64; - fn is_quiet(&self) -> bool; - fn is_verbose(&self) -> bool; - fn is_very_verbose(&self) -> bool; - fn is_debug(&self) -> bool; - fn set_decorated(&self, decorated: bool); - fn is_decorated(&self) -> bool; - fn set_formatter(&self, formatter: OutputFormatter); - fn get_formatter(&self) -> &OutputFormatter; - - /// PHP: `$output instanceof ConsoleOutputInterface`. Default false; ConsoleOutput overrides. - fn is_console_output_interface(&self) -> bool { - false - } - - /// PHP: `$output instanceof ConsoleOutputInterface`. Returns the output as a - /// ConsoleOutputInterface trait object when it is one. Default None; ConsoleOutput overrides. - fn as_console_output_interface(&self) -> Option<&dyn ConsoleOutputInterface> { - None - } - - /// PHP: only StreamOutput exposes `getStream()`. Default panics for outputs without one. - fn get_stream(&self) -> shirabe_php_shim::PhpResource { - todo!("get_stream not available on this OutputInterface implementation") - } -} - -pub const VERBOSITY_QUIET: i64 = 16; -pub const VERBOSITY_NORMAL: i64 = 32; -pub const VERBOSITY_VERBOSE: i64 = 64; -pub const VERBOSITY_VERY_VERBOSE: i64 = 128; -pub const VERBOSITY_DEBUG: i64 = 256; - -pub const OUTPUT_NORMAL: i64 = 1; -pub const OUTPUT_RAW: i64 = 2; -pub const OUTPUT_PLAIN: i64 = 4; diff --git a/crates/shirabe-external-packages/src/symfony/component/console/question/choice_question.rs b/crates/shirabe-external-packages/src/symfony/component/console/question/choice_question.rs deleted file mode 100644 index 67ffe4c..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/question/choice_question.rs +++ /dev/null @@ -1,19 +0,0 @@ -use crate::symfony::component::console::question::Question; -use shirabe_php_shim::PhpMixed; - -#[derive(Debug)] -pub struct ChoiceQuestion(pub Question); - -impl ChoiceQuestion { - pub fn new(_question: &str, _choices: Vec, _default: Option) -> Self { - todo!() - } - - pub fn set_multiselect(&mut self, _multiselect: bool) { - todo!() - } - - pub fn set_error_message(&mut self, _error_message: &str) { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/question/mod.rs b/crates/shirabe-external-packages/src/symfony/component/console/question/mod.rs deleted file mode 100644 index 67e7e7b..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/question/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub mod choice_question; -pub mod question; - -pub use choice_question::*; -pub use question::*; diff --git a/crates/shirabe-external-packages/src/symfony/component/console/question/question.rs b/crates/shirabe-external-packages/src/symfony/component/console/question/question.rs deleted file mode 100644 index c83bbcd..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/question/question.rs +++ /dev/null @@ -1,49 +0,0 @@ -use shirabe_php_shim::PhpMixed; - -#[derive(Debug)] -pub struct Question; - -impl Question { - pub fn new(_question: &str, _default: Option) -> Self { - todo!() - } - - pub fn set_validator( - &mut self, - _validator: Option) -> anyhow::Result>>, - ) { - todo!() - } - - pub fn set_max_attempts(&mut self, _attempts: Option) { - todo!() - } - - pub fn set_hidden(&mut self, _hidden: bool) { - todo!() - } - - pub fn set_hidden_fallback(&mut self, _fallback: bool) { - todo!() - } - - pub fn get_question(&self) -> String { - todo!() - } - - pub fn get_default(&self) -> Option { - todo!() - } - - pub fn is_hidden(&self) -> bool { - todo!() - } - - pub fn get_validator(&self) -> Option<&dyn Fn(Option) -> anyhow::Result> { - todo!() - } - - pub fn get_max_attempts(&self) -> Option { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/single_command_application.rs b/crates/shirabe-external-packages/src/symfony/component/console/single_command_application.rs deleted file mode 100644 index 9273477..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/single_command_application.rs +++ /dev/null @@ -1,33 +0,0 @@ -#[derive(Debug)] -pub struct SingleCommandApplication; - -impl Default for SingleCommandApplication { - fn default() -> Self { - Self::new() - } -} - -impl SingleCommandApplication { - pub fn new() -> Self { - todo!() - } - - pub fn set_name(&mut self, _name: &str) -> &mut Self { - todo!() - } - - pub fn set_version(&mut self, _version: &str) -> &mut Self { - todo!() - } - - pub fn set_code( - &mut self, - _code: Box i64>, - ) -> &mut Self { - todo!() - } - - pub fn run(&mut self) -> anyhow::Result { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/console/terminal.rs b/crates/shirabe-external-packages/src/symfony/component/console/terminal.rs deleted file mode 100644 index 251d71e..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/console/terminal.rs +++ /dev/null @@ -1,22 +0,0 @@ -#[derive(Debug)] -pub struct Terminal; - -impl Default for Terminal { - fn default() -> Self { - Self::new() - } -} - -impl Terminal { - pub fn new() -> Self { - todo!() - } - - pub fn get_width(&self) -> i64 { - todo!() - } - - pub fn get_height(&self) -> i64 { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/filesystem/exception/io_exception.rs b/crates/shirabe-external-packages/src/symfony/component/filesystem/exception/io_exception.rs deleted file mode 100644 index a5f2844..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/filesystem/exception/io_exception.rs +++ /dev/null @@ -1,29 +0,0 @@ -#[derive(Debug)] -pub struct IOException { - pub message: String, - pub code: i64, - pub path: Option, -} - -impl IOException { - pub fn new( - message: String, - code: i64, - _previous: Option>, - path: Option, - ) -> Self { - Self { - message, - code, - path, - } - } -} - -impl std::fmt::Display for IOException { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.message) - } -} - -impl std::error::Error for IOException {} diff --git a/crates/shirabe-external-packages/src/symfony/component/filesystem/exception/mod.rs b/crates/shirabe-external-packages/src/symfony/component/filesystem/exception/mod.rs deleted file mode 100644 index 2c19405..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/filesystem/exception/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod io_exception; - -pub use io_exception::*; diff --git a/crates/shirabe-external-packages/src/symfony/component/filesystem/filesystem.rs b/crates/shirabe-external-packages/src/symfony/component/filesystem/filesystem.rs deleted file mode 100644 index 522309e..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/filesystem/filesystem.rs +++ /dev/null @@ -1,137 +0,0 @@ -use shirabe_php_shim::PhpMixed; - -#[derive(Debug, Clone)] -pub struct Filesystem; - -impl Default for Filesystem { - fn default() -> Self { - Self::new() - } -} - -impl Filesystem { - pub fn new() -> Self { - todo!() - } - - pub fn copy( - &self, - _origin_file: &str, - _target_file: &str, - _override_file: bool, - ) -> anyhow::Result<()> { - todo!() - } - - pub fn mkdir(&self, _dirs: PhpMixed, _mode: u32) -> anyhow::Result<()> { - todo!() - } - - pub fn exists(&self, _files: PhpMixed) -> bool { - todo!() - } - - pub fn touch( - &self, - _files: PhpMixed, - _time: Option, - _atime: Option, - ) -> anyhow::Result<()> { - todo!() - } - - pub fn remove(&self, _files: PhpMixed) -> anyhow::Result<()> { - todo!() - } - - pub fn chmod( - &self, - _files: PhpMixed, - _mode: u32, - _umask: u32, - _recursive: bool, - ) -> anyhow::Result<()> { - todo!() - } - - pub fn chown(&self, _files: PhpMixed, _user: PhpMixed, _recursive: bool) -> anyhow::Result<()> { - todo!() - } - - pub fn chgrp( - &self, - _files: PhpMixed, - _group: PhpMixed, - _recursive: bool, - ) -> anyhow::Result<()> { - todo!() - } - - pub fn rename(&self, _origin: &str, _target: &str, _override_file: bool) -> anyhow::Result<()> { - todo!() - } - - pub fn symlink( - &self, - _origin_dir: &str, - _target_dir: &str, - _copy_on_windows: bool, - ) -> anyhow::Result<()> { - todo!() - } - - pub fn hard_link(&self, _origin_file: &str, _target_files: PhpMixed) -> anyhow::Result<()> { - todo!() - } - - pub fn read_link(&self, _path: &str) -> String { - todo!() - } - - pub fn make_path_relative(&self, _end_path: &str, _start_path: &str) -> String { - todo!() - } - - pub fn mirror( - &self, - _origin_dir: &str, - _target_dir: &str, - _iterator: Option, - _options: &indexmap::IndexMap, - ) -> anyhow::Result<()> { - todo!() - } - - pub fn is_absolute_path(&self, _file: &str) -> bool { - todo!() - } - - pub fn dump_file(&self, _filename: &str, _content: &str) -> anyhow::Result<()> { - todo!() - } - - pub fn append_to_file(&self, _filename: &str, _content: &str) -> anyhow::Result<()> { - todo!() - } - - pub fn temp_nam(&self, _dir: &str, _prefix: &str) -> anyhow::Result { - todo!() - } - - // Static-style helper methods used in the ported codebase - pub fn is_readable(_path: &str) -> bool { - todo!() - } - - pub fn is_local_path(_path: &str) -> bool { - todo!() - } - - pub fn trim_trailing_slash(_path: &str) -> String { - todo!() - } - - pub fn get_platform_path(_path: &str) -> String { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/filesystem/mod.rs b/crates/shirabe-external-packages/src/symfony/component/filesystem/mod.rs deleted file mode 100644 index 24be2ed..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/filesystem/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub mod exception; -pub mod filesystem; - -pub use exception::*; -pub use filesystem::*; diff --git a/crates/shirabe-external-packages/src/symfony/component/finder/finder.rs b/crates/shirabe-external-packages/src/symfony/component/finder/finder.rs deleted file mode 100644 index 9e84e26..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/finder/finder.rs +++ /dev/null @@ -1,163 +0,0 @@ -use crate::symfony::component::finder::SplFileInfo; - -/// Helper trait so `Finder::exclude` accepts both single strings and slices -/// (PHP's variadic / array argument compatibility). -pub trait IntoFinderExclude {} -impl IntoFinderExclude for &str {} -impl IntoFinderExclude for String {} -impl IntoFinderExclude for &String {} -impl IntoFinderExclude for &[String] {} -impl IntoFinderExclude for &Vec {} -impl IntoFinderExclude for Vec {} - -#[derive(Debug)] -pub struct Finder; - -impl Default for Finder { - fn default() -> Self { - Self::new() - } -} - -impl Finder { - pub fn new() -> Self { - todo!() - } - - pub fn create() -> Self { - todo!() - } - - pub fn files(&mut self) -> &mut Self { - todo!() - } - - pub fn directories(&mut self) -> &mut Self { - todo!() - } - - pub fn depth(&mut self, _level: i64) -> &mut Self { - todo!() - } - - pub fn r#in(&mut self, _dirs: &str) -> &mut Self { - todo!() - } - - pub fn filter(&mut self, _closure: Box bool>) -> &mut Self { - todo!() - } - - pub fn follow_links(&mut self) -> &mut Self { - todo!() - } - - pub fn exclude(&mut self, _exclude: E) -> &mut Self { - todo!() - } - - pub fn ignore_vcs(&mut self, _ignore_vcs: bool) -> &mut Self { - todo!() - } - - pub fn ignore_dot_files(&mut self, _ignore_dot_files: bool) -> &mut Self { - todo!() - } - - pub fn not_name(&mut self, _pattern: &str) -> &mut Self { - todo!() - } - - pub fn not_path(&mut self, _pattern: &str) -> &mut Self { - todo!() - } - - pub fn name(&mut self, _pattern: &str) -> &mut Self { - todo!() - } - - pub fn sort(&mut self, _comparator: F) -> &mut Self - where - F: FnMut(&SplFileInfo, &SplFileInfo) -> i64, - { - todo!() - } - - pub fn sort_by_name(&mut self) -> &mut Self { - todo!() - } - - pub fn sort_by_accessed_time(&mut self) -> &mut Self { - todo!() - } - - pub fn date(&mut self, _date: &str) -> &mut Self { - todo!() - } - - pub fn get_iterator(&self) -> FinderIterator { - todo!() - } - - pub fn iter(&self) -> impl Iterator { - todo!(); - std::iter::empty() - } - - /// PHP: Finder implements Countable. - pub fn len(&self) -> usize { - todo!() - } - - pub fn is_empty(&self) -> bool { - self.len() == 0 - } -} - -impl IntoIterator for &Finder { - type Item = SplFileInfo; - type IntoIter = std::vec::IntoIter; - - fn into_iter(self) -> Self::IntoIter { - todo!() - } -} - -#[derive(Debug)] -pub struct FinderIterator; - -impl FinderIterator { - pub fn valid(&self) -> bool { - todo!() - } - - pub fn current(&self) -> SplFileInfo { - todo!() - } -} - -impl Iterator for FinderIterator { - type Item = SplFileInfo; - - fn next(&mut self) -> Option { - todo!() - } -} - -impl IntoIterator for Finder { - type Item = SplFileInfo; - type IntoIter = std::vec::IntoIter; - - fn into_iter(self) -> Self::IntoIter { - todo!() - } -} - -impl IntoIterator for &mut Finder { - type Item = SplFileInfo; - type IntoIter = std::vec::IntoIter; - - fn into_iter(self) -> Self::IntoIter { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/finder/glob.rs b/crates/shirabe-external-packages/src/symfony/component/finder/glob.rs deleted file mode 100644 index 08ab6df..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/finder/glob.rs +++ /dev/null @@ -1,12 +0,0 @@ -#[derive(Debug)] -pub struct Glob; - -impl Glob { - pub fn to_regex( - _glob: &str, - _strict_leading_dot: bool, - _strict_wildcard_slash: bool, - ) -> String { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/finder/mod.rs b/crates/shirabe-external-packages/src/symfony/component/finder/mod.rs deleted file mode 100644 index 4b2d4b8..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/finder/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -pub mod finder; -pub mod glob; -pub mod spl_file_info; - -pub use finder::*; -pub use glob::*; -pub use spl_file_info::*; diff --git a/crates/shirabe-external-packages/src/symfony/component/finder/spl_file_info.rs b/crates/shirabe-external-packages/src/symfony/component/finder/spl_file_info.rs deleted file mode 100644 index 3c1be6d..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/finder/spl_file_info.rs +++ /dev/null @@ -1,62 +0,0 @@ -#[derive(Debug)] -pub struct SplFileInfo; - -impl std::fmt::Display for SplFileInfo { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.get_pathname()) - } -} - -impl SplFileInfo { - pub fn new(_path: &str) -> Self { - todo!() - } - - pub fn get_pathname(&self) -> String { - todo!() - } - - pub fn get_path(&self) -> String { - todo!() - } - - pub fn get_filename(&self) -> String { - todo!() - } - - pub fn get_basename(&self, _suffix: Option<&str>) -> String { - todo!() - } - - pub fn get_extension(&self) -> String { - todo!() - } - - pub fn get_relative_path_name(&self) -> String { - todo!() - } - - pub fn get_relative_path(&self) -> String { - todo!() - } - - pub fn is_dir(&self) -> bool { - todo!() - } - - pub fn is_file(&self) -> bool { - todo!() - } - - pub fn is_link(&self) -> bool { - todo!() - } - - pub fn get_real_path(&self) -> Option { - todo!() - } - - pub fn get_size(&self) -> i64 { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/mod.rs b/crates/shirabe-external-packages/src/symfony/component/mod.rs deleted file mode 100644 index f176d3a..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/mod.rs +++ /dev/null @@ -1,9 +0,0 @@ -pub mod console; -pub mod filesystem; -pub mod finder; -pub mod process; - -pub use console::*; -pub use filesystem::*; -pub use finder::*; -pub use process::*; diff --git a/crates/shirabe-external-packages/src/symfony/component/process/exception/mod.rs b/crates/shirabe-external-packages/src/symfony/component/process/exception/mod.rs deleted file mode 100644 index 8d275c1..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/process/exception/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -pub mod process_signaled_exception; -pub mod process_timed_out_exception; -pub mod runtime_exception; - -pub use process_signaled_exception::*; -pub use process_timed_out_exception::*; -pub use runtime_exception::*; diff --git a/crates/shirabe-external-packages/src/symfony/component/process/exception/process_signaled_exception.rs b/crates/shirabe-external-packages/src/symfony/component/process/exception/process_signaled_exception.rs deleted file mode 100644 index 154a7a7..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/process/exception/process_signaled_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -#[derive(Debug)] -pub struct ProcessSignaledException { - pub message: String, - pub code: i64, -} - -impl std::fmt::Display for ProcessSignaledException { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.message) - } -} - -impl std::error::Error for ProcessSignaledException {} diff --git a/crates/shirabe-external-packages/src/symfony/component/process/exception/process_timed_out_exception.rs b/crates/shirabe-external-packages/src/symfony/component/process/exception/process_timed_out_exception.rs deleted file mode 100644 index cbcdaa4..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/process/exception/process_timed_out_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -#[derive(Debug)] -pub struct ProcessTimedOutException { - pub message: String, - pub code: i64, -} - -impl std::fmt::Display for ProcessTimedOutException { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.message) - } -} - -impl std::error::Error for ProcessTimedOutException {} diff --git a/crates/shirabe-external-packages/src/symfony/component/process/exception/runtime_exception.rs b/crates/shirabe-external-packages/src/symfony/component/process/exception/runtime_exception.rs deleted file mode 100644 index 3ac2c8b..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/process/exception/runtime_exception.rs +++ /dev/null @@ -1,13 +0,0 @@ -#[derive(Debug)] -pub struct RuntimeException { - pub message: String, - pub code: i64, -} - -impl std::fmt::Display for RuntimeException { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.message) - } -} - -impl std::error::Error for RuntimeException {} diff --git a/crates/shirabe-external-packages/src/symfony/component/process/executable_finder.rs b/crates/shirabe-external-packages/src/symfony/component/process/executable_finder.rs deleted file mode 100644 index ae8e5dc..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/process/executable_finder.rs +++ /dev/null @@ -1,22 +0,0 @@ -#[derive(Debug)] -pub struct ExecutableFinder; - -impl Default for ExecutableFinder { - fn default() -> Self { - Self::new() - } -} - -impl ExecutableFinder { - pub fn new() -> Self { - todo!() - } - - pub fn add_suffix(&mut self, _suffix: &str) { - todo!() - } - - pub fn find(&self, _name: &str, _default: Option<&str>, _dirs: &[String]) -> Option { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/process/mod.rs b/crates/shirabe-external-packages/src/symfony/component/process/mod.rs deleted file mode 100644 index 6dd64e1..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/process/mod.rs +++ /dev/null @@ -1,9 +0,0 @@ -pub mod exception; -pub mod executable_finder; -pub mod php_executable_finder; -pub mod process; - -pub use exception::*; -pub use executable_finder::*; -pub use php_executable_finder::*; -pub use process::*; diff --git a/crates/shirabe-external-packages/src/symfony/component/process/php_executable_finder.rs b/crates/shirabe-external-packages/src/symfony/component/process/php_executable_finder.rs deleted file mode 100644 index 0346d10..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/process/php_executable_finder.rs +++ /dev/null @@ -1,22 +0,0 @@ -#[derive(Debug)] -pub struct PhpExecutableFinder; - -impl Default for PhpExecutableFinder { - fn default() -> Self { - Self::new() - } -} - -impl PhpExecutableFinder { - pub fn new() -> Self { - todo!() - } - - pub fn find(&self, _include_args: bool) -> Option { - todo!() - } - - pub fn find_arguments(&self) -> Vec { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/component/process/process.rs b/crates/shirabe-external-packages/src/symfony/component/process/process.rs deleted file mode 100644 index 227606b..0000000 --- a/crates/shirabe-external-packages/src/symfony/component/process/process.rs +++ /dev/null @@ -1,116 +0,0 @@ -use indexmap::IndexMap; - -#[derive(Debug)] -pub struct Process; - -impl Process { - pub const ERR: &'static str = "err"; - pub const OUT: &'static str = "out"; - - pub fn new( - _command: Vec, - _cwd: Option, - _env: Option>, - _input: Option, - _timeout: Option, - ) -> Self { - todo!() - } - - pub fn from_shell_commandline( - _command: &str, - _cwd: Option<&str>, - _env: Option>, - _input: Option, - _timeout: Option, - ) -> Self { - todo!() - } - - pub fn set_timeout(&mut self, _timeout: Option) -> &mut Self { - todo!() - } - - pub fn set_env(&mut self, _env: IndexMap) -> &mut Self { - todo!() - } - - pub fn set_input(&mut self, _input: Option) -> &mut Self { - todo!() - } - - pub fn run(&mut self, _callback: Option>) -> i64 { - todo!() - } - - pub fn must_run( - &mut self, - _callback: Option>, - ) -> anyhow::Result<&mut Self> { - todo!() - } - - pub fn start(&mut self, _callback: Option>) { - todo!() - } - - pub fn wait(&mut self, _callback: Option>) -> i64 { - todo!() - } - - pub fn stop(&mut self, _timeout: f64, _signal: Option) -> Option { - todo!() - } - - pub fn is_running(&self) -> bool { - todo!() - } - - pub fn is_successful(&self) -> bool { - todo!() - } - - pub fn is_started(&self) -> bool { - todo!() - } - - pub fn is_terminated(&self) -> bool { - todo!() - } - - pub fn get_output(&self) -> String { - todo!() - } - - pub fn get_error_output(&self) -> String { - todo!() - } - - pub fn get_exit_code(&self) -> Option { - todo!() - } - - pub fn get_exit_code_text(&self) -> Option { - todo!() - } - - pub fn get_command_line(&self) -> String { - todo!() - } - - pub fn check_timeout(&self) -> anyhow::Result<()> { - todo!() - } - - pub fn get_timeout(&self) -> Option { - todo!() - } - - pub fn set_working_directory(&mut self, _cwd: &str) -> &mut Self { - todo!() - } - - pub fn set_tty(&mut self, _tty: bool) -> anyhow::Result<&mut Self> { - todo!() - } -} diff --git a/crates/shirabe-external-packages/src/symfony/console/application.rs b/crates/shirabe-external-packages/src/symfony/console/application.rs new file mode 100644 index 0000000..f937473 --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/console/application.rs @@ -0,0 +1,108 @@ +use crate::symfony::console::input::InputInterface; +use crate::symfony::console::output::OutputInterface; +use shirabe_php_shim::PhpMixed; + +#[derive(Debug)] +pub struct Application; + +impl Application { + pub fn new(_name: &str, _version: &str) -> Self { + todo!() + } + + pub fn run( + &mut self, + _input: Option>>, + _output: Option>>, + ) -> anyhow::Result { + todo!() + } + + pub fn set_name(&mut self, _name: &str) { + todo!() + } + + pub fn get_name(&self) -> String { + todo!() + } + + pub fn set_version(&mut self, _version: &str) { + todo!() + } + + pub fn get_version(&self) -> String { + todo!() + } + + pub fn add(&mut self, _command: PhpMixed) -> Option { + todo!() + } + + pub fn get(&self, _name: &str) -> anyhow::Result { + todo!() + } + + pub fn set_auto_exit(&mut self, _auto_exit: bool) { + todo!() + } + + pub fn set_catch_exceptions(&mut self, _catch_exceptions: bool) { + todo!() + } + + pub fn get_helper_set(&self) -> PhpMixed { + todo!() + } + + pub fn set_helper_set(&mut self, _helper_set: PhpMixed) { + todo!() + } + + pub fn get_definition(&self) -> PhpMixed { + todo!() + } + + pub fn get_long_version(&self) -> String { + todo!() + } + + pub fn find(&self, _name: &str) -> anyhow::Result { + todo!() + } + + pub fn all(&self, _namespace: Option<&str>) -> Vec { + todo!() + } + + pub fn get_namespaces(&self) -> Vec { + todo!() + } + + pub fn set_default_command( + &mut self, + _command_name: &str, + _is_single_command: bool, + ) -> &mut Self { + todo!() + } + + pub fn is_single_command(&self) -> bool { + todo!() + } + + pub fn render_throwable( + &self, + _exception: &anyhow::Error, + _output: std::rc::Rc>, + ) { + todo!() + } + + pub fn set_catch_errors(&mut self, _catch_errors: bool) { + todo!() + } + + pub fn has(&self, _name: &str) -> bool { + todo!() + } +} diff --git a/crates/shirabe-external-packages/src/symfony/console/command/command.rs b/crates/shirabe-external-packages/src/symfony/console/command/command.rs new file mode 100644 index 0000000..32965cf --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/console/command/command.rs @@ -0,0 +1,18 @@ +/// Stub for \Symfony\Component\Console\Command\Command. +pub trait Command { + fn get_name(&self) -> Option { + todo!() + } + + fn set_name(&mut self, _name: &str) { + todo!() + } + + fn get_description(&self) -> String { + todo!() + } + + fn set_description(&mut self, _description: &str) { + todo!() + } +} diff --git a/crates/shirabe-external-packages/src/symfony/console/command/mod.rs b/crates/shirabe-external-packages/src/symfony/console/command/mod.rs new file mode 100644 index 0000000..375170c --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/console/command/mod.rs @@ -0,0 +1,3 @@ +pub mod command; + +pub use command::*; diff --git a/crates/shirabe-external-packages/src/symfony/console/exception/command_not_found_exception.rs b/crates/shirabe-external-packages/src/symfony/console/exception/command_not_found_exception.rs new file mode 100644 index 0000000..f1ed60b --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/console/exception/command_not_found_exception.rs @@ -0,0 +1,13 @@ +#[derive(Debug)] +pub struct CommandNotFoundException { + pub message: String, + pub code: i64, +} + +impl std::fmt::Display for CommandNotFoundException { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.message) + } +} + +impl std::error::Error for CommandNotFoundException {} diff --git a/crates/shirabe-external-packages/src/symfony/console/exception/exception_interface.rs b/crates/shirabe-external-packages/src/symfony/console/exception/exception_interface.rs new file mode 100644 index 0000000..3c42009 --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/console/exception/exception_interface.rs @@ -0,0 +1 @@ +pub trait ExceptionInterface: std::error::Error {} diff --git a/crates/shirabe-external-packages/src/symfony/console/exception/mod.rs b/crates/shirabe-external-packages/src/symfony/console/exception/mod.rs index e76b8d9..25750a1 100644 --- a/crates/shirabe-external-packages/src/symfony/console/exception/mod.rs +++ b/crates/shirabe-external-packages/src/symfony/console/exception/mod.rs @@ -1,3 +1,7 @@ +pub mod command_not_found_exception; +pub mod exception_interface; pub mod invalid_argument_exception; +pub use command_not_found_exception::*; +pub use exception_interface::*; pub use invalid_argument_exception::*; diff --git a/crates/shirabe-external-packages/src/symfony/console/formatter/output_formatter.rs b/crates/shirabe-external-packages/src/symfony/console/formatter/output_formatter.rs index 77ebde5..4b499b8 100644 --- a/crates/shirabe-external-packages/src/symfony/console/formatter/output_formatter.rs +++ b/crates/shirabe-external-packages/src/symfony/console/formatter/output_formatter.rs @@ -1,12 +1,13 @@ -use indexmap::IndexMap; - #[derive(Debug)] pub struct OutputFormatter; impl OutputFormatter { pub fn new( _decorated: bool, - _styles: IndexMap, + _styles: indexmap::IndexMap< + String, + crate::symfony::console::formatter::OutputFormatterStyle, + >, ) -> Self { todo!() } @@ -27,6 +28,10 @@ impl OutputFormatter { todo!() } + pub fn escape_trailing_backslash(_text: &str) -> String { + todo!() + } + pub fn set_style( &mut self, _name: &str, 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 new file mode 100644 index 0000000..656828e --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/console/helper/formatter_helper.rs @@ -0,0 +1,12 @@ +#[derive(Debug)] +pub struct FormatterHelper; + +impl FormatterHelper { + pub fn format_section(&self, _section: &str, _message: &str, _style: &str) -> String { + todo!() + } + + pub fn format_block(&self, _messages: &[&str], _style: &str, _large: bool) -> String { + todo!() + } +} diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/helper.rs new file mode 100644 index 0000000..881aabd --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/console/helper/helper.rs @@ -0,0 +1,3 @@ +pub trait Helper { + fn get_name(&self) -> String; +} diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/mod.rs b/crates/shirabe-external-packages/src/symfony/console/helper/mod.rs index 5908bd6..b31517a 100644 --- a/crates/shirabe-external-packages/src/symfony/console/helper/mod.rs +++ b/crates/shirabe-external-packages/src/symfony/console/helper/mod.rs @@ -1,7 +1,15 @@ +pub mod formatter_helper; +pub mod helper; pub mod helper_set; +pub mod progress_bar; pub mod question_helper; pub mod table; +pub mod table_separator; +pub use formatter_helper::*; +pub use helper::*; pub use helper_set::*; +pub use progress_bar::*; pub use question_helper::*; pub use table::*; +pub use table_separator::*; 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 new file mode 100644 index 0000000..e2a728f --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/console/helper/progress_bar.rs @@ -0,0 +1,38 @@ +use crate::symfony::console::output::OutputInterface; + +#[derive(Debug)] +pub struct ProgressBar; + +impl ProgressBar { + pub fn new(_output: std::rc::Rc>, _max: i64) -> Self { + todo!() + } + + pub fn start(&mut self, _max: Option) { + todo!() + } + + pub fn advance(&mut self, _step: i64) { + todo!() + } + + pub fn finish(&mut self) { + todo!() + } + + pub fn set_format(&mut self, _format: &str) { + todo!() + } + + pub fn get_progress(&self) -> i64 { + todo!() + } + + pub fn get_max_steps(&self) -> i64 { + todo!() + } + + pub fn set_progress(&mut self, _step: i64) { + todo!() + } +} 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 c7d55be..70a9572 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 @@ -1,3 +1,6 @@ +use crate::symfony::console::input::InputInterface; +use crate::symfony::console::output::OutputInterface; +use crate::symfony::console::question::Question; use shirabe_php_shim::PhpMixed; #[derive(Debug)] @@ -6,9 +9,9 @@ pub struct QuestionHelper; impl QuestionHelper { pub fn ask( &self, - _input: &mut dyn std::any::Any, - _output: &mut dyn std::any::Any, - _question: &dyn std::any::Any, + _input: std::rc::Rc>, + _output: std::rc::Rc>, + _question: &Question, ) -> Option { todo!() } 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 30c008c..4ff5a5e 100644 --- a/crates/shirabe-external-packages/src/symfony/console/helper/table.rs +++ b/crates/shirabe-external-packages/src/symfony/console/helper/table.rs @@ -1,4 +1,4 @@ -use crate::symfony::component::console::output::OutputInterface; +use crate::symfony::console::output::OutputInterface; use shirabe_php_shim::PhpMixed; #[derive(Debug)] @@ -9,10 +9,6 @@ impl Table { todo!() } - pub fn set_style(&mut self, _style: &str) -> &mut Self { - todo!() - } - pub fn set_headers(&mut self, _headers: Vec) -> &mut Self { todo!() } @@ -28,4 +24,24 @@ impl Table { pub fn render(&mut self) { todo!() } + + pub fn set_style(&mut self, _style: &str) -> &mut Self { + todo!() + } + + pub fn set_column_width(&mut self, _column_index: usize, _width: i64) -> &mut Self { + todo!() + } + + pub fn set_column_widths(&mut self, _widths: Vec) -> &mut Self { + todo!() + } + + pub fn set_column_max_width(&mut self, _column_index: usize, _width: i64) -> &mut Self { + todo!() + } + + pub fn set_horizontal(&mut self, _horizontal: bool) -> &mut Self { + todo!() + } } diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/table_separator.rs b/crates/shirabe-external-packages/src/symfony/console/helper/table_separator.rs new file mode 100644 index 0000000..22ac013 --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/console/helper/table_separator.rs @@ -0,0 +1,14 @@ +#[derive(Debug)] +pub struct TableSeparator; + +impl Default for TableSeparator { + fn default() -> Self { + Self::new() + } +} + +impl TableSeparator { + pub fn new() -> Self { + todo!() + } +} diff --git a/crates/shirabe-external-packages/src/symfony/console/input/array_input.rs b/crates/shirabe-external-packages/src/symfony/console/input/array_input.rs index 0304649..0c68cf2 100644 --- a/crates/shirabe-external-packages/src/symfony/console/input/array_input.rs +++ b/crates/shirabe-external-packages/src/symfony/console/input/array_input.rs @@ -1,3 +1,4 @@ +use crate::symfony::console::input::InputDefinition; use crate::symfony::console::input::InputInterface; use indexmap::IndexMap; use shirabe_php_shim::PhpMixed; @@ -6,7 +7,10 @@ use shirabe_php_shim::PhpMixed; pub struct ArrayInput; impl ArrayInput { - pub fn new(_parameters: IndexMap) -> Self { + pub fn new( + _parameters: IndexMap, + _definition: Option, + ) -> Self { todo!() } } @@ -26,6 +30,9 @@ impl InputInterface for ArrayInput { ) -> PhpMixed { todo!() } + fn bind(&mut self, _definition: &InputDefinition) -> anyhow::Result<()> { + todo!() + } fn validate(&self) -> anyhow::Result<()> { todo!() } 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 new file mode 100644 index 0000000..74839fc --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs @@ -0,0 +1,30 @@ +use shirabe_php_shim::PhpMixed; + +#[derive(Debug)] +pub struct InputDefinition; + +impl InputDefinition { + pub fn new(_definition: Vec) -> Self { + todo!() + } + + pub fn add_argument(&mut self, _argument: PhpMixed) { + todo!() + } + + pub fn add_option(&mut self, _option: PhpMixed) { + todo!() + } + + pub fn has_option(&self, _name: &str) -> bool { + todo!() + } + + pub fn get_option(&self, _name: &str) -> anyhow::Result { + todo!() + } + + pub fn has_argument(&self, _name: &str) -> bool { + todo!() + } +} diff --git a/crates/shirabe-external-packages/src/symfony/console/input/input_interface.rs b/crates/shirabe-external-packages/src/symfony/console/input/input_interface.rs index 5ec5896..14458e4 100644 --- a/crates/shirabe-external-packages/src/symfony/console/input/input_interface.rs +++ b/crates/shirabe-external-packages/src/symfony/console/input/input_interface.rs @@ -1,7 +1,6 @@ -use indexmap::IndexMap; use shirabe_php_shim::PhpMixed; -pub trait InputInterface { +pub trait InputInterface: std::fmt::Debug { fn get_first_argument(&self) -> Option; fn has_parameter_option(&self, values: &[&str], only_params: bool) -> bool; fn get_parameter_option( @@ -10,12 +9,16 @@ pub trait InputInterface { default: PhpMixed, only_params: bool, ) -> PhpMixed; + fn bind( + &mut self, + definition: &crate::symfony::console::input::InputDefinition, + ) -> anyhow::Result<()>; fn validate(&self) -> anyhow::Result<()>; - fn get_arguments(&self) -> IndexMap; + fn get_arguments(&self) -> indexmap::IndexMap; fn get_argument(&self, name: &str) -> PhpMixed; fn set_argument(&mut self, name: &str, value: PhpMixed) -> anyhow::Result<()>; fn has_argument(&self, name: &str) -> bool; - fn get_options(&self) -> IndexMap; + fn get_options(&self) -> indexmap::IndexMap; fn get_option(&self, name: &str) -> PhpMixed; fn set_option(&mut self, name: &str, value: PhpMixed) -> anyhow::Result<()>; fn has_option(&self, name: &str) -> bool; diff --git a/crates/shirabe-external-packages/src/symfony/console/input/mod.rs b/crates/shirabe-external-packages/src/symfony/console/input/mod.rs index 77a6f66..8c6a28f 100644 --- a/crates/shirabe-external-packages/src/symfony/console/input/mod.rs +++ b/crates/shirabe-external-packages/src/symfony/console/input/mod.rs @@ -1,5 +1,6 @@ pub mod array_input; pub mod input_argument; +pub mod input_definition; pub mod input_interface; pub mod input_option; pub mod streamable_input_interface; @@ -7,6 +8,7 @@ pub mod string_input; pub use array_input::*; pub use input_argument::*; +pub use input_definition::*; pub use input_interface::*; pub use input_option::*; pub use streamable_input_interface::*; diff --git a/crates/shirabe-external-packages/src/symfony/console/input/string_input.rs b/crates/shirabe-external-packages/src/symfony/console/input/string_input.rs index 3d19823..34b2bfc 100644 --- a/crates/shirabe-external-packages/src/symfony/console/input/string_input.rs +++ b/crates/shirabe-external-packages/src/symfony/console/input/string_input.rs @@ -1,3 +1,4 @@ +use crate::symfony::console::input::InputDefinition; use crate::symfony::console::input::InputInterface; use indexmap::IndexMap; use shirabe_php_shim::PhpMixed; @@ -26,6 +27,9 @@ impl InputInterface for StringInput { ) -> PhpMixed { todo!() } + fn bind(&mut self, _definition: &InputDefinition) -> anyhow::Result<()> { + todo!() + } fn validate(&self) -> anyhow::Result<()> { todo!() } diff --git a/crates/shirabe-external-packages/src/symfony/console/mod.rs b/crates/shirabe-external-packages/src/symfony/console/mod.rs index 6812ab6..b5b557d 100644 --- a/crates/shirabe-external-packages/src/symfony/console/mod.rs +++ b/crates/shirabe-external-packages/src/symfony/console/mod.rs @@ -1,3 +1,5 @@ +pub mod application; +pub mod command; pub mod completion; pub mod exception; pub mod formatter; @@ -5,8 +7,12 @@ pub mod helper; pub mod input; pub mod output; pub mod question; +pub mod single_command_application; pub mod style; +pub mod terminal; +pub use application::*; +pub use command::*; pub use completion::*; pub use exception::*; pub use formatter::*; @@ -14,4 +20,6 @@ pub use helper::*; pub use input::*; pub use output::*; pub use question::*; +pub use single_command_application::*; pub use style::*; +pub use terminal::*; diff --git a/crates/shirabe-external-packages/src/symfony/console/output/console_output.rs b/crates/shirabe-external-packages/src/symfony/console/output/console_output.rs new file mode 100644 index 0000000..5aa6ff0 --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/console/output/console_output.rs @@ -0,0 +1,73 @@ +use crate::symfony::console::formatter::OutputFormatter; +use crate::symfony::console::output::ConsoleOutputInterface; +use crate::symfony::console::output::OutputInterface; + +#[derive(Debug)] +pub struct ConsoleOutput; + +impl ConsoleOutput { + pub fn new( + _verbosity: i64, + _decorated: Option, + _formatter: Option, + ) -> Self { + todo!() + } +} + +impl ConsoleOutputInterface for ConsoleOutput { + fn get_error_output(&self) -> std::rc::Rc> { + todo!() + } + + fn set_error_output(&mut self, _error: std::rc::Rc>) { + todo!() + } +} + +impl OutputInterface for ConsoleOutput { + fn is_console_output_interface(&self) -> bool { + true + } + + fn as_console_output_interface(&self) -> Option<&dyn ConsoleOutputInterface> { + Some(self) + } + + fn write(&self, _messages: &str, _newline: bool, _type: i64) { + todo!() + } + fn writeln(&self, _messages: &str, _type: i64) { + todo!() + } + fn set_verbosity(&self, _level: i64) { + todo!() + } + fn get_verbosity(&self) -> i64 { + todo!() + } + fn is_quiet(&self) -> bool { + todo!() + } + fn is_verbose(&self) -> bool { + todo!() + } + fn is_very_verbose(&self) -> bool { + todo!() + } + fn is_debug(&self) -> bool { + todo!() + } + fn set_decorated(&self, _decorated: bool) { + todo!() + } + fn is_decorated(&self) -> bool { + todo!() + } + fn set_formatter(&self, _formatter: OutputFormatter) { + todo!() + } + fn get_formatter(&self) -> &OutputFormatter { + todo!() + } +} diff --git a/crates/shirabe-external-packages/src/symfony/console/output/console_output_interface.rs b/crates/shirabe-external-packages/src/symfony/console/output/console_output_interface.rs new file mode 100644 index 0000000..0b5b432 --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/console/output/console_output_interface.rs @@ -0,0 +1,6 @@ +use crate::symfony::console::output::OutputInterface; + +pub trait ConsoleOutputInterface: OutputInterface { + fn get_error_output(&self) -> std::rc::Rc>; + fn set_error_output(&mut self, error: std::rc::Rc>); +} diff --git a/crates/shirabe-external-packages/src/symfony/console/output/mod.rs b/crates/shirabe-external-packages/src/symfony/console/output/mod.rs index 8f0c7f1..ac2b687 100644 --- a/crates/shirabe-external-packages/src/symfony/console/output/mod.rs +++ b/crates/shirabe-external-packages/src/symfony/console/output/mod.rs @@ -1,5 +1,9 @@ +pub mod console_output; +pub mod console_output_interface; pub mod output_interface; pub mod stream_output; +pub use console_output::*; +pub use console_output_interface::*; pub use output_interface::*; pub use stream_output::*; diff --git a/crates/shirabe-external-packages/src/symfony/console/output/output_interface.rs b/crates/shirabe-external-packages/src/symfony/console/output/output_interface.rs index 4d5b7c7..18eadfb 100644 --- a/crates/shirabe-external-packages/src/symfony/console/output/output_interface.rs +++ b/crates/shirabe-external-packages/src/symfony/console/output/output_interface.rs @@ -1,24 +1,33 @@ use crate::symfony::console::formatter::OutputFormatter; +use crate::symfony::console::output::ConsoleOutputInterface; -pub trait OutputInterface { - fn write(&mut self, messages: &str, newline: bool, r#type: i64); - fn writeln(&mut self, messages: &str, r#type: i64); - fn set_verbosity(&mut self, level: i64); +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); + fn writeln(&self, messages: &str, r#type: i64); + fn set_verbosity(&self, level: i64); fn get_verbosity(&self) -> i64; fn is_quiet(&self) -> bool; fn is_verbose(&self) -> bool; fn is_very_verbose(&self) -> bool; fn is_debug(&self) -> bool; - fn set_decorated(&mut self, decorated: bool); + fn set_decorated(&self, decorated: bool); fn is_decorated(&self) -> bool; - fn set_formatter(&mut self, formatter: OutputFormatter); - fn get_formatter(&mut self) -> &mut OutputFormatter; + fn set_formatter(&self, formatter: OutputFormatter); + fn get_formatter(&self) -> &OutputFormatter; /// PHP: `$output instanceof ConsoleOutputInterface`. Default false; ConsoleOutput overrides. fn is_console_output_interface(&self) -> bool { false } + /// PHP: `$output instanceof ConsoleOutputInterface`. Returns the output as a + /// ConsoleOutputInterface trait object when it is one. Default None; ConsoleOutput overrides. + fn as_console_output_interface(&self) -> Option<&dyn ConsoleOutputInterface> { + None + } + /// PHP: only StreamOutput exposes `getStream()`. Default panics for outputs without one. fn get_stream(&self) -> shirabe_php_shim::PhpResource { todo!("get_stream not available on this OutputInterface implementation") diff --git a/crates/shirabe-external-packages/src/symfony/console/output/stream_output.rs b/crates/shirabe-external-packages/src/symfony/console/output/stream_output.rs index 654e7f6..6aa79b8 100644 --- a/crates/shirabe-external-packages/src/symfony/console/output/stream_output.rs +++ b/crates/shirabe-external-packages/src/symfony/console/output/stream_output.rs @@ -12,13 +12,13 @@ impl StreamOutput { } impl OutputInterface for StreamOutput { - fn write(&mut self, _messages: &str, _newline: bool, _type: i64) { + fn write(&self, _messages: &str, _newline: bool, _type: i64) { todo!() } - fn writeln(&mut self, _messages: &str, _type: i64) { + fn writeln(&self, _messages: &str, _type: i64) { todo!() } - fn set_verbosity(&mut self, _level: i64) { + fn set_verbosity(&self, _level: i64) { todo!() } fn get_verbosity(&self) -> i64 { @@ -36,16 +36,19 @@ impl OutputInterface for StreamOutput { fn is_debug(&self) -> bool { todo!() } - fn set_decorated(&mut self, _decorated: bool) { + fn set_decorated(&self, _decorated: bool) { todo!() } fn is_decorated(&self) -> bool { todo!() } - fn set_formatter(&mut self, _formatter: OutputFormatter) { + fn set_formatter(&self, _formatter: OutputFormatter) { todo!() } - fn get_formatter(&mut self) -> &mut OutputFormatter { + fn get_formatter(&self) -> &OutputFormatter { + todo!() + } + fn get_stream(&self) -> shirabe_php_shim::PhpResource { todo!() } } diff --git a/crates/shirabe-external-packages/src/symfony/console/question/choice_question.rs b/crates/shirabe-external-packages/src/symfony/console/question/choice_question.rs new file mode 100644 index 0000000..5eb5818 --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/console/question/choice_question.rs @@ -0,0 +1,19 @@ +use crate::symfony::console::question::Question; +use shirabe_php_shim::PhpMixed; + +#[derive(Debug)] +pub struct ChoiceQuestion(pub Question); + +impl ChoiceQuestion { + pub fn new(_question: &str, _choices: Vec, _default: Option) -> Self { + todo!() + } + + pub fn set_multiselect(&mut self, _multiselect: bool) { + todo!() + } + + pub fn set_error_message(&mut self, _error_message: &str) { + todo!() + } +} diff --git a/crates/shirabe-external-packages/src/symfony/console/question/mod.rs b/crates/shirabe-external-packages/src/symfony/console/question/mod.rs index 60c3107..67e7e7b 100644 --- a/crates/shirabe-external-packages/src/symfony/console/question/mod.rs +++ b/crates/shirabe-external-packages/src/symfony/console/question/mod.rs @@ -1,3 +1,5 @@ +pub mod choice_question; pub mod question; +pub use choice_question::*; pub use question::*; diff --git a/crates/shirabe-external-packages/src/symfony/console/question/question.rs b/crates/shirabe-external-packages/src/symfony/console/question/question.rs index 02402ce..552f780 100644 --- a/crates/shirabe-external-packages/src/symfony/console/question/question.rs +++ b/crates/shirabe-external-packages/src/symfony/console/question/question.rs @@ -15,11 +15,11 @@ impl Question { todo!() } - pub fn set_normalizer(&mut self, _normalizer: Box PhpMixed>) { + pub fn set_max_attempts(&mut self, _attempts: Option) { todo!() } - pub fn set_max_attempts(&mut self, _attempts: Option) { + pub fn set_normalizer(&mut self, _normalizer: Box PhpMixed>) { todo!() } @@ -27,6 +27,10 @@ impl Question { todo!() } + pub fn set_hidden_fallback(&mut self, _fallback: bool) { + todo!() + } + pub fn get_question(&self) -> String { todo!() } @@ -38,4 +42,12 @@ impl Question { pub fn is_hidden(&self) -> bool { todo!() } + + pub fn get_validator(&self) -> Option<&dyn Fn(Option) -> anyhow::Result> { + todo!() + } + + pub fn get_max_attempts(&self) -> Option { + todo!() + } } diff --git a/crates/shirabe-external-packages/src/symfony/console/single_command_application.rs b/crates/shirabe-external-packages/src/symfony/console/single_command_application.rs new file mode 100644 index 0000000..9273477 --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/console/single_command_application.rs @@ -0,0 +1,33 @@ +#[derive(Debug)] +pub struct SingleCommandApplication; + +impl Default for SingleCommandApplication { + fn default() -> Self { + Self::new() + } +} + +impl SingleCommandApplication { + pub fn new() -> Self { + todo!() + } + + pub fn set_name(&mut self, _name: &str) -> &mut Self { + todo!() + } + + pub fn set_version(&mut self, _version: &str) -> &mut Self { + todo!() + } + + pub fn set_code( + &mut self, + _code: Box i64>, + ) -> &mut Self { + todo!() + } + + pub fn run(&mut self) -> anyhow::Result { + 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 b5dfded..c26ca30 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 @@ -1,5 +1,5 @@ -use crate::symfony::component::console::input::InputInterface; -use crate::symfony::component::console::output::OutputInterface; +use crate::symfony::console::input::InputInterface; +use crate::symfony::console::output::OutputInterface; use shirabe_php_shim::PhpMixed; #[derive(Debug)] diff --git a/crates/shirabe-external-packages/src/symfony/console/terminal.rs b/crates/shirabe-external-packages/src/symfony/console/terminal.rs new file mode 100644 index 0000000..251d71e --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/console/terminal.rs @@ -0,0 +1,22 @@ +#[derive(Debug)] +pub struct Terminal; + +impl Default for Terminal { + fn default() -> Self { + Self::new() + } +} + +impl Terminal { + pub fn new() -> Self { + todo!() + } + + pub fn get_width(&self) -> i64 { + todo!() + } + + pub fn get_height(&self) -> i64 { + todo!() + } +} diff --git a/crates/shirabe-external-packages/src/symfony/filesystem/exception/io_exception.rs b/crates/shirabe-external-packages/src/symfony/filesystem/exception/io_exception.rs new file mode 100644 index 0000000..a5f2844 --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/filesystem/exception/io_exception.rs @@ -0,0 +1,29 @@ +#[derive(Debug)] +pub struct IOException { + pub message: String, + pub code: i64, + pub path: Option, +} + +impl IOException { + pub fn new( + message: String, + code: i64, + _previous: Option>, + path: Option, + ) -> Self { + Self { + message, + code, + path, + } + } +} + +impl std::fmt::Display for IOException { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.message) + } +} + +impl std::error::Error for IOException {} diff --git a/crates/shirabe-external-packages/src/symfony/filesystem/exception/mod.rs b/crates/shirabe-external-packages/src/symfony/filesystem/exception/mod.rs new file mode 100644 index 0000000..2c19405 --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/filesystem/exception/mod.rs @@ -0,0 +1,3 @@ +pub mod io_exception; + +pub use io_exception::*; diff --git a/crates/shirabe-external-packages/src/symfony/filesystem/filesystem.rs b/crates/shirabe-external-packages/src/symfony/filesystem/filesystem.rs new file mode 100644 index 0000000..522309e --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/filesystem/filesystem.rs @@ -0,0 +1,137 @@ +use shirabe_php_shim::PhpMixed; + +#[derive(Debug, Clone)] +pub struct Filesystem; + +impl Default for Filesystem { + fn default() -> Self { + Self::new() + } +} + +impl Filesystem { + pub fn new() -> Self { + todo!() + } + + pub fn copy( + &self, + _origin_file: &str, + _target_file: &str, + _override_file: bool, + ) -> anyhow::Result<()> { + todo!() + } + + pub fn mkdir(&self, _dirs: PhpMixed, _mode: u32) -> anyhow::Result<()> { + todo!() + } + + pub fn exists(&self, _files: PhpMixed) -> bool { + todo!() + } + + pub fn touch( + &self, + _files: PhpMixed, + _time: Option, + _atime: Option, + ) -> anyhow::Result<()> { + todo!() + } + + pub fn remove(&self, _files: PhpMixed) -> anyhow::Result<()> { + todo!() + } + + pub fn chmod( + &self, + _files: PhpMixed, + _mode: u32, + _umask: u32, + _recursive: bool, + ) -> anyhow::Result<()> { + todo!() + } + + pub fn chown(&self, _files: PhpMixed, _user: PhpMixed, _recursive: bool) -> anyhow::Result<()> { + todo!() + } + + pub fn chgrp( + &self, + _files: PhpMixed, + _group: PhpMixed, + _recursive: bool, + ) -> anyhow::Result<()> { + todo!() + } + + pub fn rename(&self, _origin: &str, _target: &str, _override_file: bool) -> anyhow::Result<()> { + todo!() + } + + pub fn symlink( + &self, + _origin_dir: &str, + _target_dir: &str, + _copy_on_windows: bool, + ) -> anyhow::Result<()> { + todo!() + } + + pub fn hard_link(&self, _origin_file: &str, _target_files: PhpMixed) -> anyhow::Result<()> { + todo!() + } + + pub fn read_link(&self, _path: &str) -> String { + todo!() + } + + pub fn make_path_relative(&self, _end_path: &str, _start_path: &str) -> String { + todo!() + } + + pub fn mirror( + &self, + _origin_dir: &str, + _target_dir: &str, + _iterator: Option, + _options: &indexmap::IndexMap, + ) -> anyhow::Result<()> { + todo!() + } + + pub fn is_absolute_path(&self, _file: &str) -> bool { + todo!() + } + + pub fn dump_file(&self, _filename: &str, _content: &str) -> anyhow::Result<()> { + todo!() + } + + pub fn append_to_file(&self, _filename: &str, _content: &str) -> anyhow::Result<()> { + todo!() + } + + pub fn temp_nam(&self, _dir: &str, _prefix: &str) -> anyhow::Result { + todo!() + } + + // Static-style helper methods used in the ported codebase + pub fn is_readable(_path: &str) -> bool { + todo!() + } + + pub fn is_local_path(_path: &str) -> bool { + todo!() + } + + pub fn trim_trailing_slash(_path: &str) -> String { + todo!() + } + + pub fn get_platform_path(_path: &str) -> String { + todo!() + } +} diff --git a/crates/shirabe-external-packages/src/symfony/filesystem/mod.rs b/crates/shirabe-external-packages/src/symfony/filesystem/mod.rs new file mode 100644 index 0000000..24be2ed --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/filesystem/mod.rs @@ -0,0 +1,5 @@ +pub mod exception; +pub mod filesystem; + +pub use exception::*; +pub use filesystem::*; diff --git a/crates/shirabe-external-packages/src/symfony/finder/finder.rs b/crates/shirabe-external-packages/src/symfony/finder/finder.rs new file mode 100644 index 0000000..59a6ad1 --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/finder/finder.rs @@ -0,0 +1,163 @@ +use crate::symfony::finder::SplFileInfo; + +/// Helper trait so `Finder::exclude` accepts both single strings and slices +/// (PHP's variadic / array argument compatibility). +pub trait IntoFinderExclude {} +impl IntoFinderExclude for &str {} +impl IntoFinderExclude for String {} +impl IntoFinderExclude for &String {} +impl IntoFinderExclude for &[String] {} +impl IntoFinderExclude for &Vec {} +impl IntoFinderExclude for Vec {} + +#[derive(Debug)] +pub struct Finder; + +impl Default for Finder { + fn default() -> Self { + Self::new() + } +} + +impl Finder { + pub fn new() -> Self { + todo!() + } + + pub fn create() -> Self { + todo!() + } + + pub fn files(&mut self) -> &mut Self { + todo!() + } + + pub fn directories(&mut self) -> &mut Self { + todo!() + } + + pub fn depth(&mut self, _level: i64) -> &mut Self { + todo!() + } + + pub fn r#in(&mut self, _dirs: &str) -> &mut Self { + todo!() + } + + pub fn filter(&mut self, _closure: Box bool>) -> &mut Self { + todo!() + } + + pub fn follow_links(&mut self) -> &mut Self { + todo!() + } + + pub fn exclude(&mut self, _exclude: E) -> &mut Self { + todo!() + } + + pub fn ignore_vcs(&mut self, _ignore_vcs: bool) -> &mut Self { + todo!() + } + + pub fn ignore_dot_files(&mut self, _ignore_dot_files: bool) -> &mut Self { + todo!() + } + + pub fn not_name(&mut self, _pattern: &str) -> &mut Self { + todo!() + } + + pub fn not_path(&mut self, _pattern: &str) -> &mut Self { + todo!() + } + + pub fn name(&mut self, _pattern: &str) -> &mut Self { + todo!() + } + + pub fn sort(&mut self, _comparator: F) -> &mut Self + where + F: FnMut(&SplFileInfo, &SplFileInfo) -> i64, + { + todo!() + } + + pub fn sort_by_name(&mut self) -> &mut Self { + todo!() + } + + pub fn sort_by_accessed_time(&mut self) -> &mut Self { + todo!() + } + + pub fn date(&mut self, _date: &str) -> &mut Self { + todo!() + } + + pub fn get_iterator(&self) -> FinderIterator { + todo!() + } + + pub fn iter(&self) -> impl Iterator { + todo!(); + std::iter::empty() + } + + /// PHP: Finder implements Countable. + pub fn len(&self) -> usize { + todo!() + } + + pub fn is_empty(&self) -> bool { + self.len() == 0 + } +} + +impl IntoIterator for &Finder { + type Item = SplFileInfo; + type IntoIter = std::vec::IntoIter; + + fn into_iter(self) -> Self::IntoIter { + todo!() + } +} + +#[derive(Debug)] +pub struct FinderIterator; + +impl FinderIterator { + pub fn valid(&self) -> bool { + todo!() + } + + pub fn current(&self) -> SplFileInfo { + todo!() + } +} + +impl Iterator for FinderIterator { + type Item = SplFileInfo; + + fn next(&mut self) -> Option { + todo!() + } +} + +impl IntoIterator for Finder { + type Item = SplFileInfo; + type IntoIter = std::vec::IntoIter; + + fn into_iter(self) -> Self::IntoIter { + todo!() + } +} + +impl IntoIterator for &mut Finder { + type Item = SplFileInfo; + type IntoIter = std::vec::IntoIter; + + fn into_iter(self) -> Self::IntoIter { + todo!() + } +} diff --git a/crates/shirabe-external-packages/src/symfony/finder/glob.rs b/crates/shirabe-external-packages/src/symfony/finder/glob.rs new file mode 100644 index 0000000..08ab6df --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/finder/glob.rs @@ -0,0 +1,12 @@ +#[derive(Debug)] +pub struct Glob; + +impl Glob { + pub fn to_regex( + _glob: &str, + _strict_leading_dot: bool, + _strict_wildcard_slash: bool, + ) -> String { + todo!() + } +} diff --git a/crates/shirabe-external-packages/src/symfony/finder/mod.rs b/crates/shirabe-external-packages/src/symfony/finder/mod.rs new file mode 100644 index 0000000..4b2d4b8 --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/finder/mod.rs @@ -0,0 +1,7 @@ +pub mod finder; +pub mod glob; +pub mod spl_file_info; + +pub use finder::*; +pub use glob::*; +pub use spl_file_info::*; diff --git a/crates/shirabe-external-packages/src/symfony/finder/spl_file_info.rs b/crates/shirabe-external-packages/src/symfony/finder/spl_file_info.rs new file mode 100644 index 0000000..3c1be6d --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/finder/spl_file_info.rs @@ -0,0 +1,62 @@ +#[derive(Debug)] +pub struct SplFileInfo; + +impl std::fmt::Display for SplFileInfo { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.get_pathname()) + } +} + +impl SplFileInfo { + pub fn new(_path: &str) -> Self { + todo!() + } + + pub fn get_pathname(&self) -> String { + todo!() + } + + pub fn get_path(&self) -> String { + todo!() + } + + pub fn get_filename(&self) -> String { + todo!() + } + + pub fn get_basename(&self, _suffix: Option<&str>) -> String { + todo!() + } + + pub fn get_extension(&self) -> String { + todo!() + } + + pub fn get_relative_path_name(&self) -> String { + todo!() + } + + pub fn get_relative_path(&self) -> String { + todo!() + } + + pub fn is_dir(&self) -> bool { + todo!() + } + + pub fn is_file(&self) -> bool { + todo!() + } + + pub fn is_link(&self) -> bool { + todo!() + } + + pub fn get_real_path(&self) -> Option { + todo!() + } + + pub fn get_size(&self) -> i64 { + todo!() + } +} diff --git a/crates/shirabe-external-packages/src/symfony/mod.rs b/crates/shirabe-external-packages/src/symfony/mod.rs index aaafe15..f176d3a 100644 --- a/crates/shirabe-external-packages/src/symfony/mod.rs +++ b/crates/shirabe-external-packages/src/symfony/mod.rs @@ -1,7 +1,9 @@ -pub mod component; pub mod console; +pub mod filesystem; +pub mod finder; pub mod process; -pub use component::*; pub use console::*; +pub use filesystem::*; +pub use finder::*; pub use process::*; diff --git a/crates/shirabe-external-packages/src/symfony/process/exception/mod.rs b/crates/shirabe-external-packages/src/symfony/process/exception/mod.rs new file mode 100644 index 0000000..8d275c1 --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/process/exception/mod.rs @@ -0,0 +1,7 @@ +pub mod process_signaled_exception; +pub mod process_timed_out_exception; +pub mod runtime_exception; + +pub use process_signaled_exception::*; +pub use process_timed_out_exception::*; +pub use runtime_exception::*; diff --git a/crates/shirabe-external-packages/src/symfony/process/exception/process_signaled_exception.rs b/crates/shirabe-external-packages/src/symfony/process/exception/process_signaled_exception.rs new file mode 100644 index 0000000..154a7a7 --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/process/exception/process_signaled_exception.rs @@ -0,0 +1,13 @@ +#[derive(Debug)] +pub struct ProcessSignaledException { + pub message: String, + pub code: i64, +} + +impl std::fmt::Display for ProcessSignaledException { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.message) + } +} + +impl std::error::Error for ProcessSignaledException {} diff --git a/crates/shirabe-external-packages/src/symfony/process/exception/process_timed_out_exception.rs b/crates/shirabe-external-packages/src/symfony/process/exception/process_timed_out_exception.rs new file mode 100644 index 0000000..cbcdaa4 --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/process/exception/process_timed_out_exception.rs @@ -0,0 +1,13 @@ +#[derive(Debug)] +pub struct ProcessTimedOutException { + pub message: String, + pub code: i64, +} + +impl std::fmt::Display for ProcessTimedOutException { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.message) + } +} + +impl std::error::Error for ProcessTimedOutException {} diff --git a/crates/shirabe-external-packages/src/symfony/process/exception/runtime_exception.rs b/crates/shirabe-external-packages/src/symfony/process/exception/runtime_exception.rs new file mode 100644 index 0000000..3ac2c8b --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/process/exception/runtime_exception.rs @@ -0,0 +1,13 @@ +#[derive(Debug)] +pub struct RuntimeException { + pub message: String, + pub code: i64, +} + +impl std::fmt::Display for RuntimeException { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.message) + } +} + +impl std::error::Error for RuntimeException {} diff --git a/crates/shirabe-external-packages/src/symfony/process/mod.rs b/crates/shirabe-external-packages/src/symfony/process/mod.rs index aeca4ff..6dd64e1 100644 --- a/crates/shirabe-external-packages/src/symfony/process/mod.rs +++ b/crates/shirabe-external-packages/src/symfony/process/mod.rs @@ -1,3 +1,9 @@ +pub mod exception; pub mod executable_finder; +pub mod php_executable_finder; +pub mod process; +pub use exception::*; pub use executable_finder::*; +pub use php_executable_finder::*; +pub use process::*; diff --git a/crates/shirabe-external-packages/src/symfony/process/php_executable_finder.rs b/crates/shirabe-external-packages/src/symfony/process/php_executable_finder.rs new file mode 100644 index 0000000..0346d10 --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/process/php_executable_finder.rs @@ -0,0 +1,22 @@ +#[derive(Debug)] +pub struct PhpExecutableFinder; + +impl Default for PhpExecutableFinder { + fn default() -> Self { + Self::new() + } +} + +impl PhpExecutableFinder { + pub fn new() -> Self { + todo!() + } + + pub fn find(&self, _include_args: bool) -> Option { + todo!() + } + + pub fn find_arguments(&self) -> Vec { + todo!() + } +} diff --git a/crates/shirabe-external-packages/src/symfony/process/process.rs b/crates/shirabe-external-packages/src/symfony/process/process.rs new file mode 100644 index 0000000..227606b --- /dev/null +++ b/crates/shirabe-external-packages/src/symfony/process/process.rs @@ -0,0 +1,116 @@ +use indexmap::IndexMap; + +#[derive(Debug)] +pub struct Process; + +impl Process { + pub const ERR: &'static str = "err"; + pub const OUT: &'static str = "out"; + + pub fn new( + _command: Vec, + _cwd: Option, + _env: Option>, + _input: Option, + _timeout: Option, + ) -> Self { + todo!() + } + + pub fn from_shell_commandline( + _command: &str, + _cwd: Option<&str>, + _env: Option>, + _input: Option, + _timeout: Option, + ) -> Self { + todo!() + } + + pub fn set_timeout(&mut self, _timeout: Option) -> &mut Self { + todo!() + } + + pub fn set_env(&mut self, _env: IndexMap) -> &mut Self { + todo!() + } + + pub fn set_input(&mut self, _input: Option) -> &mut Self { + todo!() + } + + pub fn run(&mut self, _callback: Option>) -> i64 { + todo!() + } + + pub fn must_run( + &mut self, + _callback: Option>, + ) -> anyhow::Result<&mut Self> { + todo!() + } + + pub fn start(&mut self, _callback: Option>) { + todo!() + } + + pub fn wait(&mut self, _callback: Option>) -> i64 { + todo!() + } + + pub fn stop(&mut self, _timeout: f64, _signal: Option) -> Option { + todo!() + } + + pub fn is_running(&self) -> bool { + todo!() + } + + pub fn is_successful(&self) -> bool { + todo!() + } + + pub fn is_started(&self) -> bool { + todo!() + } + + pub fn is_terminated(&self) -> bool { + todo!() + } + + pub fn get_output(&self) -> String { + todo!() + } + + pub fn get_error_output(&self) -> String { + todo!() + } + + pub fn get_exit_code(&self) -> Option { + todo!() + } + + pub fn get_exit_code_text(&self) -> Option { + todo!() + } + + pub fn get_command_line(&self) -> String { + todo!() + } + + pub fn check_timeout(&self) -> anyhow::Result<()> { + todo!() + } + + pub fn get_timeout(&self) -> Option { + todo!() + } + + pub fn set_working_directory(&mut self, _cwd: &str) -> &mut Self { + todo!() + } + + pub fn set_tty(&mut self, _tty: bool) -> anyhow::Result<&mut Self> { + todo!() + } +} -- cgit v1.3.1