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/command/search_command.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'crates/shirabe/src/command/search_command.rs') diff --git a/crates/shirabe/src/command/search_command.rs b/crates/shirabe/src/command/search_command.rs index b0eabf80..0b675109 100644 --- a/crates/shirabe/src/command/search_command.rs +++ b/crates/shirabe/src/command/search_command.rs @@ -19,7 +19,7 @@ use shirabe_external_packages::symfony::console::formatter::OutputFormatter; use shirabe_external_packages::symfony::console::input::InputInterface; use shirabe_external_packages::symfony::console::output::OutputInterface; use shirabe_php_shim::{ - InvalidArgumentException, PhpMixed, impl_php_class, implode, in_array, preg_quote, substr, + InvalidArgumentException, PhpMixed, impl_php_class, implode, in_array_loose, preg_quote, substr, }; #[derive(Debug)] @@ -120,13 +120,12 @@ impl Command for SearchCommand { .as_string() .map(|s| s.to_string()) .unwrap_or_else(|| "text".to_string()); - if !in_array( - PhpMixed::String(format.clone()), - &PhpMixed::List(vec![ + if !in_array_loose( + format.clone(), + &[ PhpMixed::String("text".to_string()), PhpMixed::String("json".to_string()), - ]), - false, + ], ) { io.write_error(&format!( "Unsupported format \"{}\". See help for supported formats.", -- cgit v1.3.1