diff options
Diffstat (limited to 'crates/shirabe-class-map-generator')
| -rw-r--r-- | crates/shirabe-class-map-generator/src/class_map_generator.rs | 13 | ||||
| -rw-r--r-- | crates/shirabe-class-map-generator/src/php_file_parser.rs | 2 |
2 files changed, 7 insertions, 8 deletions
diff --git a/crates/shirabe-class-map-generator/src/class_map_generator.rs b/crates/shirabe-class-map-generator/src/class_map_generator.rs index f591811..cb49487 100644 --- a/crates/shirabe-class-map-generator/src/class_map_generator.rs +++ b/crates/shirabe-class-map-generator/src/class_map_generator.rs @@ -9,8 +9,8 @@ use shirabe_external_packages::symfony::finder::Finder; use shirabe_php_shim::{ DIRECTORY_SEPARATOR, InvalidArgumentException, LogicException, PATHINFO_EXTENSION, PHP_INT_MAX, PhpMixed, RuntimeException, explode, getcwd, implode, in_array, is_dir, is_file, is_string, - pathinfo, preg_quote, realpath, sprintf, str_replace, str_starts_with, stream_get_wrappers, - strlen, strpos, strrpos, strtr, substr, + pathinfo, preg_quote, realpath, str_replace, str_starts_with, stream_get_wrappers, strlen, + strpos, strrpos, strtr, substr, }; use std::path::PathBuf; @@ -89,8 +89,7 @@ impl ClassMapGenerator { })); } - let base_path: Option<String>; - if autoload_type != "classmap" { + let base_path: Option<String> = if autoload_type != "classmap" { if !is_string(&path) { return Err(anyhow::anyhow!(InvalidArgumentException { message: @@ -105,10 +104,10 @@ impl ClassMapGenerator { code: 0, })); } - base_path = path.as_string().map(|s| s.to_string()); + path.as_string().map(|s| s.to_string()) } else { - base_path = None; - } + None + }; let files: Vec<PathBuf> = if is_string(&path) { let path_str = path.as_string().unwrap_or(""); 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 7d7c722..8d64dbd 100644 --- a/crates/shirabe-class-map-generator/src/php_file_parser.rs +++ b/crates/shirabe-class-map-generator/src/php_file_parser.rs @@ -6,7 +6,7 @@ use indexmap::IndexMap; use shirabe_external_packages::composer::pcre::{CaptureKey, Preg}; use shirabe_php_shim::{ HHVM_VERSION, PHP_EOL, PHP_VERSION_ID, RuntimeException, error_get_last, file_exists, - file_get_contents, function_exists, is_file, is_readable, ltrim, php_strip_whitespace, sprintf, + file_get_contents, function_exists, is_file, is_readable, ltrim, php_strip_whitespace, str_replace_array, strrpos, substr, trim, version_compare, }; use std::sync::OnceLock; |
