From d9dca94603766712b5989ea8169c9e286d27a60c Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 6 Aug 2026 10:37:12 +0900 Subject: 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) --- .../src/class_map_generator.rs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'crates/shirabe-class-map-generator/src') 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::>(), - ) { + let ext = pathinfo(&file_path, PATHINFO_EXTENSION); + if !self.extensions.contains(&ext) { continue; } -- cgit v1.3.1