Fix wrong templates

The "MinimumAge" exception should use the "{{ name }}" placeholder
instead of the "{{ input }}" once that one can be either the input or a
user-defined name.

In the default message, the placeholder was using sprintf format, but
the correct way is to use "{{name}}". Also use the same style of the
other messages in the default message.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
This commit is contained in:
Henrique Moody 2018-03-07 11:03:08 +01:00
parent 0e81792ec8
commit aa4b111c90
No known key found for this signature in database
GPG key ID: 221E9281655813A6
2 changed files with 4 additions and 4 deletions

View file

@ -24,10 +24,10 @@ final class MinimumAgeException extends ValidationException
*/
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{input}} must be {{age}} years or more',
self::STANDARD => '{{name}} must be {{age}} years or more',
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{input}} must not be {{age}} years or more',
self::STANDARD => '{{name}} must not be {{age}} years or more',
],
];
}

View file

@ -25,10 +25,10 @@ class ValidationException extends InvalidArgumentException implements ExceptionI
const STANDARD = 0;
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => 'Data validation failed for %s',
self::STANDARD => '{{name}} must be valid',
],
self::MODE_NEGATIVE => [
self::STANDARD => 'Data validation failed for %s',
self::STANDARD => '{{name}} must not be valid',
],
];