diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-28 22:43:11 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-28 22:43:43 +0900 |
| commit | eea4efe87e455742ec17881ee93d8095925e8516 (patch) | |
| tree | 6d242f4fdd0bf32f0494a6fbbd62bce9ed6e1dc7 /crates/shirabe/src/command/check_platform_reqs_command.rs | |
| parent | cc5d73c05a0abca2eebcc8a6afa0b1543ee49850 (diff) | |
| download | php-shirabe-eea4efe87e455742ec17881ee93d8095925e8516.tar.gz php-shirabe-eea4efe87e455742ec17881ee93d8095925e8516.tar.zst php-shirabe-eea4efe87e455742ec17881ee93d8095925e8516.zip | |
refactor(repository): introduce Rc<RefCell<_>> handles for repositories
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/command/check_platform_reqs_command.rs')
| -rw-r--r-- | crates/shirabe/src/command/check_platform_reqs_command.rs | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/crates/shirabe/src/command/check_platform_reqs_command.rs b/crates/shirabe/src/command/check_platform_reqs_command.rs index fd5edd9..15e4225 100644 --- a/crates/shirabe/src/command/check_platform_reqs_command.rs +++ b/crates/shirabe/src/command/check_platform_reqs_command.rs @@ -63,7 +63,7 @@ impl CheckPlatformReqsCommand { let mut requires: IndexMap<String, Vec<Link>> = IndexMap::new(); let mut remove_packages: Vec<String> = vec![]; - let installed_repo_base: Box<dyn crate::repository::RepositoryInterface> = if input + let installed_repo_base: crate::repository::RepositoryInterfaceHandle = if input .get_option("lock") .as_bool() .unwrap_or(false) @@ -72,7 +72,7 @@ impl CheckPlatformReqsCommand { "<info>Checking {}platform requirements using the lock file</info>", if no_dev { "non-dev " } else { "" } )); - Box::new( + crate::repository::RepositoryInterfaceHandle::new( composer .get_locker() .borrow_mut() @@ -87,21 +87,21 @@ impl CheckPlatformReqsCommand { "<warning>No vendor dir present, checking {}platform requirements from the lock file</warning>", if no_dev { "non-dev " } else { "" } )); - Box::new( + crate::repository::RepositoryInterfaceHandle::new( composer .get_locker() .borrow_mut() .get_locked_repository(!no_dev)?, - ) as Box<dyn crate::repository::RepositoryInterface> + ) } else { if no_dev { - remove_packages = local_repo.get_dev_package_names().clone(); + remove_packages = local_repo.get_dev_package_names(); } io.write_error(&format!( "<info>Checking {}platform requirements for packages in the vendor dir</info>", if no_dev { "non-dev " } else { "" } )); - local_repo.clone_box() + local_repo.clone() } }; @@ -115,8 +115,10 @@ impl CheckPlatformReqsCommand { } let root_pkg_repo = RootPackageRepository::new(composer.get_package().clone()); - let installed_repo = - InstalledRepository::new(vec![installed_repo_base, Box::new(root_pkg_repo)]); + let installed_repo = InstalledRepository::new(vec![ + installed_repo_base, + crate::repository::RepositoryInterfaceHandle::new(root_pkg_repo), + ]); for package in installed_repo.get_packages() { if remove_packages.contains(&package.get_name().to_string()) { @@ -134,8 +136,11 @@ impl CheckPlatformReqsCommand { requires_sorted.sort_by(|a, b| a.0.cmp(&b.0)); let installed_repo_with_platform = InstalledRepository::new(vec![ - Box::new(installed_repo), - Box::new(PlatformRepository::new(vec![], indexmap::IndexMap::new())?), + crate::repository::RepositoryInterfaceHandle::new(installed_repo), + crate::repository::RepositoryInterfaceHandle::new(PlatformRepository::new( + vec![], + indexmap::IndexMap::new(), + )?), ]); let mut results: Vec<CheckResult> = vec![]; |
