diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-06 10:37:12 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-06 10:37:12 +0900 |
| commit | d9dca94603766712b5989ea8169c9e286d27a60c (patch) | |
| tree | b8c75845bf2d93771c91c7d7058a0ed041f94edc /crates/shirabe-class-map-generator | |
| parent | 70e463708b461efd61a611061cfee0539d28645a (diff) | |
| download | php-shirabe-d9dca94603766712b5989ea8169c9e286d27a60c.tar.gz php-shirabe-d9dca94603766712b5989ea8169c9e286d27a60c.tar.zst php-shirabe-d9dca94603766712b5989ea8169c9e286d27a60c.zip | |
refactor(php-shim): take &str and return String from pathinfo
pathinfo only ever receives a string and only ever returns one for the
single-component options it supports, so the PhpMixed wrapping forced
every call site to pack and unpack the value again.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-class-map-generator')
| -rw-r--r-- | crates/shirabe-class-map-generator/src/class_map_generator.rs | 17 |
1 files changed, 5 insertions, 12 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 9fa37246..0f98ca27 100644 --- a/crates/shirabe-class-map-generator/src/class_map_generator.rs +++ b/crates/shirabe-class-map-generator/src/class_map_generator.rs @@ -8,9 +8,9 @@ use shirabe_external_packages::composer::pcre::{CaptureKey, Preg}; 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_strict, is_dir, is_file, - pathinfo, php_regex, preg_quote, realpath, str_replace, str_starts_with, stream_get_wrappers, - strlen, strpos, strrpos, strtr, substr, + RuntimeException, explode, getcwd, implode, is_dir, is_file, pathinfo, php_regex, preg_quote, + realpath, str_replace, str_starts_with, stream_get_wrappers, strlen, strpos, strrpos, strtr, + substr, }; use std::path::PathBuf; @@ -137,15 +137,8 @@ impl ClassMapGenerator { })); } }; - let ext = pathinfo(PhpMixed::String(file_path.clone()), PATHINFO_EXTENSION); - if !in_array_strict( - ext, - &self - .extensions - .iter() - .map(|e| PhpMixed::String(e.clone())) - .collect::<Vec<_>>(), - ) { + let ext = pathinfo(&file_path, PATHINFO_EXTENSION); + if !self.extensions.contains(&ext) { continue; } |
