aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-external-packages/src/symfony/console/event
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-14 02:04:29 +0900
committernsfisis <nsfisis@gmail.com>2026-06-14 02:06:44 +0900
commit299bf55547c92cbe8c32db2af0350ddad30b0b69 (patch)
tree2fbd2dedc833da709d5bcf8f70bd8d56569376a3 /crates/shirabe-external-packages/src/symfony/console/event
parenteb98b2d00e0f011b568264edfe67f86e2ac9f1df (diff)
downloadphp-shirabe-299bf55547c92cbe8c32db2af0350ddad30b0b69.tar.gz
php-shirabe-299bf55547c92cbe8c32db2af0350ddad30b0b69.tar.zst
php-shirabe-299bf55547c92cbe8c32db2af0350ddad30b0b69.zip
refactor(console): remove unused symfony event dispatcher
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-external-packages/src/symfony/console/event')
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/event/console_command_event.rs45
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/event/console_error_event.rs54
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/event/console_event.rs42
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/event/console_signal_event.rs30
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/event/console_terminate_event.rs37
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/event/mod.rs11
6 files changed, 0 insertions, 219 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/event/console_command_event.rs b/crates/shirabe-external-packages/src/symfony/console/event/console_command_event.rs
deleted file mode 100644
index b20c84c..0000000
--- a/crates/shirabe-external-packages/src/symfony/console/event/console_command_event.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-//! ref: composer/vendor/symfony/console/Event/ConsoleCommandEvent.php
-
-use super::console_event::ConsoleEvent;
-use crate::symfony::console::command::command::Command;
-use crate::symfony::console::input::input_interface::InputInterface;
-use crate::symfony::console::output::output_interface::OutputInterface;
-
-/// Allows to do things before the command is executed, like skipping the command or
-/// executing code before the command is going to be executed.
-///
-/// Changing the input arguments will have no effect.
-#[derive(Debug)]
-pub struct ConsoleCommandEvent {
- inner: ConsoleEvent,
- command_should_run: bool,
-}
-
-impl ConsoleCommandEvent {
- pub const RETURN_CODE_DISABLED: i64 = 113;
-
- pub fn new(
- command: Option<Box<dyn Command>>,
- input: Box<dyn InputInterface>,
- output: Box<dyn OutputInterface>,
- ) -> Self {
- Self {
- inner: ConsoleEvent::new(command, input, output),
- command_should_run: true,
- }
- }
-
- pub fn disable_command(&mut self) -> bool {
- self.command_should_run = false;
- self.command_should_run
- }
-
- pub fn enable_command(&mut self) -> bool {
- self.command_should_run = true;
- self.command_should_run
- }
-
- pub fn command_should_run(&self) -> bool {
- self.command_should_run
- }
-}
diff --git a/crates/shirabe-external-packages/src/symfony/console/event/console_error_event.rs b/crates/shirabe-external-packages/src/symfony/console/event/console_error_event.rs
deleted file mode 100644
index 26bc908..0000000
--- a/crates/shirabe-external-packages/src/symfony/console/event/console_error_event.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-//! ref: composer/vendor/symfony/console/Event/ConsoleErrorEvent.php
-
-use super::console_event::ConsoleEvent;
-use crate::symfony::console::command::command::Command;
-use crate::symfony::console::input::input_interface::InputInterface;
-use crate::symfony::console::output::output_interface::OutputInterface;
-
-#[derive(Debug)]
-pub struct ConsoleErrorEvent {
- inner: ConsoleEvent,
- error: Box<dyn std::error::Error + Send + Sync>,
- exit_code: Option<i64>,
-}
-
-impl ConsoleErrorEvent {
- pub fn new(
- input: Box<dyn InputInterface>,
- output: Box<dyn OutputInterface>,
- error: Box<dyn std::error::Error + Send + Sync>,
- command: Option<Box<dyn Command>>,
- ) -> Self {
- Self {
- inner: ConsoleEvent::new(command, input, output),
- error,
- exit_code: None,
- }
- }
-
- pub fn get_error(&self) -> &(dyn std::error::Error + Send + Sync) {
- self.error.as_ref()
- }
-
- pub fn set_error(&mut self, error: Box<dyn std::error::Error + Send + Sync>) {
- self.error = error;
- }
-
- pub fn set_exit_code(&mut self, exit_code: i64) {
- self.exit_code = Some(exit_code);
- // TODO: The PHP implementation uses \ReflectionProperty to forcibly set the `code`
- // field on the error object. This requires a Reflection API equivalent; review needed.
- todo!("set error code via reflection equivalent")
- }
-
- pub fn get_exit_code(&self) -> i64 {
- match self.exit_code {
- Some(code) => code,
- None => {
- // PHP: is_int($error->getCode()) && 0 !== $error->getCode() ? $error->getCode() : 1
- // Throwable::getCode() has no direct equivalent on std::error::Error.
- todo!("retrieve error code from Throwable equivalent")
- }
- }
- }
-}
diff --git a/crates/shirabe-external-packages/src/symfony/console/event/console_event.rs b/crates/shirabe-external-packages/src/symfony/console/event/console_event.rs
deleted file mode 100644
index cade304..0000000
--- a/crates/shirabe-external-packages/src/symfony/console/event/console_event.rs
+++ /dev/null
@@ -1,42 +0,0 @@
-//! ref: composer/vendor/symfony/console/Event/ConsoleEvent.php
-
-use crate::symfony::console::command::command::Command;
-use crate::symfony::console::input::input_interface::InputInterface;
-use crate::symfony::console::output::output_interface::OutputInterface;
-use crate::symfony::contracts::event_dispatcher::event::Event;
-
-/// Allows to inspect input and output of a command.
-#[derive(Debug)]
-pub struct ConsoleEvent {
- inner: Event,
- pub(crate) command: Option<Box<dyn Command>>,
- input: Box<dyn InputInterface>,
- output: Box<dyn OutputInterface>,
-}
-
-impl ConsoleEvent {
- pub fn new(
- command: Option<Box<dyn Command>>,
- input: Box<dyn InputInterface>,
- output: Box<dyn OutputInterface>,
- ) -> Self {
- Self {
- inner: Event,
- command,
- input,
- output,
- }
- }
-
- pub fn get_command(&self) -> Option<&dyn Command> {
- self.command.as_deref()
- }
-
- pub fn get_input(&self) -> &dyn InputInterface {
- self.input.as_ref()
- }
-
- pub fn get_output(&self) -> &dyn OutputInterface {
- self.output.as_ref()
- }
-}
diff --git a/crates/shirabe-external-packages/src/symfony/console/event/console_signal_event.rs b/crates/shirabe-external-packages/src/symfony/console/event/console_signal_event.rs
deleted file mode 100644
index 6d9633c..0000000
--- a/crates/shirabe-external-packages/src/symfony/console/event/console_signal_event.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-//! ref: composer/vendor/symfony/console/Event/ConsoleSignalEvent.php
-
-use super::console_event::ConsoleEvent;
-use crate::symfony::console::command::command::Command;
-use crate::symfony::console::input::input_interface::InputInterface;
-use crate::symfony::console::output::output_interface::OutputInterface;
-
-#[derive(Debug)]
-pub struct ConsoleSignalEvent {
- inner: ConsoleEvent,
- handling_signal: i64,
-}
-
-impl ConsoleSignalEvent {
- pub fn new(
- command: Box<dyn Command>,
- input: Box<dyn InputInterface>,
- output: Box<dyn OutputInterface>,
- handling_signal: i64,
- ) -> Self {
- Self {
- inner: ConsoleEvent::new(Some(command), input, output),
- handling_signal,
- }
- }
-
- pub fn get_handling_signal(&self) -> i64 {
- self.handling_signal
- }
-}
diff --git a/crates/shirabe-external-packages/src/symfony/console/event/console_terminate_event.rs b/crates/shirabe-external-packages/src/symfony/console/event/console_terminate_event.rs
deleted file mode 100644
index cfa4f4f..0000000
--- a/crates/shirabe-external-packages/src/symfony/console/event/console_terminate_event.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-//! ref: composer/vendor/symfony/console/Event/ConsoleTerminateEvent.php
-
-use super::console_event::ConsoleEvent;
-use crate::symfony::console::command::command::Command;
-use crate::symfony::console::input::input_interface::InputInterface;
-use crate::symfony::console::output::output_interface::OutputInterface;
-
-/// Allows to manipulate the exit code of a command after its execution.
-#[derive(Debug)]
-pub struct ConsoleTerminateEvent {
- inner: ConsoleEvent,
- exit_code: i64,
-}
-
-impl ConsoleTerminateEvent {
- pub fn new(
- command: Box<dyn Command>,
- input: Box<dyn InputInterface>,
- output: Box<dyn OutputInterface>,
- exit_code: i64,
- ) -> Self {
- let mut instance = Self {
- inner: ConsoleEvent::new(Some(command), input, output),
- exit_code: 0,
- };
- instance.set_exit_code(exit_code);
- instance
- }
-
- pub fn set_exit_code(&mut self, exit_code: i64) {
- self.exit_code = exit_code;
- }
-
- pub fn get_exit_code(&self) -> i64 {
- self.exit_code
- }
-}
diff --git a/crates/shirabe-external-packages/src/symfony/console/event/mod.rs b/crates/shirabe-external-packages/src/symfony/console/event/mod.rs
deleted file mode 100644
index efc6b2d..0000000
--- a/crates/shirabe-external-packages/src/symfony/console/event/mod.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-pub mod console_command_event;
-pub mod console_error_event;
-pub mod console_event;
-pub mod console_signal_event;
-pub mod console_terminate_event;
-
-pub use console_command_event::*;
-pub use console_error_event::*;
-pub use console_event::*;
-pub use console_signal_event::*;
-pub use console_terminate_event::*;