Skip to content

Commit 1e9d5ad

Browse files
Merge branch 'master' of github.com:ibericode/vat
2 parents 82bd431 + 2744069 commit 1e9d5ad

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

src/Countries.php

+35-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,41 @@ public function hasCountryCode(string $code): bool
285285
*/
286286
public function getCountryCodesInEU(): array
287287
{
288-
return ['AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GR', 'HU', 'HR', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK'];
288+
return [
289+
'AT', // Austria
290+
'AX', // Aland islands => Finland
291+
'BE', // Belgium
292+
'BG', // Bulgaria
293+
'CY', // Cyprus
294+
'CZ', // Czechia
295+
'DE', // Germany
296+
'DK', // Denmark
297+
'EE', // Estonia
298+
'ES', // Spain
299+
'FI', // Finland
300+
'FR', // France
301+
'GF', // French guiana => France
302+
'GP', // Guadeloupe => France
303+
'GR', // Greece
304+
'HU', // Hungary
305+
'HR', // Croatia
306+
'IE', // Ireland
307+
'IT', // Italy
308+
'LT', // Lithuania
309+
'LU', // Luxembourg
310+
'LV', // Latvia
311+
'MT', // Malta
312+
'MQ', // Martinique => France
313+
'NL', // Netherlands
314+
'PL', // Poland
315+
'PT', // Portugal
316+
'RE', // Reunion => France
317+
'RO', // Romania
318+
'SE', // Sweden
319+
'SI', // Slovenia
320+
'SK', // Slovakia
321+
'YT', // Mayotte => France
322+
];
289323
}
290324

291325
/**

src/Validator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Validator
2929
'GB' => '(\d{9}|\d{12}|(GD|HA)\d{3})',
3030
'HR' => '\d{11}',
3131
'HU' => '\d{8}',
32-
'IE' => '([A-Z\d]{8}|[A-Z\d]{9})',
32+
'IE' => '((\d{7}[A-Z]{1,2})|(\d[A-Z]\d{5}[A-Z]))',
3333
'IT' => '\d{11}',
3434
'LT' => '(\d{9}|\d{12})',
3535
'LU' => '\d{8}',

tests/ValidatorTest.php

+5
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public function testValidateVatNumberFormat()
3939
'HU12345678',
4040
'HR12345678901',
4141
'IE1234567X',
42+
'IE1X34567X',
43+
'IE1234567XX',
4244
'IT12345678901',
4345
'LT123456789',
4446
'LU12345678',
@@ -78,6 +80,9 @@ public function testValidateVatNumberFormat()
7880
'HU1234567',
7981
'HR1234567890',
8082
'IE123456X',
83+
'IE1X34567XX',
84+
'IE12345678X',
85+
'IE123456789',
8186
'IT1234567890',
8287
'LT12345678',
8388
'LU1234567',

0 commit comments

Comments
 (0)