Skip to content

Conversation

@Orrison
Copy link
Owner

@Orrison 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>
@Orrison Orrison requested a review from Copilot November 1, 2025 19:10
@Orrison Orrison added the New Rule A new PHPStan Rule label Nov 1, 2025
Copy link
Contributor

Copilot AI left a 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>
@Orrison Orrison requested a review from Copilot November 1, 2025 19:21
Copy link
Contributor

Copilot AI left a 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>
@Orrison Orrison requested a review from Copilot November 1, 2025 19:38
Copy link
Contributor

Copilot AI left a 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>
@Orrison Orrison requested a review from Copilot November 1, 2025 19:45
Copy link
Contributor

Copilot AI left a 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>
@Orrison Orrison requested a review from Copilot November 1, 2025 19:48
Copy link
Contributor

Copilot AI left a 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>
Repository owner deleted a comment from Copilot AI Nov 1, 2025
@Orrison Orrison requested a review from Copilot November 1, 2025 20:07
Copy link
Contributor

Copilot AI left a 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>
@Orrison Orrison merged commit 1803b43 into main Nov 1, 2025
5 checks passed
@Orrison Orrison deleted the BooleanArgumentFlag branch November 1, 2025 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Rule A new PHPStan Rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants