Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SequentiallyValidator.php

class SequentiallyValidator

@author Maxime Steinhausser <maxime.steinhausser@gmail.com>

Hierarchy

  • class \Symfony\Component\Validator\ConstraintValidator implements \Symfony\Component\Validator\ConstraintValidatorInterface
    • class \Symfony\Component\Validator\Constraints\SequentiallyValidator extends \Symfony\Component\Validator\ConstraintValidator

Expanded class hierarchy of SequentiallyValidator

File

vendor/symfony/validator/Constraints/SequentiallyValidator.php, line 21

Namespace

Symfony\Component\Validator\Constraints
View source
class SequentiallyValidator extends ConstraintValidator {
    public function validate(mixed $value, Constraint $constraint) : void {
        if (!$constraint instanceof Sequentially) {
            throw new UnexpectedTypeException($constraint, Sequentially::class);
        }
        $context = $this->context;
        $validator = $context->getValidator()
            ->inContext($context);
        $originalCount = $validator->getViolations()
            ->count();
        foreach ($constraint->constraints as $c) {
            if ($originalCount !== $validator->validate($value, $c)
                ->getViolations()
                ->count()) {
                break;
            }
        }
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
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 &quot;__toString()&quot; 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 (&quot;Y-m-d H:i:s&quot;).
SequentiallyValidator::validate public function Checks if the passed value is valid. Overrides ConstraintValidatorInterface::validate
RSS feed
Powered by Drupal