Add 8.4 support for switch-php-version command

This commit is contained in:
crazywhalecc 2024-11-02 21:44:55 +08:00 committed by Jerry Ma
parent ddafdf8987
commit 73e3480bdf

View File

@ -19,9 +19,9 @@ class SwitchPhpVersionCommand extends BaseCommand
$this->addArgument(
'php-major-version',
InputArgument::REQUIRED,
'PHP major version (supported: 7.4, 8.0, 8.1, 8.2, 8.3)',
'PHP major version (supported: 7.4, 8.0, 8.1, 8.2, 8.3, 8.4)',
null,
fn () => ['7.4', '8.0', '8.1', '8.2', '8.3']
fn () => ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
);
$this->no_motd = true;
@ -31,7 +31,7 @@ class SwitchPhpVersionCommand extends BaseCommand
public function handle(): int
{
$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', '8.4'])) {
// match x.y.z
preg_match('/^\d+\.\d+\.\d+$/', $php_ver, $matches);
if (!$matches) {