aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart-autoload/src/autoload.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-23 01:23:40 +0900
committernsfisis <nsfisis@gmail.com>2026-02-23 01:23:40 +0900
commitc7a5859e1770dbc7cbc7cb1785c34b880162dfac (patch)
tree58081330c415776c9020771f12227889abcffa12 /crates/mozart-autoload/src/autoload.rs
parent7372dc668476cde4bcb789e586cb9a65af1afca0 (diff)
downloadphp-mozart-c7a5859e1770dbc7cbc7cb1785c34b880162dfac.tar.gz
php-mozart-c7a5859e1770dbc7cbc7cb1785c34b880162dfac.tar.zst
php-mozart-c7a5859e1770dbc7cbc7cb1785c34b880162dfac.zip
fix(global): add ~/.composer fallback, XDG auto-detection, and no-arg handling
Rewrite composer_home() with Composer-compatible resolution: detect XDG environment (any XDG_* var or /etc/xdg), prefer existing directories, and fall back to ~/.composer for legacy systems. Consolidate duplicate composer_home_dir() from global.rs into shared config_helpers. Accept no subcommand gracefully with a helpful error instead of a parse error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart-autoload/src/autoload.rs')
-rw-r--r--crates/mozart-autoload/src/autoload.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/crates/mozart-autoload/src/autoload.rs b/crates/mozart-autoload/src/autoload.rs
index 8d59db5..97fb9b0 100644
--- a/crates/mozart-autoload/src/autoload.rs
+++ b/crates/mozart-autoload/src/autoload.rs
@@ -857,9 +857,10 @@ pub fn generate(config: &AutoloadConfig) -> anyhow::Result<GenerateResult> {
);
for (class, path_expr) in scanned {
if let Some(existing) = data.classmap.get(&class)
- && existing != &path_expr {
- ambiguous_found = true;
- }
+ && existing != &path_expr
+ {
+ ambiguous_found = true;
+ }
// Also generate the static expression
// We store the dynamic expression in data.classmap; static_data.classmap
// will be populated similarly. For now we insert into both.
@@ -884,9 +885,10 @@ pub fn generate(config: &AutoloadConfig) -> anyhow::Result<GenerateResult> {
psr_violations = violations;
for (class, path_expr) in opt_dyn {
if let Some(existing) = data.classmap.get(&class)
- && existing != &path_expr {
- ambiguous_found = true;
- }
+ && existing != &path_expr
+ {
+ ambiguous_found = true;
+ }
data.classmap.entry(class).or_insert(path_expr);
}
for (class, path_expr) in opt_static {