Skip to content

Fix PSR-0 optimized classmap includes classes that do not match the configured namespace prefix #33

Merged
Seldaek merged 1 commit intocomposer:mainfrom
skmetaly:fix-psr0-prefix-check
Mar 30, 2026
Merged

Fix PSR-0 optimized classmap includes classes that do not match the configured namespace prefix #33
Seldaek merged 1 commit intocomposer:mainfrom
skmetaly:fix-psr0-prefix-check

Conversation

@skmetaly
Copy link
Copy Markdown
Contributor

Fixes #32

Restores the namespace prefix check for PSR-0 inside filterByNamespace(). This was removed in #8 to enable --strict-psr warnings for non-matching classes, but PSR-0 path computation uses the full class name without stripping the prefix, so the check was the only guard preventing false positive matches.

The fix adds the prefix check back inside the PSR-0 if branch only. Non-matching classes are still added to $rejectedClasses so PSR violation warnings are preserved.

PSR-4 is unaffected because it strips the prefix during path computation, so non-matching classes produce wrong paths and are rejected.

@skmetaly skmetaly changed the title Fix PSR-0 optimized classmap including classes not matching namespace… Fix PSR-0 optimized classmap includes classes that do not match the configured namespace prefix Mar 27, 2026
@Seldaek Seldaek merged commit 6a9c2f0 into composer:main Mar 30, 2026
14 checks passed
@Seldaek
Copy link
Copy Markdown
Member

Seldaek commented Mar 30, 2026

Thanks, looks good :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PSR-0 optimized classmap includes classes that do not match the configured namespace prefix

2 participants