merged branch nervo/patch-1 (PR #3684)

Commits
-------

09054f7 [Validator] Fix switch breaking in max/min length for constraint guesser, when a "Symfony\Component\Validator\Constraints\Type" constraint type is not in numeric types array

Discussion
----------

[Validator] Fix form type guesser

[Validator] Fix switch breaking in max/min length for constraint guesser, when a "Symfony\Component\Validator\Constraints\Type" constraint type is not in numeric types array

---------------------------------------------------------------------------

by vicb at 2012-03-23T14:19:27Z

You're right, thanks for the fix (I did break it !)
This commit is contained in:
Fabien Potencier 2012-03-23 15:43:59 +01:00
commit 6868e5177b

View File

@ -193,6 +193,7 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
if (in_array($constraint->type, array('double', 'float', 'numeric', 'real'))) {
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
}
break;
case 'Symfony\Component\Validator\Constraints\Max':
return new ValueGuess(strlen((string) $constraint->limit), Guess::LOW_CONFIDENCE);
@ -222,6 +223,7 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
if (in_array($constraint->type, array('double', 'float', 'numeric', 'real'))) {
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
}
break;
case 'Symfony\Component\Validator\Constraints\Min':
return new ValueGuess(strlen((string) $constraint->limit), Guess::LOW_CONFIDENCE);