Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add --stop-on-failure option to halt analysis on first error #4287

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

Open
idsulik wants to merge 1 commit into phpstan:2.1.x
base: 2.1.x
Choose a base branch
Loading
from idsulik:add-stop-on-failure-option

Conversation

@idsulik
Copy link

@idsulik idsulik commented Sep 5, 2025

Summary

Adds a new --stop-on-failure CLI option that stops PHPStan analysis immediately when the first error is encountered in any file.

Changes

  • New CLI Option: --stop-on-failure flag added to AnalyseCommand
  • Sequential Mode: Forces sequential analysis (disables parallel processing) when enabled for proper file-by-file control
  • Error Handling: Stops on both regular PHPStan errors and internal errors (exceptions)
  • Backward Compatibility: No impact on existing behavior when option is not used

Use Cases

  • Incremental error fixing: Focus on fixing one error at a time
  • CI/CD pipelines: Fail fast on first error to save build time
  • Large codebases: Quick feedback without processing all files
  • Development workflows: Immediate feedback on first issue

Testing

  • ✅ Manual testing with multiple error files
  • ✅ Unit tests covering various scenarios
  • ✅ Backward compatibility verified
  • ✅ Help text updated and verified

Example Usage

# Stop on first failure
phpstan analyse src/ --stop-on-failure
# Combined with other options
phpstan analyse src/ --stop-on-failure --level 8 --no-progress

Copy link
Member

@ondrejmirtes ondrejmirtes left a comment

Choose a reason for hiding this comment

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

Feels and probably is vibe-coded. And it's missing the main point - --stop-on-failure has to stop only a non-ignored error.

Copy link
Author

idsulik commented Sep 5, 2025

Feels and probably is vibe-coded.

Is it bad or good?

it's missing the main point - --stop-on-failure has to stop only a non-ignored error.

thank you, I'll check and fix it

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

Reviewers

@ondrejmirtes ondrejmirtes ondrejmirtes requested changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /