Use short array syntax

This commit is contained in:
Henrique Moody 2015-10-17 22:44:47 -03:00
parent 6fb15a697c
commit 9c49dd3bcf
912 changed files with 5446 additions and 5457 deletions

View file

@ -19,11 +19,15 @@ return Symfony\CS\Config\Config::create()
'phpdoc_separation',
// An empty line feed should precede a return statement.
'return',
// PHP arrays should use the PHP 5.4 short-syntax.
'short_array_syntax',
// Remove trailing whitespace at the end of blank lines.
'whitespacy_lines',
// Removes extra empty lines.
'extra_empty_lines',
// Unused use statements must be removed.
'unused_use'
'unused_use',
// Ordering use statements.
'ordered_use',
))
->finder($finder);

View file

@ -64,14 +64,14 @@ namespace Respect\Validation\Exceptions;
class HelloWorldException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a Hello World',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a Hello World',
)
);
]
];
}
```

View file

@ -5,7 +5,7 @@
Validates if the input is an array or traversable object.
```php
v::arrayVal()->validate(array()); //true
v::arrayVal()->validate([]); //true
v::arrayVal()->validate(new ArrayObject); //true
```

View file

@ -41,7 +41,7 @@ v::call(
It is possible to call methods and closures as the first parameter:
```php
v::call(array($myObj, 'methodName'), v::intVal())->validate($myInput);
v::call([$myObj, 'methodName'], v::intVal())->validate($myInput);
v::call(function($input) {}, v::intVal())->validate($myInput);
```

View file

@ -7,7 +7,7 @@ Validates if the input is a callable value.
```php
v::callableType()->validate(function () {}); //true
v::callableType()->validate('trim'); //true
v::callableType()->validate(array(new ObjectType, 'methodName')); //true
v::callableType()->validate([new ObjectType, 'methodName']); //true
```
***

View file

@ -7,7 +7,7 @@ Validates if a string is in a specific charset.
```php
v::charset('ASCII')->validate('açúcar'); //false
v::charset('ASCII')->validate('sugar'); //true
v::charset(array('ISO-8859-1', 'EUC-JP'))->validate('日本国'); // true
v::charset(['ISO-8859-1', 'EUC-JP'])->validate('日本国'); // true
```
The array format is a logic OR, not AND.

View file

@ -12,7 +12,7 @@ v::contains('ipsum')->validate('lorem ipsum'); //true
For arrays:
```php
v::contains('ipsum')->validate(array('ipsum', 'lorem')); //true
v::contains('ipsum')->validate(['ipsum', 'lorem']); //true
```
A second parameter may be passed for identical comparison instead

View file

@ -8,11 +8,11 @@ Iterates over an array or Iterator and validates the value or key
of each entry:
```php
$releaseDates = array(
$releaseDates = [
'validation' => '2010-01-01',
'template' => '2011-01-01',
'relational' => '2011-02-05',
);
];
v::arrayVal()->each(v::date())->validate($releaseDates); //true
v::arrayVal()->each(v::date(), v::stringType()->lowercase())->validate($releaseDates); //true

View file

@ -15,7 +15,7 @@ v::endsWith('ipsum')->validate('lorem ipsum'); //true
For arrays:
```php
v::endsWith('ipsum')->validate(array('lorem', 'ipsum')); //true
v::endsWith('ipsum')->validate(['lorem', 'ipsum']); //true
```
A second parameter may be passed for identical comparison instead

View file

@ -14,7 +14,7 @@ v::in('lorem ipsum')->validate('ipsum'); //true
For arrays:
```php
v::in(array('lorem', 'ipsum'))->validate('lorem'); //true
v::in(['lorem', 'ipsum'])->validate('lorem'); //true
```
A second parameter may be passed for identical comparison instead

View file

@ -7,9 +7,9 @@
Validates an array key.
```php
$dict = array(
$dict = [
'foo' => 'bar'
);
];
v::key('foo')->validate($dict); //true
```

View file

