Skip to content

Commit 9ebae28

Browse files
committed
NL postcodes cannot start with 0
Fixes #18.
1 parent 590857e commit 9ebae28

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Formatter/NLFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ final class NLFormatter implements CountryPostcodeFormatter
1919
{
2020
public function format(string $postcode) : ?string
2121
{
22-
if (preg_match('/^([0-9]{4})([A-Z]{2})$/', $postcode, $matches) !== 1) {
22+
if (preg_match('/^([1-9][0-9]{3})([A-Z]{2})$/', $postcode, $matches) !== 1) {
2323
return null;
2424
}
2525

tests/Formatter/NLFormatterTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public function providerFormat() : array
2323
return [
2424
['', null],
2525

26+
['0123AB', null],
2627
['1234AB', '1234 AB'],
2728
['1234SS', null],
2829
['1234SD', null],

0 commit comments

Comments
 (0)