diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-06 11:12:39 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-06 11:13:26 +0900 |
| commit | 9f6f83c479985e882dbd086a8495bcd772c80b54 (patch) | |
| tree | f5287fb3af16e9a04b8abc0010fb66e25dbe1937 /crates/shirabe/src/command/check_platform_reqs_command.rs | |
| parent | 8c5dba294fae26c8a46a308a46676e0afff217d6 (diff) | |
| download | php-shirabe-9f6f83c479985e882dbd086a8495bcd772c80b54.tar.gz php-shirabe-9f6f83c479985e882dbd086a8495bcd772c80b54.tar.zst php-shirabe-9f6f83c479985e882dbd086a8495bcd772c80b54.zip | |
fix(array-merge): route mixed-key merges through faithful array_merge
* Config::merge called array_merge_recursive where PHP uses plain
array_merge (string-key overwrite); switch those six sites to
array_merge.
* provides/replaces merges that may carry an AliasPackage's
self.version numeric keys ("0","1",...) were collapsing under naive
chain/insert/or_insert; route them through a new array_merge_map().
Co-Authored-By: Claude Opus 4.8 <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 | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/crates/shirabe/src/command/check_platform_reqs_command.rs b/crates/shirabe/src/command/check_platform_reqs_command.rs index 14b3be2..5225f7e 100644 --- a/crates/shirabe/src/command/check_platform_reqs_command.rs +++ b/crates/shirabe/src/command/check_platform_reqs_command.rs @@ -4,7 +4,7 @@ use anyhow::Result; use indexmap::IndexMap; use shirabe_external_packages::symfony::component::console::input::InputInterface; use shirabe_external_packages::symfony::component::console::output::OutputInterface; -use shirabe_php_shim::{PhpMixed, strip_tags}; +use shirabe_php_shim::{PhpMixed, array_merge_map, strip_tags}; use shirabe_semver::constraint::AnyConstraint; use shirabe_semver::constraint::SimpleConstraint; @@ -153,28 +153,27 @@ impl CheckPlatformReqsCommand { if !candidates.is_empty() { let mut req_results: Vec<CheckResult> = vec![]; 'candidates: for candidate in &candidates { - let candidate_constraint: Option<AnyConstraint> = - if candidate.get_name() == *require { - let c = SimpleConstraint::new( - "=".to_string(), - candidate.get_version().to_string(), - Some(candidate.get_pretty_version().to_string()), - ); - Some(c.into()) - } else { - let mut found: Option<AnyConstraint> = None; - for (_, link) in candidate - .get_provides() - .iter() - .chain(candidate.get_replaces().iter()) - { - if link.get_target() == require { - found = Some(link.get_constraint().clone()); - break; - } + let candidate_constraint: Option<AnyConstraint> = if candidate.get_name() + == *require + { + let c = SimpleConstraint::new( + "=".to_string(), + candidate.get_version().to_string(), + Some(candidate.get_pretty_version().to_string()), + ); + Some(c.into()) + } else { + let mut found: Option<AnyConstraint> = None; + let provides_and_replaces = + array_merge_map(candidate.get_provides(), candidate.get_replaces()); + for (_, link) in &provides_and_replaces { + if link.get_target() == require { + found = Some(link.get_constraint().clone()); + break; } - found - }; + } + found + }; let candidate_constraint = match candidate_constraint { Some(c) => c, |
