Closed mglaman closed 10 months ago
State-level prefix-based postal code patterns were deprecated in 1.x, that's why 2.x removed them. See #147 for background. There's also https://www.drupal.org/project/address/issues/2828128 for the Drupal-side of the discussion.
We still retain state-level patterns that override the entire country pattern, instead of further refining it.
You would need to copy-over the old patterns from 1.x and implement your own logic on top of the library's, if you want to retain the same behavior.
Ah, bummer. Yeah, I'll just have to write a custom constraint then
I was helping an old Laravel project and went to update this library. But our tests started to fail:
It appears to be due to https://github.com/commerceguys/addressing/commit/516da8b8b949d69380cca20949332a1ba4b7dfcb which removed
postal_code_pattern
for US subdivisions.We relied on
"postal_code_pattern": "5[34]"
.\CommerceGuys\Addressing\Validator\Constraints\AddressFormatConstraintValidator::validatePostalCode still supports subdivision postal code patterns.