mirror of
https://github.com/Respect/Validation.git
synced 2024-06-26 17:20:16 +02:00
I also decided to make the messages way more straightforward than before. Instead of showing why the input is not a valid domain, we're now simply saying that the input is not a proper domain. Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
20 lines
564 B
PHP
20 lines
564 B
PHP
--FILE--
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require 'vendor/autoload.php';
|
|
|
|
use Respect\Validation\Validator as v;
|
|
|
|
exceptionMessage(static fn() => v::domain()->check('batman'));
|
|
exceptionMessage(static fn() => v::not(v::domain())->check('r--w.com'));
|
|
exceptionFullMessage(static fn() => v::domain()->assert('p-éz-.kk'));
|
|
exceptionFullMessage(static fn() => v::not(v::domain())->assert('github.com'));
|
|
?>
|
|
--EXPECT--
|
|
"batman" must be a valid domain
|
|
"r--w.com" must not be a valid domain
|
|
- "p-éz-.kk" must be a valid domain
|
|
- "github.com" must not be a valid domain
|