@ -9,11 +9,11 @@ Validates an array key or an object property using `.` to represent nested data.
Validating keys from arrays or `ArrayAccess` instances:
```php
$array = array(
'foo' => array(
$array = [
'foo' => [
'bar' => 123,
),
);
],
];
v::keyNested('foo.bar')->validate($array); // true
```

View file

@ -5,7 +5,7 @@
Validates a keys in a defined structure.
```php
$dict = array('foo' => 42);
$dict = ['foo' => 42];
v::keySet(
v::key('foo', v::intVal())
@ -14,7 +14,7 @@ v::keySet(
Extra keys are not allowed:
```php
$dict = array('foo' => 42, 'bar' => 'String');
$dict = ['foo' => 42, 'bar' => 'String'];
v::keySet(
v::key('foo', v::intVal())
@ -23,7 +23,7 @@ v::keySet(
Missing required keys are not allowed:
```php
$dict = array('foo' => 42, 'bar' => 'String');
$dict = ['foo' => 42, 'bar' => 'String'];
v::keySet(
v::key('foo', v::intVal()),
@ -34,7 +34,7 @@ v::keySet(
Missing non-required keys are allowed:
```php
$dict = array('foo' => 42, 'bar' => 'String');
$dict = ['foo' => 42, 'bar' => 'String'];
v::keySet(
v::key('foo', v::intVal()),

View file

@ -27,7 +27,7 @@ The type as the first validator in a chain is a good practice,
since length accepts many types:
```php
v::arrayVal()->length(1, 5)->validate(array('foo', 'bar')); //true
v::arrayVal()->length(1, 5)->validate(['foo', 'bar']); //true
```
A third parameter may be passed to validate the passed values inclusive:

View file

@ -8,19 +8,19 @@ or empty arrays, recursively).
```php
v::notBlank()->validate(null); // false
v::notBlank()->validate(''); // false
v::notBlank()->validate(array()); // false
v::notBlank()->validate([]); // false
v::notBlank()->validate(' '); // false
v::notBlank()->validate(0); // false
v::notBlank()->validate('0'); // false
v::notBlank()->validate(0); // false
v::notBlank()->validate('0.0'); // false
v::notBlank()->validate(false); // false
v::notBlank()->validate(array('')); // false
v::notBlank()->validate(array(' ')); // false
v::notBlank()->validate(array(0)); // false
v::notBlank()->validate(array('0')); // false
v::notBlank()->validate(array(false)); // false
v::notBlank()->validate(array(array(''), array(0))); // false
v::notBlank()->validate(['']); // false
v::notBlank()->validate([' ']); // false
v::notBlank()->validate([0]); // false
v::notBlank()->validate(['0']); // false
v::notBlank()->validate([false]); // false
v::notBlank()->validate([[''], [0]]); // false
v::notBlank()->validate(new stdClass()); // false
```

View file

@ -25,7 +25,7 @@ v::intVal()->notEmpty()->validate(0); //false
Empty arrays:
```php
v::arrayVal()->notEmpty()->validate(array()); //false
v::arrayVal()->notEmpty()->validate([]); //false
```
Whitespace:

View file

@ -13,19 +13,19 @@ v::notOptional()->validate(null); //false
Other values:
```php
v::notOptional()->validate(array()); // true
v::notOptional()->validate([]); // true
v::notOptional()->validate(' '); // true
v::notOptional()->validate(0); // true
v::notOptional()->validate('0'); // true
v::notOptional()->validate(0); // true
v::notOptional()->validate('0.0'); // true
v::notOptional()->validate(false); // true
v::notOptional()->validate(array('')); // true
v::notOptional()->validate(array(' ')); // true
v::notOptional()->validate(array(0)); // true
v::notOptional()->validate(array('0')); // true
v::notOptional()->validate(array(false)); // true
v::notOptional()->validate(array(array(''), array(0))); // true
v::notOptional()->validate(['']); // true
v::notOptional()->validate([' ']); // true
v::notOptional()->validate([0]); // true
v::notOptional()->validate(['0']); // true
v::notOptional()->validate([false]); // true
v::notOptional()->validate([[''), [0]]); // true
v::notOptional()->validate(new stdClass()); // true
```

View file

@ -143,7 +143,7 @@ use Respect\Validation\Exceptions\NestedValidationExceptionInterface;
try {
$usernameValidator->assert('really messed up screen#name');
} catch(NestedValidationExceptionInterface $exception) {
var_dump($exception->findMessages(array('alnum', 'length', 'noWhitespace')));
var_dump($exception->findMessages(['alnum', 'length', 'noWhitespace']));
}
```
@ -184,11 +184,11 @@ Getting messages as an array is fine, but sometimes you need to customize them i
to present them to the user. This is possible using the `findMessages()` method as well:
```php
$errors = $exception->findMessages(array(
$errors = $exception->findMessages([
'alnum' => '{{name}} must contain only letters and digits',
'length' => '{{name}} must not have more than 15 chars',
'noWhitespace' => '{{name}} cannot contain spaces'
));
]);
```
For all messages, the `{{name}}` and `{{input}}` variable is available for templates.
@ -204,7 +204,7 @@ $exception->setParam('translator', 'gettext');
```
The example above uses `gettext()` but you can use any other callable value, like
`array($translator, 'trans')` or `you_custom_function()`.
`[$translator, 'trans']` or `you_custom_function()`.
After that, if you call `getMainMessage()` or `getFullMessage()` (for nested),
the message will be translated.

View file

@ -5,7 +5,7 @@
Validates if the input is a scalar value.
```php
v::scalarVal()->validate(array()); //false
v::scalarVal()->validate([]); //false
v::scalarVal()->validate(135.0); //true
```

View file

@ -15,7 +15,7 @@ v::startsWith('lorem')->validate('lorem ipsum'); //true
For arrays:
```php
v::startsWith('lorem')->validate(array('lorem', 'ipsum')); //true
v::startsWith('lorem')->validate(['lorem', 'ipsum']); //true
```
`true` may be passed as a parameter to indicate identical comparison

View file

@ -21,7 +21,7 @@ class ExceptionIterator extends RecursiveArrayIterator
public function __construct($target, $fullRelated = false)
{
$this->fullRelated = $fullRelated;
parent::__construct(is_array($target) ? $target : array($target));
parent::__construct(is_array($target) ? $target : [$target]);
}
public function current()

View file

@ -15,16 +15,16 @@ class AbstractGroupedException extends AbstractNestedException
{
const NONE = 0;
const SOME = 1;
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::NONE => 'All of the required rules must pass for {{name}}',
self::SOME => 'These rules must pass for {{name}}',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::NONE => 'None of there rules must pass for {{name}}',
self::SOME => 'These rules must not pass for {{name}}',
),
);
],
];
public function chooseTemplate()
{

View file

@ -20,7 +20,7 @@ class AbstractNestedException extends ValidationException implements NestedValid
const ITERATE_TREE = 1;
const ITERATE_ALL = 2;
protected $related = array();
protected $related = [];
public function addRelated(ValidationException $related)
{
@ -31,7 +31,7 @@ class AbstractNestedException extends ValidationException implements NestedValid
public function findMessages(array $paths)
{
$messages = array();
$messages = [];
foreach ($paths as $key => $value) {
$numericKey = is_numeric($key);
@ -75,7 +75,7 @@ class AbstractNestedException extends ValidationException implements NestedValid
public function getMessages()
{
$messages = array();
$messages = [];
foreach ($this->getIterator() as $key => $exception) {
if ($key === 0) {
continue;
@ -89,7 +89,7 @@ class AbstractNestedException extends ValidationException implements NestedValid
public function getFullMessage()
{
$message = array();
$message = [];
$iterator = $this->getIterator(false, self::ITERATE_TREE);
foreach ($iterator as $m) {
$message[] = $m;

View file

@ -17,18 +17,18 @@ class AgeException extends AbstractNestedException
const LOWER = 1;
const GREATER = 2;
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::BOTH => '{{name}} must be between {{minAge}} and {{maxAge}} years ago',
self::LOWER => '{{name}} must be lower than {{minAge}} years ago',
self::GREATER => '{{name}} must be greater than {{maxAge}} years ago',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::BOTH => '{{name}} must not be between {{minAge}} and {{maxAge}} years ago',
self::LOWER => '{{name}} must not be lower than {{minAge}} years ago',
self::GREATER => '{{name}} must not be greater than {{maxAge}} years ago',
),
);
],
];
public function chooseTemplate()
{

View file

@ -13,14 +13,14 @@ namespace Respect\Validation\Exceptions;
class AllOfException extends AbstractGroupedException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::NONE => 'All of the required rules must pass for {{name}}',
self::SOME => 'These rules must pass for {{name}}',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::NONE => 'None of these rules must pass for {{name}}',
self::SOME => 'These rules must not pass for {{name}}',
),
);
],
];
}

View file

@ -13,14 +13,14 @@ namespace Respect\Validation\Exceptions;
class AlnumException extends AlphaException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must contain only letters (a-z) and digits (0-9)',
self::EXTRA => '{{name}} must contain only letters (a-z), digits (0-9) and {{additionalChars}}',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not contain letters (a-z) or digits (0-9)',
self::EXTRA => '{{name}} must not contain letters (a-z), digits (0-9) or {{additionalChars}}',
),
);
],
];
}

