Skip to content

Release 3.0.0: CountryCode enum migration

Latest

Choose a tag to compare

@johnnyxlemonade johnnyxlemonade released this 01 Oct 20:05

[3.0.0] - 2025-10-02

Added

  • CountryCode enum replacing raw string codes.
  • FormatterRegistry redesigned to be immutable (register() returns a new instance).
  • FormatterRegistry::all() method for inspecting registered formatters.
  • Full PHPUnit test coverage for registry immutability and enum integration.

Changed

  • BC BREAK: All methods now expect CountryCode instead of string country codes.
  • BC BREAK: FormatterRegistry no longer has static state – must be instantiated and passed into PostcodeFormatter.
  • PostcodeFormatter now requires a FormatterRegistry instance in its constructor.

Fixed

  • Clearer distinction between UnknownCountryException and UnsupportedCountryException.
  • Improved error messages with translation keys (error.invalid_postcode, error.unknown_country, error.unsupported_country).

Tests

  • ✅ Full PHPUnit coverage (100%).
  • ✅ PHPStan Level 10 + Strict Rules passing with 0 errors.