aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/console/application.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-16 12:51:24 +0900
committernsfisis <nsfisis@gmail.com>2026-08-16 12:51:24 +0900
commitfce44d4587ba11b080fe0266c483d0be684ffd0d (patch)
tree753e87ac7ed2e57d635a60c10a4ce01b7e0f0f8e /crates/shirabe/src/console/application.rs
parentb12c2b15f0487d54d359a581e99ced68713914d0 (diff)
downloadphp-shirabe-fce44d4587ba11b080fe0266c483d0be684ffd0d.tar.gz
php-shirabe-fce44d4587ba11b080fe0266c483d0be684ffd0d.tar.zst
php-shirabe-fce44d4587ba11b080fe0266c483d0be684ffd0d.zip
refactor(php-shim): split json_decode into assoc and obj variants
The assoc flag was always a literal at every call site, so the boolean carried no information the function name could not. json_decode_assoc and json_decode_obj make the resulting PhpMixed shape visible at the call site. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/console/application.rs')
-rw-r--r--crates/shirabe/src/console/application.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/shirabe/src/console/application.rs b/crates/shirabe/src/console/application.rs
index fb89f8b0..04819b81 100644
--- a/crates/shirabe/src/console/application.rs
+++ b/crates/shirabe/src/console/application.rs
@@ -60,7 +60,7 @@ use shirabe_php_shim::{
LogicException as ShimLogicException, PhpMixed, RuntimeException, bin2hex, chdir, defined,
dirname, disk_free_space, extension_loaded, file_exists, file_get_contents, file_put_contents,
function_exists, getcwd, getmypid, glob, ini_set, is_array, is_dir, is_file, is_string,
- json_decode, memory_get_peak_usage, memory_get_usage, microtime, php_regex, php_uname,
+ json_decode_assoc, memory_get_peak_usage, memory_get_usage, microtime, php_regex, php_uname,
posix_getuid, random_bytes, realpath, restore_error_handler, round, str_replace, strpos,
strtoupper, sys_get_temp_dir, time, unlink,
};
@@ -2341,7 +2341,7 @@ impl ApplicationHandle {
let file = Factory::get_composer_file().unwrap_or_default();
if may_need_script_command && is_file(&file) && Filesystem::is_readable(&file) {
let composer_json: PhpMixed =
- json_decode(&file_get_contents(&file).unwrap_or_default(), true)
+ json_decode_assoc(&file_get_contents(&file).unwrap_or_default())
.unwrap_or(PhpMixed::Null);
if let Some(arr) = composer_json.as_array()
&& let Some(scripts) = arr.get("scripts").and_then(|v| v.as_array())