View file

@ -15,16 +15,16 @@ class AlphaException extends ValidationException
{
const EXTRA = 1;
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must contain only letters (a-z)',
self::EXTRA => '{{name}} must contain only letters (a-z) and "{{additionalChars}}"',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not contain letters (a-z)',
self::EXTRA => '{{name}} must not contain letters (a-z) or "{{additionalChars}}"',
),
);
],
];
public function chooseTemplate()
{

View file

@ -15,14 +15,14 @@ class AlwaysInvalidException extends ValidationException
{
const SIMPLE = 0;
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} is always invalid',
self::SIMPLE => '{{name}} is not valid',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} is always valid',
self::SIMPLE => '{{name}} is valid',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class AlwaysValidException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} is always valid',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} is always invalid',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class ArrayValException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be an array',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be an array',
),
);
],
];
}

View file

@ -13,14 +13,14 @@ namespace Respect\Validation\Exceptions;
class AtLeastException extends AbstractGroupedException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::NONE => 'At least {{howMany}} of the {{failed}} required rules must pass for {{name}}',
self::SOME => 'At least {{howMany}} of the {{failed}} required rules must pass for {{name}}, only {{passed}} passed.',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::NONE => 'At least {{howMany}} of the {{failed}} required rules must not pass for {{name}}',
self::SOME => 'At least {{howMany}} of the {{failed}} required rules must not pass for {{name}}, only {{passed}} passed.',
),
);
],
];
}

