Use getMessage() instead of getMainMessage()

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
This commit is contained in:
Henrique Moody 2018-05-22 13:42:10 +02:00
parent 5d0ecabfdc
commit c26db7287f
No known key found for this signature in database
GPG key ID: 221E9281655813A6
105 changed files with 127 additions and 127 deletions

View file

@ -131,7 +131,7 @@ $usernameValidator->validate('#$%'); //false
- Thrown when the `check()` fails
- All validation exceptions extend this class
- Available methods:
- `getMainMessage()`;
- `getMessage()`;
- `setMode($mode)`;
- `setName($name)`;
- `setParam($name, $value)`;
@ -249,7 +249,7 @@ $exception->setParam('translator', 'gettext');
The example above uses `gettext()` but you can use any other callable value, like
`[$translator, 'trans']` or `you_custom_function()`.
After that, if you call `getMainMessage()` or `getFullMessage()` (for nested),
After that, if you call `getMessage()` or `getFullMessage()` (for nested),
the message will be translated.
Note that `getMessage()` will keep the original message.
@ -359,7 +359,7 @@ use Respect\Validation\Exceptions\ValidationException;
try {
$usernameValidator->check('really messed up screen#name');
} catch(ValidationException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
```

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::bsn()->check('acb');
} catch (BsnException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::bsn()->check(null);
} catch (BsnException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -32,7 +32,7 @@ try {
->keyNested('phoneNumbers.work.primary', v::boolType(), false)
->check($validateThis);
} catch (PhoneException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::when(v::alwaysInvalid(), v::alwaysValid())->check('foo');
} catch (ValidationException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
?>
--EXPECT--

View file

@ -25,7 +25,7 @@ try {
)
->assert($input);
} catch (AllOfException $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
try {
@ -38,7 +38,7 @@ try {
)
->assert($input);
} catch (AllOfException $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
?>
--EXPECTF--

View file

@ -13,7 +13,7 @@ try {
);
$validator->check(2);
} catch (ValidationException $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
?>
--EXPECTF--

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::allOf(v::stringType(), v::consonant())->check('Luke i\'m your father');
} catch (ConsonantException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::allOf(v::intType(), v::positive()))->check(42);
} catch (IntTypeException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::alnum()->check('Bla %123');
} catch (AlnumException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
?>

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::alnum())->check('adsfASDF123');
} catch (AlnumException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
?>

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::alpha()->check(1);
} catch (AlphaException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::alpha()->setName('Field')->check(null);
} catch (AlphaException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::alpha())->check('a');
} catch (AlphaException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {

View file

@ -10,7 +10,7 @@ use Respect\Validation\Validator;
try {
Validator::alwaysInvalid()->check('whatever');
} catch (AlwaysInvalidException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -9,13 +9,13 @@ use Respect\Validation\Validator as v;
try {
v::arrayType()->check('teste');
} catch (ArrayTypeException $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
try {
v::not(v::arrayType())->check([]);
} catch (ArrayTypeException $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
try {

View file

@ -10,13 +10,13 @@ use Respect\Validation\Validator as v;
try {
v::arrayVal()->check('Bla %123');
} catch (ArrayValException $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
try {
v::not(v::arrayVal())->check([42]);
} catch (ArrayValException $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
try {

View file

@ -10,7 +10,7 @@ use Respect\Validation\Validator as v;
try {
v::base64()->check('=c3VyZS4');
} catch (Base64Exception $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
try {

View file

@ -10,7 +10,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::base64())->check('c3VyZS4=');
} catch (Base64Exception $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
try {

View file

@ -9,13 +9,13 @@ use Respect\Validation\Validator as v;
try {
v::boolType()->check('teste');
} catch (BoolTypeException $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
try {
v::not(v::boolType())->check(true);
} catch (BoolTypeException $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
try {

View file

@ -9,13 +9,13 @@ use Respect\Validation\Validator as v;
try {
v::boolVal()->check('ok');
} catch (BoolValException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {
v::not(v::boolVal())->check('yes');
} catch (BoolValException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::bsn()->check('acb');
} catch (BsnException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -9,13 +9,13 @@ use Respect\Validation\Validator as v;
try {
v::callableType()->check([]);
} catch (CallableTypeException $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
try {
v::not(v::callableType())->check('trim');
} catch (CallableTypeException $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
try {

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::cnpj()->check('não cnpj');
} catch (CnpjException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--;

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::cnpj())->check('65.150.175/0001-20');
} catch (CnpjException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::consonant()->check('top nos falsetes');
} catch (ConsonantException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::consonant())->check('ddd');
} catch (ConsonantException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::countable())->check([]);
} catch (CountableException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::countryCode()->check('1');
} catch (CountryCodeException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
?>
--EXPECTF--

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::countryCode())->check('BR');
} catch (CountryCodeException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::countryCode(CountryCode::ALPHA3)->check('1');
} catch (CountryCodeException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::countryCode(CountryCode::ALPHA3))->check('BRA');
} catch (CountryCodeException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::countryCode(CountryCode::NUMERIC)->check('BRA');
} catch (CountryCodeException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::countryCode(CountryCode::NUMERIC))->check('076');
} catch (CountryCodeException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::cpf()->check('this thing');
} catch (CpfException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::cpf())->check('276.865.775-11');
} catch (CpfException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::creditCard()->check(0);
} catch (CreditCardException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
?>

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::creditCard())->check(5555444433331111);
} catch (CreditCardException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
?>

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::creditCard('Visa')->check(3566002020360505);
} catch (CreditCardException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
?>

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::currencyCode()->check('batman');
} catch (CurrencyCodeException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::currencyCode())->check('BRL');
} catch (CurrencyCodeException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::digit()->check('a');
} catch (DigitException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::digit())->check(1);
} catch (DigitException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::email()->check('batman');
} catch (EmailException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::email())->check('bruce.wayne@gothancity.com');
} catch (EmailException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::email()->check('iambatman@gothancity..com');
} catch (EmailException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::exists()->check('/path/of/a/non-existent/file');
} catch (ExistsException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -9,13 +9,13 @@ use Respect\Validation\Validator as v;
try {
v::floatType()->check('42.33');
} catch (FloatTypeException $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
try {
v::not(v::floatType())->check(INF);
} catch (FloatTypeException $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
try {

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::identityCard('PL')->check('AYE205411');
} catch (PlIdentityCardException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::identityCard('PL'))->check('AYE205410');
} catch (IdentityCardException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::image()->check('tests/fixtures/invalid-image.png');
} catch (ImageException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::image())->check('tests/fixtures/valid-image.png');
} catch (ImageException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::imei()->check('497511659092062');
} catch (ImeiException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::imei())->check('35-007752-323751-3');
} catch (ImeiException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {

View file

@ -9,13 +9,13 @@ use Respect\Validation\Validator as v;
try {
v::intType()->check(new stdClass());
} catch (IntTypeException $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
try {
v::not(v::intType())->check(42);
} catch (IntTypeException $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
try {

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::ip()->check('foo');
} catch (IpException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::ip())->check('10.0.0.1');
} catch (IpException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::ip('127.0.1.*')->check('127.0.0.1');
} catch (IpException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::iterableType()->check(3);
} catch (IterableTypeException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::iterableType())->check([2, 3]);
} catch (IterableTypeException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
?>
--EXPECTF--

View file

@ -13,7 +13,7 @@ $data = [
try {
v::keyValue('password', 'equals', 'password_confirmation')->check($data);
} catch (EqualsException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -13,7 +13,7 @@ $data = [
try {
v::keyValue('password', 'equals', 'password_confirmation')->assert($data);
} catch (AllOfException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -12,7 +12,7 @@ $data = [
try {
v::not(v::keyValue('password', 'in', 'invalid_passwords'))->check($data);
} catch (Exception $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::languageCode('alpha-3')->check('pt');
} catch (LanguageCodeException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {
@ -27,7 +27,7 @@ try {
try {
v::not(v::languageCode())->check('pt');
} catch (LanguageCodeException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
?>

View file

@ -9,19 +9,19 @@ use Respect\Validation\Validator as v;
try {
v::length(0, 5)->check('nawarian');
} catch (LengthException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {
v::length(13, null)->check('phpsp.org.br');
} catch (LengthException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {
v::not(v::length(5, 20))->check('phpsp.org.br');
} catch (LengthException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
?>

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::length(5, 5)->check('123456');
} catch (LengthException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::nif()->check('06357771Q');
} catch (NifException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::nif())->check('71110316C');
} catch (NifException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::notBlank()->check(null);
} catch (NotBlankException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::notBlank()->setName('Field')->check(null);
} catch (NotBlankException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::notBlank())->check(1);
} catch (NotBlankException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {

View file

@ -25,7 +25,7 @@ v::notEmpty()->check([1]);
try {
v::notEmpty()->check(null);
} catch (NotEmptyException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {
@ -37,7 +37,7 @@ try {
try {
v::notEmpty()->setName('Field')->check(null);
} catch (NotEmptyException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {
@ -49,7 +49,7 @@ try {
try {
v::not(v::notEmpty())->check(1);
} catch (NotEmptyException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::notOptional()->check(null);
} catch (NotOptionalException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::notOptional()->setName('Field')->check(null);
} catch (NotOptionalException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::notOptional())->check(0);
} catch (NotOptionalException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {

View file

@ -9,13 +9,13 @@ use Respect\Validation\Validator as v;
try {
v::nullType()->check('');
} catch (NullTypeException $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
try {
v::not(v::nullType())->check(null);
} catch (NullTypeException $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
try {

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::number()->check(acos(1.01));
} catch (NumberException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
?>

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::number())->check(42);
} catch (NumberException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
?>

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::numericVal()->check('a');
} catch (NumericValException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::numericVal()->setName('Field')->check(null);
} catch (NumericValException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::numericVal())->check('1');
} catch (NumericValException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {

View file

@ -9,13 +9,13 @@ use Respect\Validation\Validator as v;
try {
v::objectType()->check([]);
} catch (ObjectTypeException $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
try {
v::not(v::objectType())->check(new stdClass());
} catch (ObjectTypeException $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
try {

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::optional(v::equals('foo')))->check(null);
} catch (OptionalException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
?>
--EXPECTF--

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::optional(v::equals('foo'))->setName('My field'))->check(null);
} catch (OptionalException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::pesel()->check('21120209251');
} catch (PeselException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--;

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::pesel())->check('21120209256');
} catch (PeselException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -11,7 +11,7 @@ try {
v::phpLabel()->check('topic01');
v::phpLabel()->assert('access');
} catch (AllOfException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -10,13 +10,13 @@ use Respect\Validation\Validator as v;
try {
v::phpLabel()->check('f o o');
} catch (PhpLabelException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
try {
v::not(v::phpLabel())->check('correctOne');
} catch (PhpLabelException $e) {
echo $e->getMainMessage().PHP_EOL;
echo $e->getMessage().PHP_EOL;
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::pis()->check('this thing');
} catch (PisException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::pis())->check('120.6671.406-4');
} catch (PisException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -9,13 +9,13 @@ use Respect\Validation\Validator as v;
try {
v::resourceType()->check('test');
} catch (ResourceTypeException $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
try {
v::not(v::resourceType())->check(tmpfile());
} catch (ResourceTypeException $exception) {
echo $exception->getMainMessage().PHP_EOL;
echo $exception->getMessage().PHP_EOL;
}
try {

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::slug()->check('wrong slug');
} catch (SlugException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::slug())->check('good-and-valid-slug');
} catch (SlugException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::tld()->check('42');
} catch (TldException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
?>
--EXPECTF--

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::tld())->check('com');
} catch (TldException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
?>
--EXPECTF--

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::unique()->check([1, 2, 2, 3]);
} catch (UniqueException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
?>
--EXPECTF--

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::unique()->check('test');
} catch (UniqueException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
?>
--EXPECTF--

View file

@ -8,7 +8,7 @@ use Respect\Validation\Validator as v;
try {
v::unique()->check([1, 2, 3, 1]);
} catch (UniqueException $exception) {
echo $exception->getMainMessage();
echo $exception->getMessage();
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::vatin('PL')->check('1645865778');
} catch (PlVatinException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

View file

@ -9,7 +9,7 @@ use Respect\Validation\Validator as v;
try {
v::not(v::vatin('PL'))->check('1645865777');
} catch (VatinException $e) {
echo $e->getMainMessage();
echo $e->getMessage();
}
?>
--EXPECTF--

Some files were not shown because too many files have changed in this diff Show more