mirror of
https://github.com/Respect/Validation.git
synced 2024-06-09 01:02:16 +02:00
Add support for Caymanian postal code validation
According to Wikipedia[1]: > A postal code typically consists of an island code, a hyphen > separator, and a section code. > > There are only three island codes: KY1 for Grand Cayman, KY2 for > Cayman Brac, and KY3 for Little Cayman. [1]: https://en.wikipedia.org/wiki/Postal_codes_in_the_Cayman_Islands Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
This commit is contained in:
parent
b7b67da31e
commit
a44f97f4b3
|
@ -105,6 +105,7 @@ final class PostalCode extends AbstractEnvelope
|
|||
'KP' => '/^(\d{6})$/',
|
||||
'KR' => '/^(\d{5})$/',
|
||||
'KW' => '/^(\d{5})$/',
|
||||
'KY' => '/^KY[1-3]-\d{4}$/',
|
||||
'KZ' => '/^(\d{6})$/',
|
||||
'LA' => '/^(\d{5})$/',
|
||||
'LB' => '/^(\d{4}(\d{4})?)$/',
|
||||
|
|
|
@ -83,6 +83,10 @@ final class PostalCodeTest extends RuleTestCase
|
|||
[new PostalCode('EC'), '170515'],
|
||||
[new PostalCode('IL'), '7019900'],
|
||||
[new PostalCode('IL'), '94142'],
|
||||
[new PostalCode('KY'), 'KY1-1102'],
|
||||
[new PostalCode('KY'), 'KY2-2001'],
|
||||
[new PostalCode('KY'), 'KY2-2001'],
|
||||
[new PostalCode('KY'), 'KY3-2500'],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -104,6 +108,7 @@ final class PostalCodeTest extends RuleTestCase
|
|||
[new PostalCode('KR'), '548940'],
|
||||
[new PostalCode('KR'), '548-940'],
|
||||
[new PostalCode('EC'), 'A1234B'],
|
||||
[new PostalCode('KY'), 'KY4-2500'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue