Skip to content

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.

@idsulik
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants