Skip to content

1.1.0

Compare
Choose a tag to compare
@floriankraemer floriankraemer released this 26 Jul 15:19
· 4 commits to master since this release
ba9dd3c

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, or Throwable
  • Configuration: Accepts an array of forbidden exception types
  • Example: Configure to prevent catching Exception, Error, or Throwable 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 to Phauthentic\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 catching
  • data/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