Add switch-php-version specific patch version support

This commit is contained in:
crazywhalecc
2024-09-04 16:38:48 +08:00
committed by Jerry Ma
parent 3ce302d0e6
commit b354e017ba

View File

@@ -32,9 +32,13 @@ class SwitchPhpVersionCommand extends BaseCommand
{ {
$php_ver = $this->input->getArgument('php-major-version'); $php_ver = $this->input->getArgument('php-major-version');
if (!in_array($php_ver, ['7.4', '8.0', '8.1', '8.2', '8.3'])) { if (!in_array($php_ver, ['7.4', '8.0', '8.1', '8.2', '8.3'])) {
$this->output->writeln('<error>Invalid PHP major version ' . $php_ver . ' !</error>'); // match x.y.z
preg_match('/^\d+\.\d+\.\d+$/', $php_ver, $matches);
if (!$matches) {
$this->output->writeln('<error>Invalid PHP version ' . $php_ver . ' !</error>');
return static::FAILURE; return static::FAILURE;
} }
}
// detect if downloads/.lock.json exists // detect if downloads/.lock.json exists
$lock_file = DOWNLOAD_PATH . '/.lock.json'; $lock_file = DOWNLOAD_PATH . '/.lock.json';