mirror of
https://github.com/Respect/Validation.git
synced 2024-06-26 17:20:16 +02:00
Since we now have PHP ISO Codes as a dependency[1], it doesn't make
sense to keep dealing with this data ourselves.
[1]: 04b2722d02
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
20 lines
570 B
PHP
20 lines
570 B
PHP
--FILE--
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require 'vendor/autoload.php';
|
|
|
|
use Respect\Validation\Validator as v;
|
|
|
|
exceptionMessage(static fn() => v::languageCode()->check(null));
|
|
exceptionMessage(static fn() => v::not(v::languageCode())->check('pt'));
|
|
exceptionFullMessage(static fn() => v::languageCode()->assert('por'));
|
|
exceptionFullMessage(static fn() => v::not(v::languageCode())->assert('en'));
|
|
?>
|
|
--EXPECT--
|
|
`null` must be a valid language code
|
|
"pt" must not be a valid language code
|
|
- "por" must be a valid language code
|
|
- "en" must not be a valid language code
|