diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-08 11:26:03 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-08 11:26:03 +0900 |
| commit | e5b789616ec4c1cbd152c5ccbefe2d27ced4a18f (patch) | |
| tree | 7a713cf1bcec30a1c69d5c434d8df6a7525dcbc2 /crates/shirabe/src/util/process_executor.rs | |
| parent | 7439cdb08afe0882186a34f70c1e8878fcb7dca5 (diff) | |
| download | php-shirabe-e5b789616ec4c1cbd152c5ccbefe2d27ced4a18f.tar.gz php-shirabe-e5b789616ec4c1cbd152c5ccbefe2d27ced4a18f.tar.zst php-shirabe-e5b789616ec4c1cbd152c5ccbefe2d27ced4a18f.zip | |
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<T>, 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 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util/process_executor.rs')
| -rw-r--r-- | crates/shirabe/src/util/process_executor.rs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/crates/shirabe/src/util/process_executor.rs b/crates/shirabe/src/util/process_executor.rs index 837fb32..40a212b 100644 --- a/crates/shirabe/src/util/process_executor.rs +++ b/crates/shirabe/src/util/process_executor.rs @@ -14,8 +14,8 @@ use shirabe_external_packages::symfony::process::exception::RuntimeException as use shirabe_php_shim::{ LogicException, PhpMixed, RuntimeException, array_intersect, array_map, call_user_func, defined, escapeshellarg, explode, implode, in_array, is_array, is_callable, is_dir, is_numeric, - is_string, max, min, rtrim, sprintf, str_replace, strcspn, strlen, strpbrk, strtolower, strtr, - substr_replace, trim, usleep, + is_string, max, min, rtrim, sprintf, str_replace, strcspn, strlen, strpbrk, strtolower, + strtr_array, substr_replace, trim, usleep, }; use crate::io::IOInterface; @@ -754,12 +754,7 @@ impl ProcessExecutor { translation.insert("\u{2044}".to_string(), "/".to_string()); translation.insert("\u{2215}".to_string(), "/".to_string()); translation.insert("\u{00b4}".to_string(), "/".to_string()); - // PHP: strtr($argument, $translation) — variadic translation map - // TODO(phase-b): implement multi-target strtr; for now we apply replacements iteratively - for (from, to) in &translation { - argument = str_replace(from, to, &argument); - } - let _ = strtr; + argument = strtr_array(&argument, &translation); // In addition to whitespace, commas need quoting to preserve paths let mut quote = strpbrk(&argument, " \t,").is_some(); |
