Skip to content

Commit

Permalink
Added return false in validator + minor docBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
Evert Harmeling committed Feb 1, 2019
1 parent b53ab21 commit e32de17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/VIESApi/Validator/VATNumberValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ public function __construct(Client $client)
$this->client = $client;
}

/**
* @param string $value
* @return bool
* @throws InvalidVATNumberException
*/
public function validate($value)
{
self::checkFormat($value);
Expand All @@ -34,6 +39,8 @@ public function validate($value)

return true;
} catch (VIESApiExceptionInterface $e) { }

return false;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/VIESApi/Validator/VATNumberValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Tests\VIESApi\Validator;

use PHPUnit\Framework\Assert;
use VIESApi\Client\Client;
use VIESApi\Formatter\VATNumberFormatter;
use VIESApi\Model\Country;
use VIESApi\Validator\VATNumberValidator;

Expand Down Expand Up @@ -54,7 +54,7 @@ public function testValidVATNumbers($values)
}

foreach ($values as $value) {
static::assertTrue($this->getValidator()->validate($value));
Assert::assertTrue($this->getValidator()->validate($value));
}
}

Expand Down

0 comments on commit e32de17

Please sign in to comment.