Skip to content

Commit

Permalink
Throw exception
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed Jan 29, 2024
1 parent e5b758c commit 9717868
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,10 @@ public function hasSupportedCountryPrefix(string $vatNumber): bool
* Validate a VAT number format. This does not check whether the VAT number was really issued.
*
* @param string $vatNumber
* @param bool $skipIfUnsupported
*
* @return boolean
*/
public function validateVatNumberFormat(string $vatNumber, bool $skipIfUnsupported = false): bool
public function validateVatNumberFormat(string $vatNumber): bool
{
if ($vatNumber === '') {
return false;
Expand All @@ -113,7 +112,7 @@ public function validateVatNumberFormat(string $vatNumber, bool $skipIfUnsupport
$number = substr($vatNumber, 2);

if (! isset($this->patterns[$country])) {
return $skipIfUnsupported;
throw new \InvalidArgumentException('The vat country prefix is not supported.');
}

return preg_match('/^' . $this->patterns[$country] . '$/', $number) > 0;
Expand Down

0 comments on commit 9717868

Please sign in to comment.