Skip to content

Commit

Permalink
Support PHPCompatibility testVersion config
Browse files Browse the repository at this point in the history
  • Loading branch information
jrchamp committed Feb 27, 2023
1 parent f44997a commit 257b6aa
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Command/CodeCheckerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ protected function configure(): void
->setDescription('Run Moodle CodeSniffer standard on a plugin')
->addOption('standard', 's', InputOption::VALUE_REQUIRED, 'The name or path of the coding standard to use', 'moodle')
->addOption('max-warnings', null, InputOption::VALUE_REQUIRED,
'Number of warnings to trigger nonzero exit code - default: -1', -1);
'Number of warnings to trigger nonzero exit code - default: -1', -1)
->addOption('testVersion', null, InputOption::VALUE_REQUIRED,
'Version or range of version to test with PHPCompatibility', 0);
}

protected function initialize(InputInterface $input, OutputInterface $output): void
Expand Down Expand Up @@ -82,6 +84,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$cmd[] = '--report-json=' . $this->tempFile;
}

// Show PHPCompatibility backward-compatibility errors for a version or version range.
$testVersion = $input->getOption('testVersion');
if (!empty($testVersion)) {
array_push($cmd, '--runtime-set', 'testVersion', $testVersion);
}

// Add the files to process.
foreach ($files as $file) {
$cmd[] = $file;
Expand Down

0 comments on commit 257b6aa

Please sign in to comment.