View file

@ -15,16 +15,16 @@ class AttributeException extends AbstractNestedException
{
const NOT_PRESENT = 0;
const INVALID = 1;
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::NOT_PRESENT => 'Attribute {{name}} must be present',
self::INVALID => 'Attribute {{name}} must be valid',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::NOT_PRESENT => 'Attribute {{name}} must not be present',
self::INVALID => 'Attribute {{name}} must not validate',
),
);
],
];
public function chooseTemplate()
{

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class BankAccountException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a bank account',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a bank account',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class BankException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a bank',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a bank',
),
);
],
];
}

View file

@ -17,18 +17,18 @@ class BetweenException extends AbstractNestedException
const LOWER = 1;
const GREATER = 2;
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::BOTH => '{{name}} must be between {{minValue}} and {{maxValue}}',
self::LOWER => '{{name}} must be greater than {{minValue}}',
self::GREATER => '{{name}} must be lower than {{maxValue}}',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::BOTH => '{{name}} must not be between {{minValue}} and {{maxValue}}',
self::LOWER => '{{name}} must not be greater than {{minValue}}',
self::GREATER => '{{name}} must not be lower than {{maxValue}}',
),
);
],
];
public function chooseTemplate()
{

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class BicException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a BIC',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a BIC',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class BoolTypeException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a boolean',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a boolean',
),
);
],
];
}

