src/Viserio/Component/Validation/Validator.php
public function validate(array $data, array $rules): ValidatorContract
    {
        $preparedData = $this->parseData($data);

        foreach ($rules as $fieldName => $fieldRules) {
            if ($fieldRules instanceof RespectValidator) {
                $rule = $fieldRules;
            } else {
                $rule = $this->createRule($fieldRules);
            }

            $data = $preparedData[$fieldName] ?? $preparedData;

            try {
                if (\is_array($data)) {
                    foreach ($data as $value) {
                        $rule->setName(\ucfirst($fieldName))->assert($value);
                    }
                } else {
                    $rule->setName(\ucfirst($fieldName))->assert($data);
                }

                $this->validRules[$fieldName] = true;
            } catch (NestedValidationException $exception) {
                $this->failedRules[$fieldName] = $exception->getMessages();
            }
        }

        return $this;
    }
public function validate(array $data, array $rules): ValidatorContract
    {
        $preparedData = $this->parseData($data);

        foreach ($rules as $fieldName => $fieldRules) {
            if ($fieldRules instanceof RespectValidator) {
                $rule = $fieldRules;
            } else {
                $rule = $this->createRule($fieldRules);
            }

            $data = $preparedData[$fieldName] ?? $preparedData;

            try {
                if (\is_array($data)) {
                    foreach ($data as $value) {
                        $rule->setName(\ucfirst($fieldName))->assert($value);
                    }
                } else {
                    $rule->setName(\ucfirst($fieldName))->assert($data);
                }

                $this->validRules[$fieldName] = true;
            } catch (NestedValidationException $exception) {
                $this->failedRules[$fieldName] = $exception->getMessages();
            }
        }

        return $this;
    }
{@inheritdoc}