|
40 | 40 | use phpDocumentor\Guides\Settings\SettingsManager; |
41 | 41 | use phpDocumentor\Guides\Twig\Theme\ThemeManager; |
42 | 42 | use Psr\Clock\ClockInterface; |
| 43 | +use Psr\Log\LogLevel; |
43 | 44 | use RuntimeException; |
44 | 45 | use Symfony\Component\Console\Command\Command; |
45 | 46 | use Symfony\Component\Console\Helper\ProgressBar; |
@@ -117,6 +118,13 @@ public function __construct( |
117 | 118 | 'If set, returns a non-zero exit code as soon as any warnings/errors occur', |
118 | 119 | ); |
119 | 120 |
|
| 121 | + $this->addOption( |
| 122 | + 'fail-on-error', |
| 123 | + null, |
| 124 | + InputOption::VALUE_NONE, |
| 125 | + 'If set, returns a non-zero exit code as soon as any errors occur', |
| 126 | + ); |
| 127 | + |
120 | 128 | $this->addOption( |
121 | 129 | 'theme', |
122 | 130 | null, |
@@ -240,8 +248,12 @@ private function getSettingsOverriddenWithInput(InputInterface $input): ProjectS |
240 | 248 | $settings->setLogPath((string) $input->getOption('log-path')); |
241 | 249 | } |
242 | 250 |
|
| 251 | + if ($input->getOption('fail-on-error')) { |
| 252 | + $settings->setFailOnError(LogLevel::ERROR); |
| 253 | + } |
| 254 | + |
243 | 255 | if ($input->getOption('fail-on-log')) { |
244 | | - $settings->setFailOnError(true); |
| 256 | + $settings->setFailOnError(LogLevel::WARNING); |
245 | 257 | } |
246 | 258 |
|
247 | 259 | if (count($input->getOption('output-format')) > 0) { |
@@ -290,7 +302,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int |
290 | 302 | } |
291 | 303 |
|
292 | 304 | if ($settings->isFailOnError()) { |
293 | | - $spyProcessor = new SpyProcessor(); |
| 305 | + $spyProcessor = new SpyProcessor($settings->getFailOnError()); |
294 | 306 | $this->logger->pushProcessor($spyProcessor); |
295 | 307 | } |
296 | 308 |
|
|
0 commit comments