Task/Validation/ValidatorTask.php
public function execute(ProcessState $state)
    {
        $options = $this->getOptions($state);
        $violations = $this->validator->validate(
            $state->getInput(),
            $this->getOption($state, 'constraints'),
            $options['groups']
        );

        if (0 < $violations->count()) {
            /** @var  $violation ConstraintViolationInterface */
            foreach ($violations as $violation) {
                $invalidValue = $violation->getInvalidValue();

                $logContext = [
                    'property' => $violation->getPropertyPath(),
                    'violation_code' => $violation->getCode(),
                    'invalid_value' => $invalidValue,
                ];
                if ($this->getOption($state, 'log_errors')) {
                    $this->logger->warning($violation->getMessage(), $logContext);
                }
            }

            throw new \UnexpectedValueException("{$violations->count()} constraint violations detected on validation");
        }

        $state->setOutput($state->getInput());
    }
public function execute(ProcessState $state)
    {
        $options = $this->getOptions($state);
        $violations = $this->validator->validate(
            $state->getInput(),
            $this->getOption($state, 'constraints'),
            $options['groups']
        );

        if (0 < $violations->count()) {
            /** @var  $violation ConstraintViolationInterface */
            foreach ($violations as $violation) {
                $invalidValue = $violation->getInvalidValue();

                $logContext = [
                    'property' => $violation->getPropertyPath(),
                    'violation_code' => $violation->getCode(),
                    'invalid_value' => $invalidValue,
                ];
                if ($this->getOption($state, 'log_errors')) {
                    $this->logger->warning($violation->getMessage(), $logContext);
                }
            }

            throw new \UnexpectedValueException("{$violations->count()} constraint violations detected on validation");
        }

        $state->setOutput($state->getInput());
    }
@param ProcessState $state

@throws \Symfony\Component\OptionsResolver\Exception\ExceptionInterface
@throws \UnexpectedValueException