public function validate($value, Constraint $constraint)
    {
        if (!is_array($this->constraints)) {
            $this->initializeConstraints();
        }

        if (!$constraint->type) {
            throw new ConstraintDefinitionException('"type" must be specified on constraint Parameters');
        }

        if (!isset($this->constraints[$constraint->type])) {
            return;
        }

        if (null !== $value && !is_array($value)) {
            $this->context->buildViolation($constraint->message)
                ->addViolation();

            return;
        }

        $contextualValidator = $this->context->getValidator()->inContext($this->context);
        if (isset($this->constraints[$constraint->type])) {
            foreach ($this->constraints[$constraint->type] as $index => $constraint) {
                $contextualValidator
                    ->atPath('[' . $index . ']')
                    ->validate(isset($value[$index]) ? $value[$index] : null, $constraint);
            }
        }
    }
public function validate($value, Constraint $constraint)
    {
        if (!is_array($this->constraints)) {
            $this->initializeConstraints();
        }

        if (!$constraint->type) {
            throw new ConstraintDefinitionException('"type" must be specified on constraint Parameters');
        }

        if (!isset($this->constraints[$constraint->type])) {
            return;
        }

        if (null !== $value && !is_array($value)) {
            $this->context->buildViolation($constraint->message)
                ->addViolation();

            return;
        }

        $contextualValidator = $this->context->getValidator()->inContext($this->context);
        if (isset($this->constraints[$constraint->type])) {
            foreach ($this->constraints[$constraint->type] as $index => $constraint) {
                $contextualValidator
                    ->atPath('[' . $index . ']')
                    ->validate(isset($value[$index]) ? $value[$index] : null, $constraint);
            }
        }
    }
{@inheritdoc}