Skip to content

Skip the Psr4 sniff instead of aborting when composer.json is missing - #89

Merged
dereuromark merged 1 commit into
masterfrom
psr4-missing-composer-json
Oct 25, 2026
Merged

dereuromark merged 1 commit into
masterfrom
psr4-missing-composer-json

Conversation

@dereuromark

Copy link
Copy Markdown
Contributor

Closes #86

Running phpcs from a directory without a composer.json no longer aborts the whole run. Psr4Sniff catches the factory's InvalidArgumentException (missing or unreadable file) and disables only itself, which is what the existing INITIALIZATION_FAILURE state was meant to do. Invalid JSON in an existing composer.json still throws, so a broken config stays visible.

The sniff already marked itself as failed before calling the factory and
returned early on that state, but the factory's InvalidArgumentException
was never caught, so running phpcs from a directory without composer.json
killed the whole run with a fatal error.

Only the missing/unreadable case is caught. A composer.json with invalid
JSON still throws, so a broken config stays visible.
@dereuromark dereuromark added the bug Something isn't working label Oct 25, 2026
Copilot AI balanced review requested due to automatic review settings October 25, 2026 13:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@dereuromark
dereuromark merged commit 9c11897 into master Oct 25, 2026
2 of 5 checks passed
@dereuromark
dereuromark deleted the psr4-missing-composer-json branch October 25, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Psr4 sniff fatals the whole run when composer.json is missing

2 participants