From c7f53c5d7d581ebf76803650c63ec615b1558dc8 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 28 May 2026 03:31:41 +0900 Subject: refactor(composer): represent composer via trait-based handles Replace the PartialComposer/Composer structs and the single Rc> enum with PartialComposer and Composer traits (Composer: PartialComposer), InnerPartialComposer / InnerFullComposer data structs, and the handle types FullComposerHandle (impl Composer) and AnyComposerHandle (polymorphic enum, impl PartialComposer), plus their weak variants. Factory builds the full and partial graphs via separate Rc::new_cyclic branches that share a build_composer_base helper. Call sites now use trait methods that encapsulate borrowing instead of borrow_partial() / composer_full*(). Co-Authored-By: Claude Opus 4.7 --- crates/shirabe/src/command/exec_command.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'crates/shirabe/src/command/exec_command.rs') diff --git a/crates/shirabe/src/command/exec_command.rs b/crates/shirabe/src/command/exec_command.rs index 3f70cf8..824f09e 100644 --- a/crates/shirabe/src/command/exec_command.rs +++ b/crates/shirabe/src/command/exec_command.rs @@ -6,6 +6,7 @@ use shirabe_external_packages::symfony::component::console::output::OutputInterf use shirabe_php_shim::{PhpMixed, RuntimeException, basename, chdir, getcwd, glob}; use crate::command::{BaseCommand, BaseCommandData, HasBaseCommandData}; +use crate::composer::{Composer, PartialComposer}; use crate::console::input::InputArgument; use crate::console::input::InputOption; use crate::io::IOInterface; @@ -87,7 +88,7 @@ impl ExecCommand { { let bins = self.get_binaries(true)?; if bins.is_empty() { - let bin_dir = crate::command::composer_full_mut(&composer) + let bin_dir = crate::command::composer_full(&composer) .get_config() .borrow_mut() .get("bin-dir") @@ -155,7 +156,7 @@ impl ExecCommand { fn get_binaries(&mut self, for_display: bool) -> Result> { let composer = self.require_composer(None, None)?; - let composer_ref = crate::command::composer_full_mut(&composer); + let composer_ref = crate::command::composer_full(&composer); let bin_dir = composer_ref .get_config() .borrow_mut() -- cgit v1.3.1