-
Notifications
You must be signed in to change notification settings - Fork 0
Add BooleanArgumentFlag rule and related configurations #91
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
Conversation
Orrison
commented
Nov 1, 2025
- Implement BooleanArgumentFlag rule to detect boolean parameters indicating multiple responsibilities.
- Introduce configuration options for ignored classes and ignore patterns.
- Update README with new rule documentation.
- Add tests for various scenarios including ignored classes and patterns.
- Implement BooleanArgumentFlag rule to detect boolean parameters indicating multiple responsibilities. - Introduce configuration options for ignored classes and ignore patterns. - Update README with new rule documentation. - Add tests for various scenarios including ignored classes and patterns. Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new PHPStan rule BooleanArgumentFlag that detects boolean parameters in functions, methods, and closures, which may indicate a violation of the Single Responsibility Principle. The rule includes configurable options to ignore specific classes or methods matching a pattern.
Key changes:
- New rule implementation with support for class methods, functions, and closures
- Configuration options for ignored classes and method name patterns
- Comprehensive test coverage including default, ignored classes, ignore pattern, and combined configuration scenarios
- Complete documentation with usage examples
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Rules/BooleanArgumentFlag/BooleanArgumentFlagRule.php | Main rule implementation that detects boolean parameters in function-like constructs |
| src/Rules/BooleanArgumentFlag/Config.php | Configuration class for ignored classes and ignore patterns |
| config/extension.neon | Schema definition and service registration for the new rule |
| docs/BooleanArgumentFlag.md | Complete documentation with configuration options and examples |
| README.md | Added rule entry to the rules table |
| tests/Rules/BooleanArgumentFlag/DefaultOptionsTest.php | Tests for default behavior |
| tests/Rules/BooleanArgumentFlag/IgnoredInClassesTest.php | Tests for ignored classes configuration |
| tests/Rules/BooleanArgumentFlag/IgnorePatternTest.php | Tests for pattern-based ignoring |
| tests/Rules/BooleanArgumentFlag/AllOptionsTrueTest.php | Tests for combined configuration options |
| tests/Rules/BooleanArgumentFlag/Fixture/*.php | Test fixture files with various boolean parameter scenarios |
| tests/Rules/BooleanArgumentFlag/config/*.neon | Test configuration files for different scenarios |
…curacy Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com>
…and accuracy in error message line numbers Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
… include invalid regex configuration Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com>
…entFlag documentation Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
…ment_flag schema Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
…or preg_last_error Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com>