Releases: johnnyxlemonade/component_postcode
Releases · johnnyxlemonade/component_postcode
Release 3.0.0: CountryCode enum migration
[3.0.0] - 2025-10-02
Added
CountryCodeenum replacing raw string codes.FormatterRegistryredesigned 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
CountryCodeinstead ofstringcountry codes. - BC BREAK:
FormatterRegistryno longer has static state – must be instantiated and passed intoPostcodeFormatter. PostcodeFormatternow requires aFormatterRegistryinstance in its constructor.
Fixed
- Clearer distinction between
UnknownCountryExceptionandUnsupportedCountryException. - 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.
Release v2.0.0 - PostcodeFormatter, FormatterRegistry improvements, PHPStan Level 10 + Strict Rules integration, tests, and bug fixes
Added
- Input normalization for postal codes (handles hyphens, spaces).
FormatterRegistrysupports 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 throwsUnknownCountryExceptioninstead of returningnull. - Most formatters refactored to use
PostcodeValidationTrait. - Improved exception messages and strict
preg_matchvalidation.
Fixed
- Missing imports for functions (
substr,str_starts_with,preg_match, etc.) in several formatters. - Correct handling of
UnknownCountryExceptionduring lookups.
Tests
- Full PHPUnit test suite for
PostcodeFormatterandFormatterRegistry. - Integration tests for normalization and invalid input handling.
- Integrated PHPStan static analysis with strict rules (Level 10)
Lemonade Postcode v1.0.0 – Initial release
First stable release with PostcodeFormatter, country-specific formatters,
exception-based validation and Composer integration.