mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 00:20:08 +01:00
Add --site to isolate and unisolate commands
- Add --site to isolate - Add --site to unisolate - Refactor some tests - Update Site@getSiteUrl to throw an exception instead of returning false - Fix a few minor typos/grammatical issues
This commit is contained in:
@@ -211,9 +211,7 @@ public function stopIfUnused($phpVersion = null)
|
||||
*/
|
||||
public function isolateDirectory($directory, $version)
|
||||
{
|
||||
if (! $site = $this->site->getSiteUrl($directory)) {
|
||||
throw new DomainException("The [{$directory}] site could not be found in Valet's site list.");
|
||||
}
|
||||
$site = $this->site->getSiteUrl($directory);
|
||||
|
||||
$version = $this->validateRequestedVersion($version);
|
||||
|
||||
@@ -239,9 +237,7 @@ public function isolateDirectory($directory, $version)
|
||||
*/
|
||||
public function unIsolateDirectory($directory)
|
||||
{
|
||||
if (! $site = $this->site->getSiteUrl($directory)) {
|
||||
throw new DomainException("The [{$directory}] site could not be found in Valet's site list.");
|
||||
}
|
||||
$site = $this->site->getSiteUrl($directory);
|
||||
|
||||
$oldCustomPhpVersion = $this->site->customPhpVersion($site); // Example output: "74"
|
||||
|
||||
@@ -339,10 +335,14 @@ public function normalizePhpVersion($version)
|
||||
*/
|
||||
public function validateRequestedVersion($version)
|
||||
{
|
||||
if (is_null($version)) {
|
||||
throw new DomainException("Please specify a PHP version (try something like 'php@8.1')");
|
||||
}
|
||||
|
||||
$version = $this->normalizePhpVersion($version);
|
||||
|
||||
if (! $this->brew->supportedPhpVersions()->contains($version)) {
|
||||
throw new DomainException("Valet doesn't support PHP version: {$version} (try something like 'php@7.3' instead)");
|
||||
throw new DomainException("Valet doesn't support PHP version: {$version} (try something like 'php@8.1' instead)");
|
||||
}
|
||||
|
||||
if (strpos($aliasedVersion = $this->brew->determineAliasedVersion($version), '@')) {
|
||||
@@ -351,7 +351,7 @@ public function validateRequestedVersion($version)
|
||||
|
||||
if ($version === 'php') {
|
||||
if ($this->brew->hasInstalledPhp()) {
|
||||
throw new DomainException('Brew is already using PHP '.PHP_VERSION.' as \'php\' in Homebrew. To use another version, please specify. eg: php@7.3');
|
||||
throw new DomainException('Brew is already using PHP '.PHP_VERSION.' as \'php\' in Homebrew. To use another version, please specify. eg: php@8.1');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user