Symfony\Component\Form\Extension\Validator\ValidatorTypeGuesser::guessMinLengthForConstraint PHP Method

guessMinLengthForConstraint() public method

Guesses a field's minimum length based on the given constraint
public guessMinLengthForConstraint ( Constraint $constraint ) : Symfony\Component\Form\Guess\Guess
$constraint Symfony\Component\Validator\Constraint The constraint to guess for
return Symfony\Component\Form\Guess\Guess The guess for the minimum length
    public function guessMinLengthForConstraint(Constraint $constraint)
    {
        switch (get_class($constraint)) {
            case 'Symfony\Component\Validator\Constraints\MinLength':
                return new ValueGuess(
                    $constraint->limit,
                    Guess::HIGH_CONFIDENCE
                );
            case 'Symfony\Component\Validator\Constraints\Min':
                return new ValueGuess(
                    strlen((string)$constraint->limit),
                    Guess::HIGH_CONFIDENCE
                );
        }
    }