From 38621c67917fd015f884ea04517791cdc5058c6d Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 11 Aug 2026 23:28:40 +0900 Subject: chore(php-shim): drop the substring predicate ports str_contains(), str_starts_with() and str_ends_with() were thin wrappers over the str methods of the same semantics. Call sites now use contains()/starts_with()/ends_with() directly. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/src/command/diagnose_command.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'crates/shirabe/src/command') diff --git a/crates/shirabe/src/command/diagnose_command.rs b/crates/shirabe/src/command/diagnose_command.rs index ca71c0e5..dc5d7399 100644 --- a/crates/shirabe/src/command/diagnose_command.rs +++ b/crates/shirabe/src/command/diagnose_command.rs @@ -38,8 +38,8 @@ use shirabe_php_shim::Catch as _; use shirabe_php_shim::{ AnyThrowable, CmpOp, InvalidArgumentException, PHP_EOL, PhpClass as _, PhpMixed, disk_free_space, file_exists, filter_var_boolean, hash, impl_php_class, implode, is_array, - is_string, php_regex, rtrim, str_contains, str_replace, str_starts_with, strpos, strstr, - strstr3, strtolower, trim, version_compare, + is_string, php_regex, rtrim, str_replace, strpos, strstr, strstr3, strtolower, trim, + version_compare, }; use shirabe_symfony_console::command::Command; use shirabe_symfony_console::input::InputInterface; @@ -234,8 +234,7 @@ impl DiagnoseCommand { let mut result_list: Vec = vec![]; let mut tls_warning: Option = None; - if str_starts_with(url, "https://") - && config.borrow().get("disable-tls").as_bool() == Some(true) + if url.starts_with("https://") && config.borrow().get("disable-tls").as_bool() == Some(true) { tls_warning = Some("Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.".to_string()); } @@ -875,11 +874,11 @@ impl DiagnoseCommand { .unwrap_or_default(); let configure = configure.as_str(); - if str_contains(configure, "--enable-sigchild") { + if configure.contains("--enable-sigchild") { warnings.insert("sigchild".to_string(), PhpMixed::Bool(true)); } - if str_contains(configure, "--with-curlwrappers") { + if configure.contains("--with-curlwrappers") { warnings.insert("curlwrappers".to_string(), PhpMixed::Bool(true)); } } @@ -1228,7 +1227,10 @@ impl Command for DiagnoseCommand { .unwrap(); let mut php_version = php_pkg.get_pretty_version(); if let Some(cp) = php_pkg.as_complete() - && str_contains(&cp.get_description().unwrap_or_default(), "overridden") + && cp + .get_description() + .unwrap_or_default() + .contains("overridden") { php_version = format!( "{} - {}", @@ -1361,10 +1363,10 @@ impl Command for DiagnoseCommand { // We surface the same internal call by directly invoking the equivalent method. // TODO(plugin): support reflection-based access if plugin code requires it. let url = composer_repo.get_packages_json_url(); - if !str_starts_with(&url, "http") { + if !url.starts_with("http") { continue; } - if str_starts_with(&url, "https://repo.packagist.org") { + if url.starts_with("https://repo.packagist.org") { continue; } io.write_no_newline(&format!( -- cgit v1.3.1-4-g156e