class AllValidator
@author Bernhard Schussek <bschussek@gmail.com>
Hierarchy
- class \Symfony\Component\Validator\ConstraintValidator implements \Symfony\Component\Validator\ConstraintValidatorInterface
- class \Symfony\Component\Validator\Constraints\AllValidator extends \Symfony\Component\Validator\ConstraintValidator
Expanded class hierarchy of AllValidator
File
-
vendor/
symfony/ validator/ Constraints/ AllValidator.php, line 22
Namespace
Symfony\Component\Validator\ConstraintsView source
class AllValidator extends ConstraintValidator {
public function validate(mixed $value, Constraint $constraint) : void {
if (!$constraint instanceof All) {
throw new UnexpectedTypeException($constraint, All::class);
}
if (null === $value) {
return;
}
if (!\is_array($value) && !$value instanceof \Traversable) {
throw new UnexpectedValueException($value, 'iterable');
}
$context = $this->context;
$validator = $context->getValidator()
->inContext($context);
foreach ($value as $key => $element) {
$validator->atPath('[' . $key . ']')
->validate($element, $constraint->constraints);
}
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
AllValidator::validate | public | function | Checks if the passed value is valid. | Overrides ConstraintValidatorInterface::validate |
ConstraintValidator::$context | protected | property | ||
ConstraintValidator::formatTypeOf | protected | function | Returns a string representation of the type of the value. | |
ConstraintValidator::formatValue | protected | function | Returns a string representation of the value. | |
ConstraintValidator::formatValues | protected | function | Returns a string representation of a list of values. | |
ConstraintValidator::initialize | public | function | Initializes the constraint validator. | Overrides ConstraintValidatorInterface::initialize |
ConstraintValidator::OBJECT_TO_STRING | public | constant | Whether to cast objects with a "__toString()" method to strings. | |
ConstraintValidator::PRETTY_DATE | public | constant | Whether to format {@link \DateTime} objects, either with the {@link \IntlDateFormatter} (if it is available) or as RFC-3339 dates ("Y-m-d H:i:s"). |