diff --git a/src/Command/CodeCheckerCommand.php b/src/Command/CodeCheckerCommand.php index caac0f5b..97aa86b5 100644 --- a/src/Command/CodeCheckerCommand.php +++ b/src/Command/CodeCheckerCommand.php @@ -39,6 +39,7 @@ 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, + ->addOption('testVersion', null, InputOption::VALUE_REQUIRED, 'Number of warnings to trigger nonzero exit code - default: -1', -1); } @@ -82,6 +83,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;