ValidatorTypeGuesser
in package
implements
FormTypeGuesserInterface
Interfaces, Classes, Traits and Enums
Table of Contents
- $metadataFactory : mixed
- __construct() : mixed
- guessMaxLength() : ValueGuess|null
- Returns a guess about the field's maximum length.
- guessMaxLengthForConstraint() : ValueGuess|null
- Guesses a field's maximum length based on the given constraint.
- guessPattern() : ValueGuess|null
- Returns a guess about the field's pattern.
- guessPatternForConstraint() : ValueGuess|null
- Guesses a field's pattern based on the given constraint.
- guessRequired() : ValueGuess|null
- Returns a guess whether a property of a class is required.
- guessRequiredForConstraint() : ValueGuess|null
- Guesses whether a field is required based on the given constraint.
- guessType() : TypeGuess|null
- Returns a field guess for a property name of a class.
- guessTypeForConstraint() : TypeGuess|null
- Guesses a field class name for a given constraint.
- guess() : Guess|null
- Iterates over the constraints of a property, executes a constraints on them and returns the best guess.
Properties
$metadataFactory
private
mixed
$metadataFactory
Methods
__construct()
public
__construct(MetadataFactoryInterface $metadataFactory) : mixed
Parameters
- $metadataFactory : MetadataFactoryInterface
Return values
mixed —guessMaxLength()
Returns a guess about the field's maximum length.
public
guessMaxLength(mixed $class, mixed $property) : ValueGuess|null
Parameters
- $class : mixed
-
The fully qualified class name
- $property : mixed
-
The name of the property to guess for
Return values
ValueGuess|null —A guess for the field's maximum length
guessMaxLengthForConstraint()
Guesses a field's maximum length based on the given constraint.
public
guessMaxLengthForConstraint(Constraint $constraint) : ValueGuess|null
Parameters
- $constraint : Constraint
Return values
ValueGuess|null —The guess for the maximum length
guessPattern()
Returns a guess about the field's pattern.
public
guessPattern(mixed $class, mixed $property) : ValueGuess|null
Parameters
- $class : mixed
-
The fully qualified class name
- $property : mixed
-
The name of the property to guess for
Return values
ValueGuess|null —A guess for the field's required pattern
guessPatternForConstraint()
Guesses a field's pattern based on the given constraint.
public
guessPatternForConstraint(Constraint $constraint) : ValueGuess|null
Parameters
- $constraint : Constraint
Return values
ValueGuess|null —The guess for the pattern
guessRequired()
Returns a guess whether a property of a class is required.
public
guessRequired(mixed $class, mixed $property) : ValueGuess|null
Parameters
- $class : mixed
-
The fully qualified class name
- $property : mixed
-
The name of the property to guess for
Return values
ValueGuess|null —A guess for the field's required setting
guessRequiredForConstraint()
Guesses whether a field is required based on the given constraint.
public
guessRequiredForConstraint(Constraint $constraint) : ValueGuess|null
Parameters
- $constraint : Constraint
Return values
ValueGuess|null —The guess whether the field is required
guessType()
Returns a field guess for a property name of a class.
public
guessType(mixed $class, mixed $property) : TypeGuess|null
Parameters
- $class : mixed
-
The fully qualified class name
- $property : mixed
-
The name of the property to guess for
Return values
TypeGuess|null —A guess for the field's type and options
guessTypeForConstraint()
Guesses a field class name for a given constraint.
public
guessTypeForConstraint(Constraint $constraint) : TypeGuess|null
Parameters
- $constraint : Constraint
Return values
TypeGuess|null —The guessed field class and options
guess()
Iterates over the constraints of a property, executes a constraints on them and returns the best guess.
protected
guess(string $class, string $property, Closure $closure[, mixed $defaultValue = null ]) : Guess|null
Parameters
- $class : string
-
The class to read the constraints from
- $property : string
-
The property for which to find constraints
- $closure : Closure
-
The closure that returns a guess for a given constraint
- $defaultValue : mixed = null
-
The default value assumed if no other value can be guessed
Return values
Guess|null —The guessed value with the highest confidence