View file

@ -19,12 +19,12 @@ class BsnException extends ValidationException
/**
* @var array
*/
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a BSN',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a BSN',
),
);
],
];
}

View file

@ -19,12 +19,12 @@ class CallableTypeException extends ValidationException
/**
* @var array
*/
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a callable',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a callable',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class CallbackException extends AbstractNestedException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be valid',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be valid',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class CharsetException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be in the {{charset}} charset',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be in the {{charset}} charset',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class CnhException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a valid CNH number',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a valid CNH number',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class CnpjException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a valid CNPJ number',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a valid CNPJ number',
),
);
],
];
}

View file

@ -13,14 +13,14 @@ namespace Respect\Validation\Exceptions;
class CntrlException extends AlphaException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must contain only control characters',
self::EXTRA => '{{name}} must contain only control characters and "{{additionalChars}}"',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not contain control characters',
self::EXTRA => '{{name}} must not contain control characters or "{{additionalChars}}"',
),
);
],
];
}

View file

@ -13,14 +13,14 @@ namespace Respect\Validation\Exceptions;
class ConsonantException extends AlphaException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must contain only consonants',
self::EXTRA => '{{name}} must contain only consonants and "{{additionalChars}}"',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not contain consonants',
self::EXTRA => '{{name}} must not contain consonants or "{{additionalChars}}"',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class ContainsException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must contain the value "{{containsValue}}"',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not contain the value "{{containsValue}}"',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class CountryCodeException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a valid country',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a valid country',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class CpfException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a valid CPF number',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a valid CPF number',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class CreditCardException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a valid Credit Card number',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a valid Credit Card number',
),
);
],
];
}

View file

@ -15,18 +15,18 @@ class DateException extends ValidationException
{
const FORMAT = 1;
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a valid date',
self::FORMAT => '{{name}} must be a valid date. Sample format: {{format}}',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a valid date',
self::FORMAT => '{{name}} must not be a valid date in the format {{format}}',
),
);
],
];
public function configure($name, array $params = array())
public function configure($name, array $params = [])
{
$params['format'] = date(
$params['format'],

View file

@ -13,14 +13,14 @@ namespace Respect\Validation\Exceptions;
class DigitException extends AlphaException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must contain only digits (0-9)',
self::EXTRA => '{{name}} must contain only digits (0-9) and "{{additionalChars}}"',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not contain digits (0-9)',
self::EXTRA => '{{name}} must not contain digits (0-9) or "{{additionalChars}}"',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class DirectoryException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a directory',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a directory',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class DomainException extends AbstractNestedException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a valid domain',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a valid domain',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class EachException extends AbstractNestedException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => 'Each item in {{name}} must be valid',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => 'Each item in {{name}} must not validate',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class EmailException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be valid email',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be an email',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class EndsWithException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must end with ({{endValue}})',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not end with ({{endValue}})',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class EqualsException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be equals {{compareTo}}',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be equals {{compareTo}}',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class EvenException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be an even number',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be an even number',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class ExecutableException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be an executable file',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be an executable file',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class ExistsException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must exists',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not exists',
),
);
],
];
}

View file

@ -21,12 +21,12 @@ class ExtensionException extends ValidationException
/**
* @var array
*/
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must have {{extension}} extension',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not have {{extension}} extension',
),
);
],
];
}

View file

@ -16,12 +16,12 @@ namespace Respect\Validation\Exceptions;
*/
class FactorException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a factor of {{dividend}}',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a factor of {{dividend}}',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class FalseValException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} is not considered as "False"',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} is considered as "False"',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class FileException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a file',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a file',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class FilterVarException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be valid',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be valid',
),
);
],
];
}

View file

