Skip to content

Release v2.0.0 - PostcodeFormatter, FormatterRegistry improvements, PHPStan Level 10 + Strict Rules integration, tests, and bug fixes

Choose a tag to compare

@johnnyxlemonade johnnyxlemonade released this 01 Oct 07:32
· 2 commits to master since this release

Added

  • Input normalization for postal codes (handles hyphens, spaces).
  • FormatterRegistry supports overwriting existing formatters (withAdded()).
  • Comprehensive integration tests for postcode formatting, including edge cases.
  • PHPStan Level 10 + Strict Rules configuration for static analysis.

Changed

  • BC BREAK: FormatterRegistry::get() now throws UnknownCountryException instead of returning null.
  • Most formatters refactored to use PostcodeValidationTrait.
  • Improved exception messages and strict preg_match validation.

Fixed

  • Missing imports for functions (substr, str_starts_with, preg_match, etc.) in several formatters.
  • Correct handling of UnknownCountryException during lookups.

Tests

  • Full PHPUnit test suite for PostcodeFormatter and FormatterRegistry.
  • Integration tests for normalization and invalid input handling.
  • Integrated PHPStan static analysis with strict rules (Level 10)