1.1.0
Release Notes
π New Features
β¨ New Rule: Catch Exception of Type Not Allowed Rule
- Class:
Phauthentic\PHPStanRules\Architecture\CatchExceptionOfTypeNotAllowedRule
- Purpose: Prevents catching overly broad exception types like
Exception
,Error
, orThrowable
- Configuration: Accepts an array of forbidden exception types
- Example: Configure to prevent catching
Exception
,Error
, orThrowable
for better error handling practices
β¨ Enhanced Method Signature Must Match Rule
- New Feature: Added visibility scope validation
- New Feature: Improved parameter validation with optional type checking
- Enhancement: Better error messages and validation logic
- Configuration: Now supports
visibilityScope
parameter (public, protected, private)
π§ Documentation Improvements
π Fixed Class Name References
Updated all configuration examples to use correct class names:
ReadonlyClassRule
βClassMustBeReadonlyRule
FinalClassRule
βClassMustBeFinalRule
NamespaceClassPatternRule
βClassnameMustMatchPatternRule
π Added Missing Rule Documentation
- Methods Returning Bool Must Follow Naming Convention Rule: Complete documentation added with configuration examples
- Catch Exception of Type Not Allowed Rule: Full documentation with examples
π Enhanced Documentation Structure
- Added anchor links to all rule sections for better navigation
- Improved README.md with clearer examples
- Updated namespace references from
Phauthentic\PhpstanRules
toPhauthentic\PHPStanRules
β New Test Cases
- CatchExceptionOfTypeNotAllowedRuleTest: Comprehensive tests for the new exception catching rule
- Enhanced MethodSignatureMustMatchRuleTest: Additional test cases for visibility scope and parameter validation
π New Test Data Files
data/CatchExceptionOfTypeNotAllowed/CatchAllowedException.php
: Examples of allowed exception catchingdata/CatchExceptionOfTypeNotAllowed/CatchForbiddenException.php
: Examples of forbidden exception catching- Enhanced
data/MethodSignatureMustMatch/TestClass.php
: Additional test methods for validation
ποΈ Code Quality Improvements
π§ Refactoring
- MethodSignatureMustMatchRule: Improved code structure with better separation of concerns
- MethodMustReturnTypeRule: Enhanced documentation and code comments
- phpstan.neon: Removed hardcoded rule configurations (now serves as a clean template)
π Bug Fixes
- Fixed namespace casing inconsistencies (
PhpstanRules
βPHPStanRules
) - Improved parameter validation logic in MethodSignatureMustMatchRule
- Enhanced error message formatting and consistency