Skip to content

Commit bebf7b0

Browse files
jrchampstronk7
authored andcommitted
Support PHPCompatibility testVersion config
1 parent 0f35e73 commit bebf7b0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Command/CodeCheckerCommand.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ protected function configure()
4040
->setDescription('Run Moodle CodeSniffer standard on a plugin')
4141
->addOption('standard', 's', InputOption::VALUE_REQUIRED, 'The name or path of the coding standard to use', 'moodle')
4242
->addOption('max-warnings', null, InputOption::VALUE_REQUIRED,
43-
'Number of warnings to trigger nonzero exit code - default: -1', -1);
43+
'Number of warnings to trigger nonzero exit code - default: -1', -1)
44+
->addOption('test-version', null, InputOption::VALUE_REQUIRED,
45+
'Version or range of version to test with PHPCompatibility', 0);
4446
}
4547

4648
protected function initialize(InputInterface $input, OutputInterface $output)
@@ -85,6 +87,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
8587
$builder->add('--report-json='.$this->tempFile);
8688
}
8789

90+
// Show PHPCompatibility backward-compatibility errors for a version or version range.
91+
$testVersion = $input->getOption('test-version');
92+
if (!empty($testVersion)) {
93+
array_push($cmd, '--runtime-set', 'testVersion', $testVersion);
94+
}
95+
8896
// Add the files to process.
8997
foreach ($files as $file) {
9098
$builder->add($file);

0 commit comments

Comments
 (0)