1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-04 08:10:07 +01:00

add normalizePhpVersion inside getPhpExecutablePath

This commit is contained in:
NasirNobin
2022-03-29 09:10:07 +06:00
parent 1838945f57
commit dd8c8fc663
3 changed files with 3 additions and 3 deletions

View File

@@ -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";

View File

@@ -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);
}

View File

@@ -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',