aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/command/check_platform_reqs_command.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-06 02:13:59 +0900
committernsfisis <nsfisis@gmail.com>2026-06-06 02:13:59 +0900
commitcd25c3e193f05a5e89bca2a1c706c85fdc9c9155 (patch)
tree86971cac4e5011af0077416e6ca674c4251496ee /crates/shirabe/src/command/check_platform_reqs_command.rs
parentb299a0c9b66523b9630b4cf6d3dca1509c3692b5 (diff)
downloadphp-shirabe-cd25c3e193f05a5e89bca2a1c706c85fdc9c9155.tar.gz
php-shirabe-cd25c3e193f05a5e89bca2a1c706c85fdc9c9155.tar.zst
php-shirabe-cd25c3e193f05a5e89bca2a1c706c85fdc9c9155.zip
refactor(repository): make read methods fallible and take &mut self
Change RepositoryInterface and WritableRepositoryInterface read methods (find_package, find_packages, get_packages, load_packages, search, get_providers, get_canonical_packages) to take &mut self and return anyhow::Result, so lazy-loading repositories such as ComposerRepository can perform fallible I/O and mutate internal state on access. Update all implementors and call sites to propagate the Result and pass mutable references. Co-Authored-By: Claude Opus 4.8 (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.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/shirabe/src/command/check_platform_reqs_command.rs b/crates/shirabe/src/command/check_platform_reqs_command.rs
index edacf0b..14b3be2 100644
--- a/crates/shirabe/src/command/check_platform_reqs_command.rs
+++ b/crates/shirabe/src/command/check_platform_reqs_command.rs
@@ -81,7 +81,7 @@ impl CheckPlatformReqsCommand {
let repository_manager = composer.get_repository_manager().clone();
let repository_manager = repository_manager.borrow();
let local_repo = repository_manager.get_local_repository();
- if local_repo.get_packages().is_empty() {
+ if local_repo.get_packages()?.is_empty() {
io.write_error(&format!(
"<warning>No vendor dir present, checking {}platform requirements from the lock file</warning>",
if no_dev { "non-dev " } else { "" }
@@ -115,12 +115,12 @@ impl CheckPlatformReqsCommand {
let root_pkg_repo = RootPackageRepository::new(
crate::package::RootPackageInterfaceHandle::dup(composer.get_package()),
);
- let installed_repo = InstalledRepository::new(vec![
+ let mut installed_repo = InstalledRepository::new(vec![
installed_repo_base,
crate::repository::RepositoryInterfaceHandle::new(root_pkg_repo),
]);
- for package in installed_repo.get_packages() {
+ for package in installed_repo.get_packages()? {
if remove_packages.contains(&package.get_name().to_string()) {
continue;
}
@@ -149,7 +149,7 @@ impl CheckPlatformReqsCommand {
'requirements: for (require, links) in &requires_sorted {
if PlatformRepository::is_platform_package(require) {
let candidates = installed_repo_with_platform
- .find_packages_with_replacers_and_providers(require, None);
+ .find_packages_with_replacers_and_providers(require, None)?;
if !candidates.is_empty() {
let mut req_results: Vec<CheckResult> = vec![];
'candidates: for candidate in &candidates {