diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-29 04:34:32 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-29 04:34:32 +0900 |
| commit | e0e0f2c1fe97feeb002bda1f8ed712a0e1522bf3 (patch) | |
| tree | a45587a290070819167f64457bf77aab22cc091d | |
| parent | 2ae0382e5592dfc3293113d726f9a1d9f4aa9923 (diff) | |
| download | php-shirabe-e0e0f2c1fe97feeb002bda1f8ed712a0e1522bf3.tar.gz php-shirabe-e0e0f2c1fe97feeb002bda1f8ed712a0e1522bf3.tar.zst php-shirabe-e0e0f2c1fe97feeb002bda1f8ed712a0e1522bf3.zip | |
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) <noreply@anthropic.com>
| -rw-r--r-- | crates/shirabe/src/command/require_command.rs | 19 |
1 files 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 + })), + )?; } } |
