Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add print PHP_CodeSniffer and PHP-CS-Fixer versions when --version #201

Merged
merged 4 commits into from
May 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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));
samsonasik marked this conversation as resolved.
Show resolved Hide resolved

return 0;
samsonasik marked this conversation as resolved.
Show resolved Hide resolved
}
samsonasik marked this conversation as resolved.
Show resolved Hide resolved

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