Update validation for Israeli postal codes

According to Wikipedia [1]:

> Until February 2013, Israel postal codes were 5-digit. Officially the
> 5-digit codes remained valid until 31 January 2013, though they
> continue to be widely used.

This commit changes the "PostalCode" rule to allow either 5 or 7 digits.

[1]: https://en.wikipedia.org/wiki/List_of_postal_codes

Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
This commit is contained in:
Bogus 2019-08-29 12:13:31 +02:00 committed by Henrique Moody
parent 3501192293
commit b7b67da31e
No known key found for this signature in database
GPG key ID: 221E9281655813A6
2 changed files with 3 additions and 1 deletions

View file

@ -89,7 +89,7 @@ final class PostalCode extends AbstractEnvelope
'HU' => '/^(\d{4})$/',
'ID' => '/^(\d{5})$/',
'IE' => '/^([AC-FHKNPRTV-Y][0-9]{2}|D6W) ?[0-9AC-FHKNPRTV-Y]{4}$/',
'IL' => '/^(\d{5})$/',
'IL' => '/^(\d{5}|\d{7})$/',
'IM' => '/^((?:(?:[A-PR-UWYZ][A-HK-Y]\d[ABEHMNPRV-Y0-9]|[A-PR-UWYZ]\d[A-HJKPS-UW0-9])\s\d[ABD-HJLNP-UW-Z]{2})|GIR\s?0AA)$/',
'IN' => '/^(\d{6})$/',
'IQ' => '/^(\d{5})$/',

View file

@ -81,6 +81,8 @@ final class PostalCodeTest extends RuleTestCase
[new PostalCode('IE'), 'D14 YD91'],
[new PostalCode('IE'), 'D6W 3333'],
[new PostalCode('EC'), '170515'],
[new PostalCode('IL'), '7019900'],
[new PostalCode('IL'), '94142'],
];
}