From 69c372ba0eca61b05260d6d208445d9e69d14e34 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 13 Jun 2026 11:38:20 +0900 Subject: fix(console): flatten Application inheritance to restore overrides Composer\Console\Application embedded Symfony's Application as an `inner` field and delegated to it, so polymorphic calls inside the Symfony base (e.g. doRun -> $this->getLongVersion()) resolved to Symfony's own methods and never reached Composer's overrides. As a result `--version` bypassed Composer's getLongVersion()/doRun() entirely. Flatten the PHP inheritance chain into the single shirabe Application struct: take in the Symfony base methods (parent-calling overrides kept under a `base_` prefix) and drop the `inner` delegation. Replace the Symfony Application struct in shirabe-external-packages with an `Application` trait that the merged struct implements, so commands and descriptors can reference it without a reverse crate dependency. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../src/symfony/console/command/command.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/shirabe-external-packages/src/symfony/console/command/command.rs') diff --git a/crates/shirabe-external-packages/src/symfony/console/command/command.rs b/crates/shirabe-external-packages/src/symfony/console/command/command.rs index 1af9c59..1640689 100644 --- a/crates/shirabe-external-packages/src/symfony/console/command/command.rs +++ b/crates/shirabe-external-packages/src/symfony/console/command/command.rs @@ -20,7 +20,7 @@ use std::rc::Rc; /// (defined below) and this concrete `BaseCommand` struct holding the base-class /// state and behavior. Subclasses embed a `BaseCommand` and implement `Command`. pub struct BaseCommand { - application: Option>>, + application: Option>>, name: Option, process_title: Option, aliases: Vec, @@ -130,7 +130,7 @@ impl BaseCommand { self.ignore_validation_errors = true; } - pub fn set_application(&mut self, application: Option>>) { + pub fn set_application(&mut self, application: Option>>) { self.application = application.clone(); if let Some(application) = application { self.set_helper_set(application.borrow_mut().get_helper_set()); @@ -151,7 +151,7 @@ impl BaseCommand { } /// Gets the application instance for this command. - pub fn get_application(&self) -> Option>> { + pub fn get_application(&self) -> Option>> { self.application.clone() } @@ -709,11 +709,11 @@ pub trait Command: std::fmt::Debug + shirabe_php_shim::AsAny { todo!() } - fn set_application(&mut self, _application: Option>>) { + fn set_application(&mut self, _application: Option>>) { todo!() } - fn get_application(&self) -> Option>> { + fn get_application(&self) -> Option>> { todo!() } -- cgit v1.3.1