Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Validator] The Type constraint now accepts the "Boolean" type instea…
…d of "boolean".

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
  • Loading branch information
Hugo Hamon committed Oct 11, 2011
1 parent d407be0 commit 73312ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Expand Up @@ -35,7 +35,8 @@ public function isValid($value, Constraint $constraint)
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)) {
Expand Down
Expand Up @@ -62,6 +62,8 @@ public function getValidValues()
$file = $this->createFile();

return array(
array(true, 'Boolean'),
array(false, 'Boolean'),
array(true, 'boolean'),
array(false, 'boolean'),
array(true, 'bool'),
Expand Down

0 comments on commit 73312ab

Please sign in to comment.