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/util/sync_helper.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/util/sync_helper.rs')
| -rw-r--r-- | crates/shirabe/src/util/sync_helper.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/shirabe/src/util/sync_helper.rs b/crates/shirabe/src/util/sync_helper.rs index 6220f5c..8988795 100644 --- a/crates/shirabe/src/util/sync_helper.rs +++ b/crates/shirabe/src/util/sync_helper.rs @@ -1,6 +1,6 @@ //! ref: composer/src/Composer/Util/SyncHelper.php -use crate::downloader::DownloadManager; +use crate::downloader::DownloadManagerInterface; use crate::downloader::DownloaderInterface; use crate::package::PackageInterfaceHandle; use crate::util::r#loop::Loop; @@ -9,7 +9,7 @@ use shirabe_php_shim::PhpMixed; pub enum DownloaderOrManager<'a> { Interface(&'a std::rc::Rc<std::cell::RefCell<dyn DownloaderInterface>>), - Manager(&'a std::rc::Rc<std::cell::RefCell<DownloadManager>>), + Manager(&'a std::rc::Rc<std::cell::RefCell<dyn DownloadManagerInterface>>), } impl<'a> DownloaderOrManager<'a> { |
