[Validator] The Type constraint now accepts the "Boolean" type instead of "boolean".
Bug fix: yes Feature addition: no Backwards compatibility break: no Symfony2 tests pass: yes Fixes the following tickets: -
This commit is contained in:
parent
d407be068d
commit
73312ab5e9
@ -35,7 +35,8 @@ class TypeValidator extends ConstraintValidator
|
||||
return true;
|
||||
}
|
||||
|
||||
$type = $constraint->type == 'boolean' ? 'bool' : $constraint->type;
|
||||
$type = strtolower($constraint->type);
|
||||
$type = $type == 'boolean' ? 'bool' : $constraint->type;
|
||||
$function = 'is_'.$type;
|
||||
|
||||
if (function_exists($function) && call_user_func($function, $value)) {
|
||||
|
@ -62,6 +62,8 @@ class TypeValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
$file = $this->createFile();
|
||||
|
||||
return array(
|
||||
array(true, 'Boolean'),
|
||||
array(false, 'Boolean'),
|
||||
array(true, 'boolean'),
|
||||
array(false, 'boolean'),
|
||||
array(true, 'bool'),
|
||||
|
Reference in New Issue
Block a user