⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Implement Attribute Rule for PHP 8+ attributes validation#30

Merged
floriankraemer merged 2 commits intomasterfrom
attribute-rule
Jan 27, 2026
Merged

Implement Attribute Rule for PHP 8+ attributes validation#30
floriankraemer merged 2 commits intomasterfrom
attribute-rule

Conversation

@floriankraemer
Copy link
Contributor

@floriankraemer floriankraemer commented Jan 27, 2026

Implement Attribute Rule for PHP 8+ attributes validation

  • Introduced a new AttributeRule class to validate allowed, forbidden, and required attributes on classes, methods, and properties using regex patterns.
  • Added comprehensive tests to ensure correct functionality of the attribute validation logic.
  • Updated README.md to include documentation for the new Attribute Rule and its configuration examples.
  • Created multiple example classes to demonstrate the behavior of the rule under various scenarios.

This enhancement aims to improve code quality by enforcing attribute usage standards across the codebase.

Florian Krämer added 2 commits January 27, 2026 13:31
Apply clean code principles to improve readability and maintainability:
- Simplify processNode() using spread operator and extracted helpers
- Replace array-returning methods with nullable error returns
- Add centralized buildError() method to reduce duplication
- Replace magic string validation with early returns
- Use array_map for method name extraction
- Remove redundant helper methods
- Introduced a new `AttributeRule` class to validate allowed, forbidden, and required attributes on classes, methods, and properties using regex patterns.
- Added comprehensive tests to ensure correct functionality of the attribute validation logic.
- Updated `README.md` to include documentation for the new Attribute Rule and its configuration examples.
- Created multiple example classes to demonstrate the behavior of the rule under various scenarios.

This enhancement aims to improve code quality by enforcing attribute usage standards across the codebase.
@floriankraemer floriankraemer changed the title Attribute Rule Implement Attribute Rule for PHP 8+ attributes validation Jan 27, 2026
@floriankraemer floriankraemer merged commit c65fd95 into master Jan 27, 2026
8 checks passed
@floriankraemer floriankraemer deleted the attribute-rule branch January 27, 2026 12:35
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.

1 participant