Add Warnings for feedback

This commit is contained in:
Jack Anderson 2024-01-12 09:48:02 +00:00
parent d98d898ca9
commit d109a37fe0
2 changed files with 24 additions and 0 deletions

View file

@ -63,6 +63,10 @@ class Feedback
* @var array
*/
public $errors = [];
/**
* @var array
*/
public $warnings = [];
/**
* @return bool
@ -209,4 +213,16 @@ class Feedback
return $this;
}
public function getWarnings(): array
{
return $this->warnings;
}
public function setWarnings(array $warnings): Feedback
{
$this->warnings = $warnings;
return $this;
}
}

View file

@ -188,6 +188,7 @@ abstract class BaseCommand extends Command
$output->writeln('step: ' . $step . ' | status: ' . $status);
$this->writeFeedbackMessages($output, $feedback);
$this->writeFeedbackWarnings($output, $feedback);
$this->writeFeedbackErrors($output, $feedback);
}
@ -250,6 +251,13 @@ abstract class BaseCommand extends Command
}
}
protected function writeFeedbackWarnings(OutputInterface $output, Feedback $feedback): void {
$warnings = $feedback->getWarnings() ?? [];
foreach ($warnings as $warning) {
$output->writeln('<warning>' . $warning . '</warning>');
}
}
/**
* @param Feedback $feedback
* @param string $message