Skip to content

Commit

Permalink
Append output instead of override doRun with --version
Browse files Browse the repository at this point in the history
  • Loading branch information
zonuexe committed May 6, 2024
1 parent 4d31848 commit 48fc8d4
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/Console/EasyCodingStandardConsoleApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,20 @@ public function doRun(InputInterface $input, OutputInterface $output): int
unset($xdebugHandler);
}

if ($input->hasParameterOption(['--version', '-V'], true)) {
$output->writeln($this->getLongVersion());
$output->writeln(sprintf('+ %s <info>%s</info>', 'PHP_CodeSniffer', PHP_CodeSniffer::VERSION));
$output->writeln(sprintf('+ %s <info>%s</info>', 'PHP-CS-Fixer', PhpCsFixer::VERSION));

return 0;
}

// skip in this case, since generate content must be clear from meta-info
if ($this->shouldPrintMetaInformation($input)) {
$output->writeln($this->getLongVersion());
}

return parent::doRun($input, $output);
$exitCode = parent::doRun($input, $output);

// Append to the output of --version
if ($exitCode === 0 && $input->hasParameterOption(['--version', '-V'], true)) {
$output->writeln(sprintf('+ %s <info>%s</info>', 'PHP_CodeSniffer', PHP_CodeSniffer::VERSION));
$output->writeln(sprintf('+ %s <info>%s</info>', 'PHP-CS-Fixer', PhpCsFixer::VERSION));
}

return $exitCode;
}

protected function getDefaultInputDefinition(): InputDefinition
Expand Down

0 comments on commit 48fc8d4

Please sign in to comment.