mirror of
https://github.com/Respect/Validation.git
synced 2024-06-03 06:12:17 +02:00
97b243daa1
Although helpful, the changes in the Min, Max, and Length rules made using those rules more verbose. This commit will simplify their use by allowing users to use them as prefixes. Because I was creating prefixes for those rules, I made other cool prefixes. Doing that is scary because it will generate more code to support, and I would have liked to avoid that. However, that's a valuable addition, and it's worth the risk. I might reconsider that in the future, but for now, that looks like a good idea. Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
61 lines
2.6 KiB
PHP
61 lines
2.6 KiB
PHP
--FILE--
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require 'vendor/autoload.php';
|
|
|
|
use Respect\Validation\Validator as v;
|
|
|
|
exceptionMessage(static fn() => v::type('array')->assert(1));
|
|
exceptionMessage(static fn() => v::type('bool')->assert(1));
|
|
exceptionMessage(static fn() => v::type('boolean')->assert(1));
|
|
exceptionMessage(static fn() => v::type('callable')->assert(1));
|
|
exceptionMessage(static fn() => v::type('double')->assert(1));
|
|
exceptionMessage(static fn() => v::type('float')->assert(1));
|
|
exceptionMessage(static fn() => v::type('int')->assert('1'));
|
|
exceptionMessage(static fn() => v::type('integer')->assert('1'));
|
|
exceptionMessage(static fn() => v::type('null')->assert(1));
|
|
exceptionMessage(static fn() => v::type('object')->assert(1));
|
|
exceptionMessage(static fn() => v::type('resource')->assert(1));
|
|
exceptionMessage(static fn() => v::type('string')->assert(1));
|
|
// phpcs:disable Generic.Files.LineLength.TooLong
|
|
?>
|
|
--EXPECTF--
|
|
|
|
Deprecated: The type() rule is deprecated and will be removed in the next major version. Use arrayType() instead. in %s
|
|
1 must be of type array
|
|
|
|
Deprecated: The type() rule is deprecated and will be removed in the next major version. Use boolType() instead. in %s
|
|
1 must be of type boolean
|
|
|
|
Deprecated: The type() rule is deprecated and will be removed in the next major version. Use boolType() instead. in %s
|
|
1 must be of type boolean
|
|
|
|
Deprecated: The type() rule is deprecated and will be removed in the next major version. Use callableType() instead. in %s
|
|
1 must be callable
|
|
|
|
Deprecated: The type() rule is deprecated and will be removed in the next major version. Use floatType() instead. in %s
|
|
1 must be of type float
|
|
|
|
Deprecated: The type() rule is deprecated and will be removed in the next major version. Use floatType() instead. in %s
|
|
1 must be of type float
|
|
|
|
Deprecated: The type() rule is deprecated and will be removed in the next major version. Use intType() instead. in %s
|
|
"1" must be of type integer
|
|
|
|
Deprecated: The type() rule is deprecated and will be removed in the next major version. Use intType() instead. in %s
|
|
"1" must be of type integer
|
|
|
|
Deprecated: The type() rule is deprecated and will be removed in the next major version. Use nullType() instead. in %s
|
|
1 must be null
|
|
|
|
Deprecated: The type() rule is deprecated and will be removed in the next major version. Use objectType() instead. in %s
|
|
1 must be of type object
|
|
|
|
Deprecated: The type() rule is deprecated and will be removed in the next major version. Use resourceType() instead. in %s
|
|
1 must be a resource
|
|
|
|
Deprecated: The type() rule is deprecated and will be removed in the next major version. Use stringType() instead. in %s
|
|
1 must be of type string
|