Skip to content
Permalink
Browse files

Validators: grouped & sorted $validators

  • Loading branch information...
dg committed Mar 12, 2019
1 parent b1fa400 commit 7a9587bd9af42d9ee183e3e61d4bf1e847ced958
Showing with 26 additions and 17 deletions.
  1. +26 −17 src/Utils/Validators.php
@@ -20,38 +20,47 @@ class Validators
use Nette\StaticClass;
protected static $validators = [
// PHP types
'array' => 'is_array',
'bool' => 'is_bool',
'boolean' => 'is_bool',
'float' => 'is_float',
'int' => 'is_int',
'integer' => 'is_int',
'float' => 'is_float',
'number' => [__CLASS__, 'isNumber'],
'numeric' => [__CLASS__, 'isNumeric'],
'numericint' => [__CLASS__, 'isNumericInt'],
'string' => 'is_string',
'unicode' => [__CLASS__, 'isUnicode'],
'array' => 'is_array',
'list' => [Arrays::class, 'isList'],
'null' => 'is_null',
'object' => 'is_object',
'resource' => 'is_resource',
'scalar' => 'is_scalar',
'string' => 'is_string',
// pseudo-types
'callable' => [__CLASS__, 'isCallable'],
'null' => 'is_null',
'email' => [__CLASS__, 'isEmail'],
'url' => [__CLASS__, 'isUrl'],
'uri' => [__CLASS__, 'isUri'],
'iterable' => 'is_iterable',
'list' => [Arrays::class, 'isList'],
'none' => [__CLASS__, 'isNone'],
'type' => [__CLASS__, 'isType'],
'identifier' => [__CLASS__, 'isPhpIdentifier'],
'pattern' => null,
'number' => [__CLASS__, 'isNumber'],
'numeric' => [__CLASS__, 'isNumeric'],
'numericint' => [__CLASS__, 'isNumericInt'],
// string patterns
'alnum' => 'ctype_alnum',
'alpha' => 'ctype_alpha',
'digit' => 'ctype_digit',
'lower' => 'ctype_lower',
'upper' => 'ctype_upper',
'pattern' => null,
'space' => 'ctype_space',
'unicode' => [__CLASS__, 'isUnicode'],
'upper' => 'ctype_upper',
'xdigit' => 'ctype_xdigit',
'iterable' => 'is_iterable',
// syntax validation
'email' => [__CLASS__, 'isEmail'],
'identifier' => [__CLASS__, 'isPhpIdentifier'],
'uri' => [__CLASS__, 'isUri'],
'url' => [__CLASS__, 'isUrl'],
// environment validation
'type' => [__CLASS__, 'isType'],
];
protected static $counters = [

0 comments on commit 7a9587b

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.