Skip to content

Commit

Permalink
Add print PHP_CodeSniffer and PHP-CS-Fixer versions when --version
Browse files Browse the repository at this point in the history
  • Loading branch information
zonuexe committed May 5, 2024
1 parent 1933073 commit c2280a9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Console/EasyCodingStandardConsoleApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
namespace Symplify\EasyCodingStandard\Console;

use Composer\XdebugHandler\XdebugHandler;
use PHP_CodeSniffer\Config as PHP_CodeSniffer;
use PhpCsFixer\Console\Application as PhpCsFixer;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -56,6 +58,14 @@ 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());
Expand Down

0 comments on commit c2280a9

Please sign in to comment.