@ -19,12 +19,12 @@ class FiniteException extends ValidationException
/**
* @var array
*/
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a finite number',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a finite number',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class FloatValException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a float number',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a float number',
),
);
],
];
}

View file

@ -13,14 +13,14 @@ namespace Respect\Validation\Exceptions;
class GraphException extends AlphaException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must contain only graphical characters',
self::EXTRA => '{{name}} must contain only graphical characters and "{{additionalChars}}"',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not contain graphical characters',
self::EXTRA => '{{name}} must not contain graphical characters or "{{additionalChars}}"',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class HexRgbColorException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a hex RGB color',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a hex RGB color',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class IdenticalException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be identical as {{compareTo}}',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be identical as {{compareTo}}',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class InException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be in {{haystack}}',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be in {{haystack}}',
),
);
],
];
}

View file

@ -19,12 +19,12 @@ class InfiniteException extends ValidationException
/**
* @var array
*/
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be an infinite number',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be an infinite number',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class InstanceException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be an instance of {{instanceName}}',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be an instance of {{instanceName}}',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class IntTypeException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be of the type integer',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be of the type integer',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class IntValException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be an integer number',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be an integer number',
),
);
],
];
}

View file

@ -16,18 +16,18 @@ class IpException extends ValidationException
const STANDARD = 0;
const NETWORK_RANGE = 1;
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be an IP address',
self::NETWORK_RANGE => '{{name}} must be an IP address in the {{range}} range',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be an IP address',
self::NETWORK_RANGE => '{{name}} must not be an IP address in the {{range}} range',
),
);
],
];
public function configure($name, array $params = array())
public function configure($name, array $params = [])
{
if ($params['networkRange']) {
$range = $params['networkRange'];

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class JsonException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a valid JSON string',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a valid JSON string',
),
);
],
];
}

View file

@ -13,14 +13,14 @@ namespace Respect\Validation\Exceptions;
class KeyException extends AttributeException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::NOT_PRESENT => 'Key {{name}} must be present',
self::INVALID => 'Key {{name}} must be valid',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::NOT_PRESENT => 'Key {{name}} must not be present',
self::INVALID => 'Key {{name}} must not be valid',
),
);
],
];
}

View file

@ -13,14 +13,14 @@ namespace Respect\Validation\Exceptions;
class KeyNestedException extends AttributeException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::NOT_PRESENT => 'No items were found for key chain {{name}}',
self::INVALID => 'Key chain {{name}} is not valid',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::NOT_PRESENT => 'Items for key chain {{name}} must not be present',
self::INVALID => 'Key chain {{name}} must not be valid',
),
);
],
];
}

View file

