From dd8c8fc66306053b409f631d4b5c1aac0df4d48e Mon Sep 17 00:00:00 2001 From: NasirNobin Date: Tue, 29 Mar 2022 09:10:07 +0600 Subject: [PATCH] add normalizePhpVersion inside getPhpExecutablePath --- cli/Valet/Brew.php | 2 ++ cli/Valet/PhpFpm.php | 2 +- cli/valet.php | 2 -- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/Valet/Brew.php b/cli/Valet/Brew.php index 28e9478..b5a8bd9 100644 --- a/cli/Valet/Brew.php +++ b/cli/Valet/Brew.php @@ -298,6 +298,8 @@ public function getPhpExecutablePath($phpVersion = null) return BREW_PREFIX.'/bin/php'; } + $phpVersion = PhpFpm::normalizePhpVersion($phpVersion); + // Check the default `/opt/homebrew/opt/php@8.1/bin/php` location first if ($this->files->exists(BREW_PREFIX."/opt/{$phpVersion}/bin/php")) { return BREW_PREFIX."/opt/{$phpVersion}/bin/php"; diff --git a/cli/Valet/PhpFpm.php b/cli/Valet/PhpFpm.php index 990a373..bd124f3 100644 --- a/cli/Valet/PhpFpm.php +++ b/cli/Valet/PhpFpm.php @@ -322,7 +322,7 @@ public function symlinkPrimaryValetSock($phpVersion) /** * If passed php7.4, or php74, 7.4, or 74 formats, normalize to php@7.4 format. */ - public function normalizePhpVersion($version) + public static function normalizePhpVersion($version) { return preg_replace('/(?:php@?)?([0-9+])(?:.)?([0-9+])/i', 'php@$1.$2', $version); } diff --git a/cli/valet.php b/cli/valet.php index 0edad92..70002ee 100755 --- a/cli/valet.php +++ b/cli/valet.php @@ -575,8 +575,6 @@ } } - $phpVersion = $phpVersion ? PhpFpm::normalizePhpVersion($phpVersion) : null; - return output(Brew::getPhpExecutablePath($phpVersion)); })->descriptions('Get the PHP executable path for a given site', [ 'site' => 'The site to get the PHP executable path for',