From e0e0f2c1fe97feeb002bda1f8ed712a0e1522bf3 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 29 Jun 2026 04:34:32 +0900 Subject: feat(require): update locker hash with stability flags rewriter Resolve the remaining todo! in update_requirements_after_resolution by passing the stability-flags rewriter closure to Locker::update_hash, porting the static closure from RequireCommand.php. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/src/command/require_command.rs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/crates/shirabe/src/command/require_command.rs b/crates/shirabe/src/command/require_command.rs index 6a3ff5e..952f8d8 100644 --- a/crates/shirabe/src/command/require_command.rs +++ b/crates/shirabe/src/command/require_command.rs @@ -1156,11 +1156,20 @@ impl RequireCommand { &composer.get_package().get_minimum_stability(), IndexMap::new(), ); - let stability_flags_clone = stability_flags.clone(); - // TODO(phase-c): Locker::update_hash needs the stability-flags rewriter callback; - // depends on modeling the closure passed to updateHash. - let _ = &stability_flags_clone; - todo!("update locker hash with stability flags rewriter"); + composer.get_locker().borrow_mut().update_hash( + &json.borrow(), + Some(Box::new(move |mut lock_data| { + let section = lock_data + .entry("stability-flags".to_string()) + .or_insert_with(|| PhpMixed::Array(IndexMap::new())); + if let Some(section) = section.as_array_mut() { + for (package_name, flag) in &stability_flags { + section.insert(package_name.clone(), PhpMixed::Int(*flag)); + } + } + lock_data + })), + )?; } } -- cgit v1.3.1