diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-18 04:47:02 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-18 04:47:18 +0900 |
| commit | ced1f9aa91ee36857fec9664c9ccd86ba2310821 (patch) | |
| tree | 630ea3eb3b0e710403669de9ba6a78a421e182a8 /crates/shirabe-class-map-generator | |
| parent | 6b7c6cb9a3d1cdf93f261238c1edbc70706a33c7 (diff) | |
| download | php-shirabe-ced1f9aa91ee36857fec9664c9ccd86ba2310821.tar.gz php-shirabe-ced1f9aa91ee36857fec9664c9ccd86ba2310821.tar.zst php-shirabe-ced1f9aa91ee36857fec9664c9ccd86ba2310821.zip | |
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.
Diffstat (limited to 'crates/shirabe-class-map-generator')
| -rw-r--r-- | crates/shirabe-class-map-generator/src/php_file_parser.rs | 9 |
1 files changed, 2 insertions, 7 deletions
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<Vec<String>> { 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, |
