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/autoload/autoload_generator.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/autoload/autoload_generator.rs')
| -rw-r--r-- | crates/shirabe/src/autoload/autoload_generator.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/crates/shirabe/src/autoload/autoload_generator.rs b/crates/shirabe/src/autoload/autoload_generator.rs index c36125f..6505510 100644 --- a/crates/shirabe/src/autoload/autoload_generator.rs +++ b/crates/shirabe/src/autoload/autoload_generator.rs @@ -8,11 +8,11 @@ use shirabe_external_packages::composer::pcre::{CaptureKey, Preg}; use shirabe_external_packages::symfony::component::console::formatter::OutputFormatter; use shirabe_php_shim::{ E_USER_DEPRECATED, InvalidArgumentException, PhpMixed, RuntimeException, array_filter, - array_keys, array_map, array_merge, array_merge_recursive, array_reverse, array_shift, - array_slice, array_slice_strs, array_unique, bin2hex, explode, file_exists, file_get_contents, - hash, implode, in_array, is_array, krsort, ksort, ltrim, preg_quote, random_bytes, realpath, - sprintf, str_contains, str_replace, str_starts_with, strlen, strpos, strtr, substr, - substr_count, trigger_error, trim, unlink, var_export, + array_keys, array_map, array_merge, array_merge_map, array_merge_recursive, array_reverse, + array_shift, array_slice, array_slice_strs, array_unique, bin2hex, explode, file_exists, + file_get_contents, hash, implode, in_array, is_array, krsort, ksort, ltrim, preg_quote, + random_bytes, realpath, sprintf, str_contains, str_replace, str_starts_with, strlen, strpos, + strtr, substr, substr_count, trigger_error, trim, unlink, var_export, }; use shirabe_semver::constraint::AnyConstraint; use shirabe_semver::constraint::Bound; @@ -1104,10 +1104,7 @@ impl AutoloadGenerator { for item in package_map { let package = &item.0; - let mut links = package.get_replaces(); - for (k, v) in package.get_provides() { - links.insert(k, v); - } + let links = array_merge_map(package.get_replaces(), package.get_provides()); for (_k, link) in &links { let mut matches: IndexMap<CaptureKey, String> = IndexMap::new(); if Preg::match3("{^ext-(.+)$}iD", link.get_target(), Some(&mut matches)) |