@ -18,18 +18,18 @@ class KeySetException extends AbstractGroupedException
/**
* @var array
*/
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::NONE => 'All of the required rules must pass for {{name}}',
self::SOME => 'These rules must pass for {{name}}',
self::STRUCTURE => 'Must have keys {{keys}}',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::NONE => 'None of these rules must pass for {{name}}',
self::SOME => 'These rules must not pass for {{name}}',
self::STRUCTURE => 'Must not have keys {{keys}}',
),
);
],
];
/**
* {@inheritdoc}

View file

@ -15,16 +15,16 @@ class KeyValueException extends ValidationException
{
const COMPONENT = 1;
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => 'Key {{name}} must be present',
self::COMPONENT => '{{baseKey}} must be valid to validate {{comparedKey}}',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => 'Key {{name}} must not be present',
self::COMPONENT => '{{baseKey}} must not be valid to validate {{comparedKey}}',
),
);
],
];
public function chooseTemplate()
{

View file

@ -17,18 +17,18 @@ class LengthException extends ValidationException
const LOWER = 1;
const GREATER = 2;
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::BOTH => '{{name}} must have a length between {{minValue}} and {{maxValue}}',
self::LOWER => '{{name}} must have a length greater than {{minValue}}',
self::GREATER => '{{name}} must have a length lower than {{maxValue}}',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::BOTH => '{{name}} must not have a length between {{minValue}} and {{maxValue}}',
self::LOWER => '{{name}} must not have a length greater than {{minValue}}',
self::GREATER => '{{name}} must not have a length lower than {{maxValue}}',
),
);
],
];
public function chooseTemplate()
{

View file

@ -15,12 +15,12 @@ use Respect\Validation\Exceptions\BankAccountException;
class GermanBankAccountException extends BankAccountException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a german bank account',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a german bank account',
),
);
],
];
}

View file

@ -15,12 +15,12 @@ use Respect\Validation\Exceptions\BankException;
class GermanBankException extends BankException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a german bank',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a german bank',
),
);
],
];
}

View file

@ -15,12 +15,12 @@ use Respect\Validation\Exceptions\BicException;
class GermanBicException extends BicException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a german BIC',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a german BIC',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class LowercaseException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be lowercase',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be lowercase',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class MacAddressException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a valid mac address',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a valid mac address',
),
);
],
];
}

View file

@ -15,16 +15,16 @@ class MaxException extends ValidationException
{
const INCLUSIVE = 1;
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be lower than {{interval}}',
self::INCLUSIVE => '{{name}} must be lower than or equals {{interval}}',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be lower than {{interval}}',
self::INCLUSIVE => '{{name}} must not be lower than or equals {{interval}}',
),
);
],
];
public function chooseTemplate()
{

View file

@ -21,12 +21,12 @@ class MimetypeException extends ValidationException
/**
* @var array
*/
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must have {{mimetype}} mimetype',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not have {{mimetype}} mimetype',
),
);
],
];
}

View file

@ -15,16 +15,16 @@ class MinException extends ValidationException
{
const INCLUSIVE = 1;
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be greater than {{interval}}',
self::INCLUSIVE => '{{name}} must be greater than or equals {{interval}}',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be greater than {{interval}}',
self::INCLUSIVE => '{{name}} must not be greater than or equals {{interval}}',
),
);
],
];
public function chooseTemplate()
{

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class MinimumAgeException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => 'The age must be {{age}} years or more.',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => 'The age must not be {{age}} years or more.',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class MultipleException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be multiple of {{multipleOf}}',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be multiple of {{multipleOf}}',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class NegativeException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be negative',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be negative',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class NfeAccessKeyException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must be a valid NFe access key',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not be a valid NFe access key',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class NoException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} is not considered as "No"',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} is considered as "No"',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class NoWhitespaceException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{name}} must not contain whitespace',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{name}} must not not contain whitespace',
),
);
],
];
}

View file

@ -13,12 +13,12 @@ namespace Respect\Validation\Exceptions;
class NoneOfException extends AbstractNestedException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => 'None of these rules must pass for {{name}}',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => 'All of these rules must pass for {{name}}',
),
);
],
];
}

View file

@ -16,16 +16,16 @@ class NotBlankException extends ValidationException
const STANDARD = 0;
const NAMED = 1;
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => 'The value must not be blank',
self::NAMED => '{{name}} must not be blank',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => 'The value must be blank',
self::NAMED => '{{name}} must be blank',
),
);
],
];
public function chooseTemplate()
{

View file

@ -15,16 +15,16 @@ class NotEmptyException extends ValidationException
{
const STANDARD = 0;
const NAMED = 1;
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => 'The value must not be empty',
self::NAMED => '{{name}} must not be empty',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => 'The value must be empty',
self::NAMED => '{{name}} must be empty',
),
);
],
];
public function chooseTemplate()
{

View file

@ -16,16 +16,16 @@ class NotOptionalException extends ValidationException
const STANDARD = 0;
const NAMED = 1;
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => 'The value must not be optional',
self::NAMED => '{{name}} must not be optional',
),
self::MODE_NEGATIVE => array(
],
self::MODE_NEGATIVE => [
self::STANDARD => 'The value must be optional',
self::NAMED => '{{name}} must be optional',
),
);
],
];
public function chooseTemplate()
{

Some files were not shown because too many files have changed in this diff Show more