aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/command/require_command.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-07 18:26:55 +0900
committernsfisis <nsfisis@gmail.com>2026-06-07 18:28:13 +0900
commitb8a50e25aafb51a6d73f9695362854cc5ed58117 (patch)
treeabe43c770cbf652a5e723c6f9a37e9406c5dd52e /crates/shirabe/src/command/require_command.rs
parentda6f05c12d08ac96b4286664cd8205d3fee042d8 (diff)
downloadphp-shirabe-b8a50e25aafb51a6d73f9695362854cc5ed58117.tar.gz
php-shirabe-b8a50e25aafb51a6d73f9695362854cc5ed58117.tar.zst
php-shirabe-b8a50e25aafb51a6d73f9695362854cc5ed58117.zip
feat(phase-c): resolve &mut-access phase-b TODOs via handle setters
PHP mutator methods that the Phase B port could not call because only &self / &dyn / Rc access was available. Resolved by the interior-mutation APIs that already exist: handle &self setters (set_dist/source_reference, set_requires/dev/references/stability_flags), Rc<RefCell<dyn InputInterface>> .borrow_mut(), and get_installation_manager().borrow_mut() (build_package_map passes an empty/canonical package list per upstream). composer.get_package() returns &RootPackageInterfaceHandle, so the "&dyn" Phase B note was wrong. factory's set_config_source/set_auth_config_source were already live code; their stale TODOs are removed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/command/require_command.rs')
-rw-r--r--crates/shirabe/src/command/require_command.rs24
1 files changed, 10 insertions, 14 deletions
diff --git a/crates/shirabe/src/command/require_command.rs b/crates/shirabe/src/command/require_command.rs
index b3ad6cf..d3d17a7 100644
--- a/crates/shirabe/src/command/require_command.rs
+++ b/crates/shirabe/src/command/require_command.rs
@@ -413,9 +413,7 @@ impl RequireCommand {
.to_string(),
true,
) {
- // TODO(phase-b): set_option needs &mut dyn InputInterface, but execute holds
- // input as &dyn. Commented out until input is threaded as &mut.
- // input.set_option("dev", PhpMixed::Bool(true));
+ input.borrow_mut().set_option("dev", PhpMixed::Bool(true))?;
}
}
@@ -511,9 +509,7 @@ impl RequireCommand {
return Ok(0);
}
- // TODO(phase-b): set_option needs &mut dyn InputInterface, but execute holds
- // input as &dyn. Commented out until input is threaded as &mut.
- // input.set_option("dev", PhpMixed::Bool(true));
+ input.borrow_mut().set_option("dev", PhpMixed::Bool(true))?;
let swap = require_key;
require_key = remove_key;
remove_key = swap;
@@ -782,21 +778,21 @@ impl RequireCommand {
section.shift_remove(package);
}
}
- // TODO(phase-b): root_package mutation requires &mut RootPackageInterface but
- // Composer::get_package() exposes only & dyn; needs accessor returning &mut for
- // the dry-run case to update requires/dev-requires/stability flags/references.
- let _ = &links;
- let _ = root_package.get_references().clone();
- let _ = RootPackageLoader::extract_references(
+ root_package.set_requires(links["require"].clone());
+ root_package.set_dev_requires(links["require-dev"].clone());
+
+ // extract stability flags & references as they weren't present when loading the unmodified composer.json
+ let references = RootPackageLoader::extract_references(
requirements,
root_package.get_references().clone(),
);
- let _ = RootPackageLoader::extract_stability_flags(
+ root_package.set_references(references);
+ let stability_flags = RootPackageLoader::extract_stability_flags(
requirements,
&root_package.get_minimum_stability(),
root_package.get_stability_flags().clone(),
);
- // unset($stabilityFlags, $references);
+ root_package.set_stability_flags(stability_flags);
}
let update_dev_mode = !input