aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-class-map-generator/src/class_map_generator.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-06 06:36:42 +0900
committernsfisis <nsfisis@gmail.com>2026-08-06 06:36:42 +0900
commit70e463708b461efd61a611061cfee0539d28645a (patch)
tree267066f1a6ac872d256de99a4ffafb1adf31f311 /crates/shirabe-class-map-generator/src/class_map_generator.rs
parent791ef1cd465597ff43dab4216c4b00e9e4160da8 (diff)
downloadphp-shirabe-70e463708b461efd61a611061cfee0539d28645a.tar.gz
php-shirabe-70e463708b461efd61a611061cfee0539d28645a.tar.zst
php-shirabe-70e463708b461efd61a611061cfee0539d28645a.zip
refactor: replace literal-list in_array_strict with matches!
Call sites whose haystack was an inline array of literals (or a local built solely to feed one) had to wrap both sides in PhpMixed just to compare, allocating a String per element on every call. matches! does the same test against the underlying &str/i64/Option directly, so the PhpMixed round trip and its .to_string()/.clone()/.iter().map() conversions are gone. Sites whose haystack is a runtime value or a named constant array are left on in_array_strict: inlining a named constant would duplicate its contents at the call site. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-class-map-generator/src/class_map_generator.rs')
-rw-r--r--crates/shirabe-class-map-generator/src/class_map_generator.rs9
1 files changed, 1 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 57a21508..9fa37246 100644
--- a/crates/shirabe-class-map-generator/src/class_map_generator.rs
+++ b/crates/shirabe-class-map-generator/src/class_map_generator.rs
@@ -73,14 +73,7 @@ impl ClassMapGenerator {
namespace: Option<String>,
excluded_dirs: Vec<String>,
) -> anyhow::Result<()> {
- if !in_array_strict(
- autoload_type.to_string(),
- &[
- PhpMixed::String("psr-0".to_string()),
- PhpMixed::String("psr-4".to_string()),
- PhpMixed::String("classmap".to_string()),
- ],
- ) {
+ if !matches!(autoload_type, "psr-0" | "psr-4" | "classmap") {
return Err(anyhow::anyhow!(InvalidArgumentException {
message: "$autoloadType must be one of: \"psr-0\", \"psr-4\" or \"classmap\""
.to_string(),