input = $input; $this->output = $output; } private function getStyle(): SymfonyStyle { if ($this->style === null) { $this->style = new SymfonyStyle($this->input, $this->output); } return $this->style; } public function success($message): void { $this->getStyle()->success($message); } public function error($message): void { $this->getStyle()->error($message); } public function warning($message): void { $this->getStyle()->warning($message); } public function validationError(ValidationFailedException $exception): void { $errors = $exception->getViolations(); if ($errors->count() > 0) { $style = $this->getStyle(); /** @var \Symfony\Component\Validator\ConstraintViolation $error */ foreach ($errors as $error) { $value = $error->getInvalidValue(); $style->error( $error->getPropertyPath() . ' (' . (\is_array($value) ? implode(',', $value) : $value) . ')' . "\n " . $error->getMessage() ); } } } }