Merged
Conversation
…s name The rule was using only the short class name for pattern matching and error messages, inconsistent with all other class-based rules in the codebase. Now uses $scope->getNamespace() to resolve the full class name, matching the approach used by ForbiddenAccessorsRule and other rules. Co-authored-by: Cursor <[email protected]>
…rrors Introduce @phpstan-type aliases (PropertyRule, PatternConfig) for the property rule array shapes, replacing untyped array parameters throughout. Remove redundant null checks already handled by isset(). Resolves all 11 pre-existing PHPStan errors in PropertyMustMatchRule. Co-authored-by: Cursor <[email protected]>
The default case in the visibility match expression silently accepted invalid values like typos, making the visibility check a no-op. Now throws an InvalidArgumentException with a helpful message listing the valid options. Co-authored-by: Cursor <[email protected]>
The getTypeAsString method now handles union types (string|int) and intersection types (Countable&Iterator) instead of returning null and reporting the actual type as "none". Aligns with how other rules in the codebase handle complex types. Co-authored-by: Cursor <[email protected]>
…orsRule Both rules silently swallowed preg_match errors from invalid regex patterns, treating them the same as "no match". Now throws InvalidArgumentException with the pattern and error message so configuration mistakes are surfaced immediately. Co-authored-by: Cursor <[email protected]>
buildGetterError and buildSetterError had @return docblocks but lacked actual PHP return type declarations. Co-authored-by: Cursor <[email protected]>
The docblock listed only 'public' and 'protected' as valid visibility values, but 'private' is also supported and works correctly. Co-authored-by: Cursor <[email protected]>
PropertyMustMatchRule now validates that propertyPatterns is non-empty. ForbiddenAccessorsRule now validates that classPatterns is non-empty and that visibility values are valid (public, protected, private). Invalid configurations now throw InvalidArgumentException immediately instead of silently producing no results. Co-authored-by: Cursor <[email protected]>
- Bump phpunit/phpunit from ^12.0 to ^12.5.8 - Update myclabs/deep-copy from 1.13.0 to 1.13.4 - Upgrade nikic/php-parser from v5.4.0 to v5.7.0 - Upgrade phpstan/phpstan from 2.1.11 to 2.1.38 - Upgrade phpunit/php-code-coverage from 12.1.0 to 12.5.3 - Update various references and URLs in composer.lock These changes ensure compatibility with the latest versions of the dependencies.
… resolution - Added ClassNameResolver trait to multiple rules (AttributeRule, CatchExceptionOfTypeNotAllowedRule, ClassMustBeFinalRule, ClassMustBeReadonlyRule, ClassMustHaveSpecificationDocblockRule, ForbiddenAccessorsRule, MethodMustReturnTypeRule, MethodSignatureMustMatchRule, PropertyMustMatchRule). - Updated processNode methods to resolve full class names using the new trait, improving consistency and reducing code duplication. - Removed redundant code related to manual full class name construction and unnecessary private methods. This refactor enhances maintainability and aligns the rules with a unified approach for class name resolution.
…tchRule for improved code clarity.
…ules - Introduced tests in CircularModuleDependencyRuleTest to skip non-modular namespaces and same module imports. - Added tests in ClassMustBeFinalRuleTest to ensure final classes and anonymous classes are correctly handled. - Updated ForbiddenAccessorsRuleTest to skip anonymous classes. - Enhanced ForbiddenStaticMethodsRuleTest to skip dynamic method and class names. These additions improve the robustness of the architecture rules by ensuring that specific cases are properly ignored during analysis.
…raints - Updated README.md to mark the Dependency Constraints Rule as deprecated and introduced the new Forbidden Dependencies Rule, which enforces dependency constraints between namespaces. - Added detailed documentation for the Forbidden Dependencies Rule and the Forbidden Static Methods Rule, outlining their configurations and use cases. - Updated Rules.md to include descriptions and examples for the new rules, ensuring clarity on their functionalities. These changes improve the clarity of the rules and provide guidance for users on enforcing architectural boundaries in their code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.