diff --git a/src/Validator.php b/src/Validator.php index 2e811dc..3dd5aa0 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -43,6 +43,7 @@ class Validator '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 64d78f8..320f856 100644 --- a/tests/ValidatorTest.php +++ b/tests/ValidatorTest.php @@ -54,6 +54,11 @@ public function testValidateVatNumberFormat(): void 'SE123456789012', 'SI12345678', 'SK1234567890', + 'XI123456789', + 'XI123 4567 89', + 'XI123456789111', + 'XI123 4567 89 111', + 'XIHZ6AB', ]; $validator = new Validator(); @@ -96,6 +101,7 @@ public function testValidateVatNumberFormat(): void 'SE12345678901', 'SI1234567', 'SK123456789', + 'XI12345678', // valid number but with prefix 'invalid_prefix_GB999999973', @@ -104,6 +110,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', @@ -111,6 +118,7 @@ public function testValidateVatNumberFormat(): void 'BE0123456789_invalid_suffix', 'MT12345678_invalid_suffix', 'LT123456789_invalid_suffix', + 'XI123456789_invalid_suffix', ]; foreach ($invalid as $format) {