aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-07-04 22:43:37 +0900
committernsfisis <nsfisis@gmail.com>2026-07-05 00:32:15 +0900
commitb556dbb66123145983df7a62949061029e38f0a3 (patch)
tree49ddeb5a9863278527a0c9aada2820d691553582
parentae6c32e918e72d3ebaf1302e9ed0c1be6ee36627 (diff)
downloadphp-shirabe-b556dbb66123145983df7a62949061029e38f0a3.tar.gz
php-shirabe-b556dbb66123145983df7a62949061029e38f0a3.tar.zst
php-shirabe-b556dbb66123145983df7a62949061029e38f0a3.zip
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.
-rw-r--r--crates/shirabe/src/autoload/autoload_generator.rs12
1 files changed, 6 insertions, 6 deletions
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<String> = 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<String> = 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(