From e752ff0a7e21334c0b9b9e1b87d4965ea8760fd5 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 17 May 2026 21:24:24 +0900 Subject: fix(compile): convert Command struct to trait Symfony Command was a struct but used as dyn Trait (Box) in console/application.rs. Convert it to a trait with CommandBase as the concrete stub, and add impl Command for all Composer commands. --- crates/shirabe/src/console/application.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'crates/shirabe/src/console') diff --git a/crates/shirabe/src/console/application.rs b/crates/shirabe/src/console/application.rs index dec25ce..07996bb 100644 --- a/crates/shirabe/src/console/application.rs +++ b/crates/shirabe/src/console/application.rs @@ -6,7 +6,7 @@ use indexmap::IndexMap; use shirabe_external_packages::composer::xdebug_handler::xdebug_handler::XdebugHandler; use shirabe_external_packages::seld::json_lint::parsing_exception::ParsingException; use shirabe_external_packages::symfony::component::console::application::Application as BaseApplication; -use shirabe_external_packages::symfony::component::console::command::command::Command as SymfonyCommand; +use shirabe_external_packages::symfony::component::console::command::command::Command; use shirabe_external_packages::symfony::component::console::exception::command_not_found_exception::CommandNotFoundException; use shirabe_external_packages::symfony::component::console::exception::exception_interface::ExceptionInterface; use shirabe_external_packages::symfony::component::console::helper::helper_set::HelperSet; @@ -617,7 +617,7 @@ impl Application { // if the command is not an array of commands, and points to a valid Command subclass, import its details directly let dummy_str = dummy.as_string().unwrap_or(""); - let cmd: Box = if is_string(dummy) + let cmd: Box = if is_string(dummy) && shirabe_php_shim::class_exists(dummy_str) && is_subclass_of( dummy_str, @@ -630,7 +630,7 @@ impl Application { io.write_error(&format!("The script named {} extends SingleCommandApplication which is not compatible with Composer 2.9+, make sure you extend Symfony\\Component\\Console\\Command instead.", script)); } let mut cmd = shirabe_php_shim::instantiate_class::< - Box, + Box, >( dummy_str, vec![PhpMixed::String(script.clone())], @@ -984,9 +984,9 @@ impl Application { } /// Initializes all the composer commands. - pub(crate) fn get_default_commands(&self) -> Vec> { + pub(crate) fn get_default_commands(&self) -> Vec> { let mut cmds = self.inner.get_default_commands(); - let extras: Vec> = vec![ + let extras: Vec> = vec![ Box::new(AboutCommand::new()), Box::new(ConfigCommand::new()), Box::new(DependsCommand::new()), @@ -1101,9 +1101,9 @@ impl Application { definition } - fn get_plugin_commands(&mut self) -> anyhow::Result>> { + fn get_plugin_commands(&mut self) -> anyhow::Result>> { // TODO(plugin): plugin command discovery is part of the plugin API - let mut commands: Vec> = vec![]; + let mut commands: Vec> = vec![]; let composer = self.get_composer(false, Some(false), None)?.cloned(); let composer = match composer { -- cgit v1.3.1