From b556dbb66123145983df7a62949061029e38f0a3 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 4 Jul 2026 22:43:37 +0900 Subject: fix(autoload-generator): read exclude-from-classmap/classmap as PhpMixed::Array parse_autoloads_type stores exclude-from-classmap and classmap as PhpMixed::Array (string-keyed), but dump()/create_loader() read them with as_list(), which only matches PhpMixed::List and thus always returned None. exclude-from-classmap patterns declared by vendor packages (e.g. symfony/service-contracts' /Test/) were consequently never excluded from the generated classmap. Switched both call sites to as_array()/.values(), matching the already-correct usage earlier in the same function. --- crates/shirabe/src/autoload/autoload_generator.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'crates/shirabe') diff --git a/crates/shirabe/src/autoload/autoload_generator.rs b/crates/shirabe/src/autoload/autoload_generator.rs index e7acb0a..be56ff8 100644 --- a/crates/shirabe/src/autoload/autoload_generator.rs +++ b/crates/shirabe/src/autoload/autoload_generator.rs @@ -341,11 +341,11 @@ impl AutoloadGenerator { let mut excluded: Vec = vec![]; if let Some(ex) = autoloads .get("exclude-from-classmap") - .and_then(|v| v.as_list()) + .and_then(|v| v.as_array()) && !ex.is_empty() { excluded = ex - .iter() + .values() .filter_map(|v| v.as_string().map(|s| s.to_string())) .collect(); } @@ -885,15 +885,15 @@ impl AutoloadGenerator { } } - if let Some(classmap) = autoloads.get("classmap").and_then(|v| v.as_list()) { + if let Some(classmap) = autoloads.get("classmap").and_then(|v| v.as_array()) { let mut excluded: Vec = vec![]; if let Some(ex) = autoloads .get("exclude-from-classmap") - .and_then(|v| v.as_list()) + .and_then(|v| v.as_array()) && !ex.is_empty() { excluded = ex - .iter() + .values() .filter_map(|v| v.as_string().map(|s| s.to_string())) .collect(); } @@ -905,7 +905,7 @@ impl AutoloadGenerator { ]); class_map_generator.avoid_duplicate_scans(None); - for dir in classmap { + for dir in classmap.values() { let dir_str = dir.as_string().unwrap_or(""); let res = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { class_map_generator.scan_paths( -- cgit v1.3.1