diff --git a/recipe/provision/php.php b/recipe/provision/php.php index ef9aef3ac..5d0e924be 100644 --- a/recipe/provision/php.php +++ b/recipe/provision/php.php @@ -6,7 +6,12 @@ $defaultPhpVersion = file_exists('composer.json') ? explode('|', preg_replace('/[^0-9.|]+/', '', json_decode(file_get_contents('composer.json'), true)['require']['php'] ?? '8.3'))[0] : '8.3'; - return ask(' What PHP version to install? ', $defaultPhpVersion, ['5.6', '7.4', '8.0', '8.1', '8.2']); + + if (count(($parts = explode('.', $defaultPhpVersion))) > 2) { + $defaultPhpVersion = "$parts[0].$parts[1]"; + } + + return ask(' What PHP version to install? ', $defaultPhpVersion, ['5.6', '7.4', '8.0', '8.1', '8.2', '8.3']); }); desc('Installs PHP packages');