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/command/require_command.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'crates/shirabe/src/command/require_command.rs') diff --git a/crates/shirabe/src/command/require_command.rs b/crates/shirabe/src/command/require_command.rs index 0ec809c..7fa4793 100644 --- a/crates/shirabe/src/command/require_command.rs +++ b/crates/shirabe/src/command/require_command.rs @@ -9,9 +9,8 @@ use shirabe_external_packages::symfony::console::input::InputInterface; use shirabe_external_packages::symfony::console::output::OutputInterface; use shirabe_php_shim::{ PhpMixed, RuntimeException, UnexpectedValueException, array_fill_keys, array_intersect, - array_keys, array_map, array_merge, array_merge_recursive, array_unique, count, empty, - file_exists, file_get_contents, file_put_contents, filesize, implode, is_writable, sprintf, - strtolower, unlink, + array_keys, array_map, array_merge, array_unique, count, empty, file_exists, file_get_contents, + file_put_contents, filesize, implode, is_writable, sprintf, strtolower, unlink, }; use crate::advisory::Auditor; @@ -396,8 +395,6 @@ impl RequireCommand { } else { "it is" }; - // TODO(phase-b): PHP's array_merge_recursive + array_unique on a list of - // string lists; collapsed here to a flat unique Vec. let merged: Vec = dev_packages.iter().flatten().cloned().collect(); let pkg_dev_tags: Vec = array_unique(&merged); let warn_msg = format!( -- cgit v1.3.1