diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-06 06:25:10 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-06 06:25:30 +0900 |
| commit | 791ef1cd465597ff43dab4216c4b00e9e4160da8 (patch) | |
| tree | ec6c3bc45f81576146325350faa6dcea638987b4 /crates/shirabe/src/json/json_manipulator.rs | |
| parent | a86bbd67954f7bbc38bb09138edb335d82666526 (diff) | |
| download | php-shirabe-791ef1cd465597ff43dab4216c4b00e9e4160da8.tar.gz php-shirabe-791ef1cd465597ff43dab4216c4b00e9e4160da8.tar.zst php-shirabe-791ef1cd465597ff43dab4216c4b00e9e4160da8.zip | |
refactor(php-shim): split in_array into strict and loose variants
Diffstat (limited to 'crates/shirabe/src/json/json_manipulator.rs')
| -rw-r--r-- | crates/shirabe/src/json/json_manipulator.rs | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/crates/shirabe/src/json/json_manipulator.rs b/crates/shirabe/src/json/json_manipulator.rs index 48500de2..eec823b6 100644 --- a/crates/shirabe/src/json/json_manipulator.rs +++ b/crates/shirabe/src/json/json_manipulator.rs @@ -7,9 +7,9 @@ use indexmap::IndexMap; use shirabe_external_packages::composer::pcre::{CaptureKey, Preg}; use shirabe_php_shim::{ InvalidArgumentException, LogicException, PhpMixed, addcslashes, array_key_exists, array_keys, - array_reverse, empty, explode, implode, in_array, is_array, is_int, is_numeric, json_decode, - php_regex, php_truthy, preg_quote, rtrim, str_contains, str_repeat, str_replace, strlen, - strnatcmp, strpos, substr, trim, uksort, + array_reverse, empty, explode, implode, in_array_loose, is_array, is_int, is_numeric, + json_decode, php_regex, php_truthy, preg_quote, rtrim, str_contains, str_repeat, str_replace, + strlen, strnatcmp, strpos, substr, trim, uksort, }; #[derive(Debug)] @@ -660,14 +660,13 @@ impl JsonManipulator { let mut name_owned = name.to_string(); let mut sub_name: Option<String> = None; - if in_array( - PhpMixed::String(main_node.to_string()), - &PhpMixed::List(vec![ + if in_array_loose( + main_node.to_string(), + &[ PhpMixed::String("config".to_string()), PhpMixed::String("extra".to_string()), PhpMixed::String("scripts".to_string()), - ]), - false, + ], ) && strpos(name, ".").is_some() { let parts = explode(".", name); @@ -866,14 +865,13 @@ impl JsonManipulator { let mut name_owned = name.to_string(); let mut sub_name: Option<String> = None; - if in_array( - PhpMixed::String(main_node.to_string()), - &PhpMixed::List(vec![ + if in_array_loose( + main_node.to_string(), + &[ PhpMixed::String("config".to_string()), PhpMixed::String("extra".to_string()), PhpMixed::String("scripts".to_string()), - ]), - false, + ], ) && strpos(name, ".").is_some() { let parts = explode(".", name); |
