diff --git a/src/Validator.php b/src/Validator.php index e70afd3..2499849 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -41,6 +41,8 @@ class Validator 'SE' => '\d{12}', 'SI' => '\d{8}', 'SK' => '\d{10}', + 'SM' => '\d{5}', + 'XI' => '(\d{3} ?\d{4} ?\d{2}( ?\d{3})?|[A-Z\d]{5})', ]; /** diff --git a/tests/ValidatorTest.php b/tests/ValidatorTest.php index ce528c2..bd0c23a 100644 --- a/tests/ValidatorTest.php +++ b/tests/ValidatorTest.php @@ -53,6 +53,11 @@ public function testValidateVatNumberFormat(): void 'SE123456789012', 'SI12345678', 'SK1234567890', + 'XI123456789', + 'XI123 4567 89', + 'XI123456789111', + 'XI123 4567 89 111', + 'XIHZ6AB', ]; $validator = new Validator(); @@ -94,6 +99,7 @@ public function testValidateVatNumberFormat(): void 'SE12345678901', 'SI1234567', 'SK123456789', + 'XI12345678', // valid number but with prefix 'invalid_prefix_IE1234567X', @@ -101,6 +107,7 @@ public function testValidateVatNumberFormat(): void 'invalid_prefix_BE0123456789', 'invalid_prefix_MT12345678', 'invalid_prefix_LT123456789', + 'invalid_prefix_XI123456789', // valid number but with suffix 'IE1234567X_invalid_suffix', @@ -108,6 +115,7 @@ public function testValidateVatNumberFormat(): void 'BE0123456789_invalid_suffix', 'MT12345678_invalid_suffix', 'LT123456789_invalid_suffix', + 'XI123456789_invalid_suffix', ]; foreach ($invalid as $format) {