From 791ef1cd465597ff43dab4216c4b00e9e4160da8 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 6 Aug 2026 06:25:10 +0900 Subject: refactor(php-shim): split in_array into strict and loose variants --- crates/shirabe/src/json/json_manipulator.rs | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'crates/shirabe/src/json/json_manipulator.rs') 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 = 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 = 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); -- cgit v1.3.1