From ced1f9aa91ee36857fec9664c9ccd86ba2310821 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 18 Aug 2026 04:47:02 +0900 Subject: refactor(function-exists): drop checks for always-present capabilities function_exists() returns false in PHP when a function is blocked by disable_functions, when its extension is not compiled in, or when the PHP version predates it. None of those apply to a native binary. --- crates/shirabe-class-map-generator/src/php_file_parser.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'crates/shirabe-class-map-generator/src/php_file_parser.rs') diff --git a/crates/shirabe-class-map-generator/src/php_file_parser.rs b/crates/shirabe-class-map-generator/src/php_file_parser.rs index b7fb595c..0cb9180f 100644 --- a/crates/shirabe-class-map-generator/src/php_file_parser.rs +++ b/crates/shirabe-class-map-generator/src/php_file_parser.rs @@ -2,9 +2,8 @@ use crate::php_file_cleaner::PhpFileCleaner; use shirabe_php_shim::{ - PHP_EOL, RuntimeException, file_exists, file_get_contents, function_exists, is_file, - is_readable, ltrim, php_strip_whitespace, preg_match_all, str_replace_array, strrpos, substr, - trim, + PHP_EOL, RuntimeException, file_exists, file_get_contents, is_file, is_readable, ltrim, + php_strip_whitespace, preg_match_all, str_replace_array, strrpos, substr, trim, }; use std::sync::OnceLock; @@ -14,10 +13,6 @@ impl PhpFileParser { pub fn find_classes(path: &str) -> anyhow::Result> { let extra_types = Self::get_extra_types(); - if !function_exists("php_strip_whitespace") { - return Err(RuntimeException::new("Classmap generation relies on the php_strip_whitespace function, but it has been disabled by the disable_functions directive.".to_string()).into()); - } - // Use @ here instead of Silencer to actively suppress 'unhelpful' output let contents = match php_strip_whitespace(path) { Ok(contents) if !contents.is_empty() => contents, -- cgit v1.3.1-4-g156e