Skip to content

Conversation

@Orrison
Copy link
Owner

@Orrison Orrison commented Dec 31, 2025

Closes #44

@Orrison Orrison requested a review from Copilot December 31, 2025 03:54
@Orrison Orrison self-assigned this Dec 31, 2025
@Orrison Orrison added the New Rule A new PHPStan Rule label Dec 31, 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 implements the TooManyMethods rule, a PHPStan extension that detects classes, interfaces, traits, and enums with an excessive number of methods, helping identify code that violates the Single Responsibility Principle.

Key changes:

  • Adds a new TooManyMethods rule with configurable method count threshold and pattern-based method filtering
  • Provides comprehensive test coverage across multiple configuration scenarios
  • Includes complete documentation and README integration

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Rules/TooManyMethods/TooManyMethodsRule.php Main rule implementation analyzing ClassLike nodes and counting methods with optional pattern-based filtering
src/Rules/TooManyMethods/Config.php Configuration class with max_methods threshold and ignore_pattern regex support
config/extension.neon Schema definition, default parameters, and service registration for the rule
tests/Rules/TooManyMethods/TooManyMethodsRuleTest.php Default configuration tests validating error reporting for classes, traits, interfaces, and enums
tests/Rules/TooManyMethods/NoIgnorePatternTest.php Tests verifying all methods are counted when ignore_pattern is empty
tests/Rules/TooManyMethods/CustomMaxMethodsTest.php Tests validating custom max_methods threshold behavior
tests/Rules/TooManyMethods/Fixture/ExampleClass.php Test fixtures with various method counts and naming patterns
tests/Rules/TooManyMethods/config/*.neon Test configuration files for different rule scenarios
docs/TooManyMethods.md Complete rule documentation with configuration options and examples
README.md Added TooManyMethods to the Design rules table
CLAUDE.md AI coding instructions for the project (appears to be project documentation)
.gitignore Added .claude/settings.local.json to ignore list

Validates the ignore_pattern configuration by checking both preg_match
return value and preg_last_error() to catch all potential regex errors,
throwing InvalidArgumentException with a descriptive message when invalid.
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 38 out of 39 changed files in this pull request and generated no new comments.

@Orrison Orrison merged commit 3a0748d into main Dec 31, 2025
11 checks passed
@Orrison Orrison deleted the claude-experiment branch December 31, 2025 04:33
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.

TooManyMethods

2 participants