Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect other PSR violations where namespace is missing or not a subnamespace of configured one #8

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

PrinsFrank
Copy link

@PrinsFrank PrinsFrank commented Apr 30, 2024

Fixes composer/composer#11957

To get warnings about missing namespaces or non-common namespaces in Composer when running with --strict-psr, classes shouldn't be skipped before checking their namespace if they don't have a common root.

@PrinsFrank PrinsFrank force-pushed the add-missing-strict-psr-violations branch 2 times, most recently from d1fb66b to 3ee697c Compare April 30, 2024 11:45
@PrinsFrank PrinsFrank force-pushed the add-missing-strict-psr-violations branch from 3ee697c to 9956a25 Compare April 30, 2024 11:46
…ilently passing if valid classes are found, will only show up when requesting PSR violations)
@@ -216,10 +216,6 @@ private function filterByNamespace(array $classes, string $filePath, string $bas
$realSubPath = substr($realSubPath, 0, $dotPosition === false ? PHP_INT_MAX : $dotPosition);

foreach ($classes as $class) {
// silently skip if ns doesn't have common root
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check was explicitely here, but looking at the code it can be handled as a rejectedClass instead as it gets silently ignored anyway if at least one valid class is found. Then it can be used when checking with --strict-psr. What do you think?

@PrinsFrank PrinsFrank marked this pull request as ready for review April 30, 2024 11:59
Copy link

@szepeviktor szepeviktor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No silent ignoring 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants