mirror of
https://github.com/Respect/Validation.git
synced 2024-06-26 17:20:16 +02:00
Most Validation errors are sent to Users/Visitors or Clients and as such might not need to know it was a Key their inputs are being validated upon. Co-authored-by: Henrique Moody <henriquemoody@gmail.com> Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
23 lines
404 B
PHP
23 lines
404 B
PHP
--FILE--
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require 'vendor/autoload.php';
|
|
|
|
use Respect\Validation\Exceptions\NestedValidationException;
|
|
use Respect\Validation\Validator as v;
|
|
|
|
try {
|
|
v::key('firstname', v::notBlank()->setName('First Name'))->assert([]);
|
|
} catch (NestedValidationException $e) {
|
|
print_r($e->getMessages());
|
|
}
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Array
|
|
(
|
|
[First Name] => First Name must be present
|
|
)
|