From e5b789616ec4c1cbd152c5ccbefe2d27ced4a18f Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 8 Jun 2026 11:26:03 +0900 Subject: feat(phase-c): resolve PHP-array-semantics phase-b TODOs Resolve category K (array_* functions, integer keys, nested mutation, sorting). Add shim variants (uasort over Vec, uasort_map for IndexMap) and delegate to existing typed variants (strtr_array, array_merge_map, array_search_in_vec). Implement PHP array semantics directly where the shape is fixed: canonical integer-key coercion (is_php_integer_key, shared by config and FilesystemRepository::dumpToPhpCode), strict array_search via trait-object pointer identity, array_reverse/array_chunk preserve_keys loops, and the installed.php nested version mutations via auto-vivify helpers. Resolving the array_merge in UpdateCommand unmasked latent borrow bugs in execute's tail (Rc input/output moved by value); fixed with .clone() to match PHP reference sharing, and resolved the tightly-coupled Intervals constraint check. composerRequire reclassified to phase-c: it depends on the $GLOBALS superglobal and PHP's require include mechanism, neither portable. Co-Authored-By: Claude Opus 4.8 --- crates/shirabe/src/dependency_resolver/pool_builder.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'crates/shirabe/src/dependency_resolver/pool_builder.rs') diff --git a/crates/shirabe/src/dependency_resolver/pool_builder.rs b/crates/shirabe/src/dependency_resolver/pool_builder.rs index 20b96e0..8647cef 100644 --- a/crates/shirabe/src/dependency_resolver/pool_builder.rs +++ b/crates/shirabe/src/dependency_resolver/pool_builder.rs @@ -7,9 +7,8 @@ use shirabe_external_packages::composer::pcre::Preg; use shirabe_external_packages::composer::semver::CompilingMatcher; use shirabe_external_packages::composer::semver::Intervals; use shirabe_php_shim::{ - LogicException, PhpMixed, array_chunk, array_flip, array_flip_strings, array_map, array_merge, - array_search, array_search_mixed, count, in_array, microtime, number_format, round, sprintf, - strpos, + LogicException, PhpMixed, array_flip, array_flip_strings, array_map, array_merge, array_search, + array_search_mixed, count, in_array, microtime, number_format, round, sprintf, strpos, }; use shirabe_semver::constraint::AnyConstraint; use shirabe_semver::constraint::MatchAllConstraint; @@ -474,7 +473,6 @@ impl PoolBuilder { } // Load packages in chunks of 50 to prevent memory usage build-up due to caches of all sorts - // TODO(phase-b): array_chunk shim signature expects &[T]; build IndexMap chunks manually. let mut package_batches: Vec> = { let mut chunks: Vec> = Vec::new(); let mut current: IndexMap = IndexMap::new(); -- cgit v1.3.1