diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-27 08:44:57 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-27 08:44:57 +0900 |
| commit | 901878ee3f2bee6605b02d321cc4c92bc32fd5b0 (patch) | |
| tree | 83d8c8c9a24cb95c0656866d328b87c2d4c5127f /crates/shirabe/src/command/create_project_command.rs | |
| parent | 5c2c72223cb6b4d77a332eeeeff7ee4e82e3f239 (diff) | |
| download | php-shirabe-901878ee3f2bee6605b02d321cc4c92bc32fd5b0.tar.gz php-shirabe-901878ee3f2bee6605b02d321cc4c92bc32fd5b0.tar.zst php-shirabe-901878ee3f2bee6605b02d321cc4c92bc32fd5b0.zip | |
refactor(composer): hold managers behind *Interface traits
Composer/PartialComposer exposed its RepositoryManager, InstallationManager,
EventDispatcher, Locker, DownloadManager, AutoloadGenerator and ArchiveManager
as concrete types, but Composer's public setters (setDownloadManager() etc.)
let plugins swap in subclasses. Introduce a *Interface trait per manager and
store each as Rc<RefCell<dyn ...Interface>> so a replacement is honored.
Only Composer's slots and the sinks fed from its accessors become trait
objects; managers injected concretely at construction keep their concrete
references, matching PHP semantics. Fluent setters on the affected classes now
return () and Locker::update_hash is de-generified to a boxed FnOnce so the
traits stay object-safe.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/command/create_project_command.rs')
| -rw-r--r-- | crates/shirabe/src/command/create_project_command.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/crates/shirabe/src/command/create_project_command.rs b/crates/shirabe/src/command/create_project_command.rs index ab45400..abbf37a 100644 --- a/crates/shirabe/src/command/create_project_command.rs +++ b/crates/shirabe/src/command/create_project_command.rs @@ -865,7 +865,7 @@ impl CreateProjectCommand { RepositoryFactory::default_repos( Some(io.clone()), Some(config.clone()), - Some(&mut rm.borrow_mut()), + Some(&mut *rm.borrow_mut()), )? .into_iter() .map(|(_, v)| v) @@ -998,9 +998,8 @@ impl CreateProjectCommand { } let dm = composer.get_download_manager(); - dm.borrow_mut() - .set_prefer_source(prefer_source) - .set_prefer_dist(prefer_dist); + dm.borrow_mut().set_prefer_source(prefer_source); + dm.borrow_mut().set_prefer_dist(prefer_dist); let project_installer = ProjectInstaller::new(&directory, dm.clone(), fs.clone()); let installation_manager = composer.get_installation_manager().clone(); |
