@param ObjectValue\DependencyConstraint $constraint

@return Result\ValidationResult
13642
public function visitDependencyConstraint(ObjectValue\DependencyConstraint $constraint)
    {
        $value = $this->currentValue();
        if (
            !$value instanceof Value\ObjectValue ||
            !$value->has($constraint->property())
        ) {
            return $this->createResult();
        }

        return $constraint->schema()->accept($this);
    }
88609
public function letOnContext($constraint)
    {
        $this->defaultValue(static::FIELD_SELF, null);

        return $this->let(static::FIELD_SELF, $constraint);
    }
196832
public function validate($value, Constraint $constraint)
  {
    $valid = false;
    foreach ($constraint->format as $format)
    {
      $date = \DateTime::createFromFormat($format, $value);
      if ($date instanceof \DateTime)
      {
        $valid = true;
        break;
      }
    }
    if ($valid === false)
    {
      $this->context->addViolation($constraint->message, array('%invalid%' => $value));
    }
  }
628860
private function isArrayConstraint(Constraint $constraint): bool
    {
        return $constraint instanceof Assert\All // << Applied only on array
            || ($constraint instanceof Assert\Choice
                && true === $constraint->multiple // << expect an array multiple choices
            );
    }
924979
public function validate($value, Constraint $constraint)
    {
        $value = trim($value);

        parent::validate($value, $constraint);
    }
1171271
protected function validateEscape(Constraint $constraint)
    {
        if (strlen($constraint->escape) > 2) {
            throw new ConstraintDefinitionException(sprintf('"%s" is not a valid escape', $constraint->escape));
        }
    }
14996
public function validate($value, Constraint $constraint)
    {
        if (!$value instanceof FieldDefinitionData) {
            return;
        }

        $fieldType = $this->fieldTypeService->getFieldType($value->getFieldTypeIdentifier());
        $this->processValidationErrors($fieldType->validateValidatorConfiguration($value->validatorConfiguration));
    }
1158619
public function guessTypeForConstraint(Constraint $constraint)
    {
        switch (\get_class($constraint)) {
            case 'Symfony\Component\Validator\Constraints\Type':
                switch ($constraint->type) {
                    case 'array':
                        return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CollectionType', [], Guess::MEDIUM_CONFIDENCE);
                    case 'boolean':
                    case 'bool':
                        return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CheckboxType', [], Guess::MEDIUM_CONFIDENCE);

                    case 'double':
                    case 'float':
                    case 'numeric':
                    case 'real':
                        return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\NumberType', [], Guess::MEDIUM_CONFIDENCE);

                    case 'integer':
                    case 'int':
                    case 'long':
                        return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\IntegerType', [], Guess::MEDIUM_CONFIDENCE);

                    case '\DateTime':
                        return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateType', [], Guess::MEDIUM_CONFIDENCE);

                    case 'string':
                        return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextType', [], Guess::LOW_CONFIDENCE);
                }
                break;

            case 'Symfony\Component\Validator\Constraints\Country':
                return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CountryType', [], Guess::HIGH_CONFIDENCE);

            case 'Symfony\Component\Validator\Constraints\Currency':
                return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CurrencyType', [], Guess::HIGH_CONFIDENCE);

            case 'Symfony\Component\Validator\Constraints\Date':
                return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateType', ['input' => 'string'], Guess::HIGH_CONFIDENCE);

            case 'Symfony\Component\Validator\Constraints\DateTime':
                return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', ['input' => 'string'], Guess::HIGH_CONFIDENCE);

            case 'Symfony\Component\Validator\Constraints\Email':
                return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\EmailType', [], Guess::HIGH_CONFIDENCE);

            case 'Symfony\Component\Validator\Constraints\File':
            case 'Symfony\Component\Validator\Constraints\Image':
                return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\FileType', [], Guess::HIGH_CONFIDENCE);

            case 'Symfony\Component\Validator\Constraints\Language':
                return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\LanguageType', [], Guess::HIGH_CONFIDENCE);

            case 'Symfony\Component\Validator\Constraints\Locale':
                return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\LocaleType', [], Guess::HIGH_CONFIDENCE);

            case 'Symfony\Component\Validator\Constraints\Time':
                return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TimeType', ['input' => 'string'], Guess::HIGH_CONFIDENCE);

            case 'Symfony\Component\Validator\Constraints\Url':
                return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\UrlType', [], Guess::HIGH_CONFIDENCE);

            case 'Symfony\Component\Validator\Constraints\Ip':
                return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextType', [], Guess::MEDIUM_CONFIDENCE);

            case 'Symfony\Component\Validator\Constraints\Length':
            case 'Symfony\Component\Validator\Constraints\Regex':
                return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextType', [], Guess::LOW_CONFIDENCE);

            case 'Symfony\Component\Validator\Constraints\Range':
                return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\NumberType', [], Guess::LOW_CONFIDENCE);

            case 'Symfony\Component\Validator\Constraints\Count':
                return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CollectionType', [], Guess::LOW_CONFIDENCE);

            case 'Symfony\Component\Validator\Constraints\IsTrue':
            case 'Symfony\Component\Validator\Constraints\IsFalse':
                return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CheckboxType', [], Guess::MEDIUM_CONFIDENCE);
        }
    }
