public function guessPatternForConstraint(Constraint $constraint)
    {
        switch (\get_class($constraint)) {
            case 'Symfony\Component\Validator\Constraints\Length':
                if (is_numeric($constraint->min)) {
                    return new ValueGuess(sprintf('.{%s,}', (string) $constraint->min), Guess::LOW_CONFIDENCE);
                }
                break;

            case 'Symfony\Component\Validator\Constraints\Regex':
                $htmlPattern = $constraint->getHtmlPattern();

                if (null !== $htmlPattern) {
                    return new ValueGuess($htmlPattern, Guess::HIGH_CONFIDENCE);
                }
                break;

            case 'Symfony\Component\Validator\Constraints\Range':
                if (is_numeric($constraint->min)) {
                    return new ValueGuess(sprintf('.{%s,}', \strlen((string) $constraint->min)), Guess::LOW_CONFIDENCE);
                }
                break;

            case 'Symfony\Component\Validator\Constraints\Type':
                if (\in_array($constraint->type, ['double', 'float', 'numeric', 'real'])) {
                    return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
                }
                break;
        }
    }
public function guessPatternForConstraint(Constraint $constraint)
    {
        switch (\get_class($constraint)) {
            case 'Symfony\Component\Validator\Constraints\Length':
                if (is_numeric($constraint->min)) {
                    return new ValueGuess(sprintf('.{%s,}', (string) $constraint->min), Guess::LOW_CONFIDENCE);
                }
                break;

            case 'Symfony\Component\Validator\Constraints\Regex':
                $htmlPattern = $constraint->getHtmlPattern();

                if (null !== $htmlPattern) {
                    return new ValueGuess($htmlPattern, Guess::HIGH_CONFIDENCE);
                }
                break;

            case 'Symfony\Component\Validator\Constraints\Range':
                if (is_numeric($constraint->min)) {
                    return new ValueGuess(sprintf('.{%s,}', \strlen((string) $constraint->min)), Guess::LOW_CONFIDENCE);
                }
                break;

            case 'Symfony\Component\Validator\Constraints\Type':
                if (\in_array($constraint->type, ['double', 'float', 'numeric', 'real'])) {
                    return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
                }
                break;
        }
    }
public function guessPatternForConstraint ( Constraint $ constraint ) { switch ( \ get_class ( $ constraint ) ) { case 'Symfony\Component\Validator\Constraints\Length' : if ( is_numeric ( $ constraint -> min ) ) { return new ValueGuess ( sprintf ( '.{%s,}' , ( string ) $ constraint -> min ) , Guess :: LOW_CONFIDENCE ) ; } break ; case 'Symfony\Component\Validator\Constraints\Regex' : $ htmlPattern = $ constraint -> getHtmlPattern ( ) ; if ( null !== $ htmlPattern ) { return new ValueGuess ( $ htmlPattern , Guess :: HIGH_CONFIDENCE ) ; } break ; case 'Symfony\Component\Validator\Constraints\Range' : if ( is_numeric ( $ constraint -> min ) ) { return new ValueGuess ( sprintf ( '.{%s,}' , \ strlen ( ( string ) $ constraint -> min ) ) , Guess :: LOW_CONFIDENCE ) ; } break ; case 'Symfony\Component\Validator\Constraints\Type' : if ( \ in_array ( $ constraint -> type , [ 'double' , 'float' , 'numeric' , 'real' ] ) ) { return new ValueGuess ( null , Guess :: MEDIUM_CONFIDENCE ) ; } break ; } }
Guesses a field's pattern based on the given constraint.

@return ValueGuess|null The guess for the pattern
Guesses a field s pattern based on the given constraint .