734596
public function transform(ConstraintInterface $constraint)
    {
        $this->clear();
        $this->setConstraint($constraint);
        $constraint = $constraint->accept($this);
        $this->clear();

        return $constraint;
    }
37110
public function validate($value, Constraint $constraint)
    {
        if (!$value instanceof FieldDefinitionData) {
            return;
        }

        $contentTypeData = $value->contentTypeData;
        foreach ($contentTypeData->fieldDefinitionsData as $fieldDefData) {
            if ($fieldDefData === $value) {
                continue;
            }

            if ($value->identifier === $fieldDefData->identifier) {
                $this->context->buildViolation($constraint->message)
                    ->atPath('identifier')
                    ->setParameter('%identifier%', $value->identifier)
                    ->addViolation();
            }
        }
    }
810023
public function visitRequiredConstraint(ObjectValue\RequiredConstraint $constraint)
    {
        $value = $this->currentValue();
        if (
            !$value instanceof Value\ObjectValue ||
            $value->has($constraint->property())
        ) {
            return $this->createResult();
        }

        return $this->createSingleIssueResult($constraint);
    }
410580
public function validate($value, Constraint $constraint)
    {
        /** @var \Symfony\Component\Form\Form $root */
        $root = $this->context->getRoot();

        /** @var \Generated\Shared\Transfer\QuoteTransfer $data */
        $data = $root->getData();

        $validationMessages = $this->manageMandate($data, $constraint);

        if (count($validationMessages) === 0) {
            return;
        }

        foreach ($validationMessages as $validationMessage) {
            $this->context->buildViolation($validationMessage)
                ->addViolation();
        }
    }
959405
public function validate($value, Constraint $constraint)
    {
        $constraintClass = $this->getValidatorConstraintClass();

        if (get_class($constraint) !== $constraintClass) {
            throw new UnexpectedTypeException($constraint, $constraintClass);
        }

        if (null === $value || '' === $value) {
            return;
        }

        if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) {
            throw new UnexpectedTypeException($value, 'string');
        }

        $value = (string) $value;

        $validator = $this->getBaseValidator();
        if (!$validator->isValid($value, $this->getValidationOptions($constraint))) {
            if ($this->context instanceof ExecutionContextInterface) {
                $this->context->buildViolation($constraint->message)
                    ->setParameter('{{ value }}', $this->formatValue($value))
                    ->addViolation();
            } else {
                $this->buildViolation($constraint->message)
                    ->setParameter('{{ value }}', $this->formatValue($value))
                    ->addViolation();
            }
        }
    }
401506
public function validate($value, Constraint $constraint): void
    {
        Assert::isInstanceOf($value, AttributeValueInterface::class);

        $defaultLocale = $this->localeProvider->getDefaultLocaleCode();
        $configuration = $value->getAttribute()->getConfiguration();

        if ($defaultLocale === $value->getLocaleCode()) {
            $configuration = array_merge($configuration, ['required' => true]);
        }

        /** @var AttributeTypeInterface $attributeType */
        $attributeType = $this->attributeTypeRegistry->get($value->getType());

        $attributeType->validate($value, $this->context, $configuration);
    }
143475
public function visitEnumConstraint(Generic\EnumConstraint $constraint)
    {
        $value = $this->currentValue();
        foreach ($constraint->values() as $enumValue) {
            if ($this->comparator()->equals($value, $enumValue)) {
                return $this->createResult();
            }
        }

        return $this->createSingleIssueResult($constraint);
    }
115945
protected function compileConstraint($constraint)
    {
        return function ($value) use ($constraint) {

            if (!$value instanceof MatchesCollection) {
                return $this->checker->check($value, $constraint);
            }

            // Matching values against sequential arrays will result in
            // checking if ANY of the values matches the criteria.
            // This will allow normal sql like "WHERE categories.id = 13" queries
            foreach ($value as $item) {
                if ($this->checker->check($item, $constraint)) {
                    return true;
                }
            }

            return false;

        };
    }
626767
public function visitAllOfConstraint(Generic\AllOfConstraint $constraint)
    {
        if (1 === count($constraint->schemas())) {
            $schemas = $constraint->schemas();

            return $schemas[0]->accept($this);
        }

        $result = $this->createResult();
        foreach ($constraint->schemas() as $schema) {
            $result = $result->merge($schema->accept($this));
        }

        return $result;
    }