From f37a474700b3320db7a201d26952fce4e81c4d10 Mon Sep 17 00:00:00 2001 From: driesvints Date: Tue, 5 Sep 2023 15:50:18 +0000 Subject: [PATCH] Fix code styling --- cli/Valet/Drivers/Specific/Magento2ValetDriver.php | 8 ++++---- cli/Valet/PhpFpm.php | 2 +- cli/Valet/Server.php | 6 +++--- cli/Valet/Site.php | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cli/Valet/Drivers/Specific/Magento2ValetDriver.php b/cli/Valet/Drivers/Specific/Magento2ValetDriver.php index 1651926..ad25b67 100644 --- a/cli/Valet/Drivers/Specific/Magento2ValetDriver.php +++ b/cli/Valet/Drivers/Specific/Magento2ValetDriver.php @@ -34,7 +34,7 @@ public function isStaticFile(string $sitePath, string $siteName, string $uri)/*: $route = parse_url(substr($uri, 1))['path']; $pub = ''; - if ('developer' === $this->mageMode) { + if ($this->mageMode === 'developer') { $pub = 'pub/'; } @@ -43,7 +43,7 @@ public function isStaticFile(string $sitePath, string $siteName, string $uri)/*: } $magentoPackagePubDir = $sitePath; - if ('developer' !== $this->mageMode) { + if ($this->mageMode !== 'developer') { $magentoPackagePubDir .= '/pub'; } @@ -82,7 +82,7 @@ private function handleForVersions($route): string */ private function checkMageMode($sitePath): void { - if (null !== $this->mageMode) { + if ($this->mageMode !== null) { // We have already figure out mode, no need to check it again return; } @@ -131,7 +131,7 @@ public function frontControllerPath(string $sitePath, string $siteName, string $ { $this->checkMageMode($sitePath); - if ('developer' === $this->mageMode) { + if ($this->mageMode === 'developer') { $_SERVER['DOCUMENT_ROOT'] = $sitePath; return $sitePath.'/index.php'; diff --git a/cli/Valet/PhpFpm.php b/cli/Valet/PhpFpm.php index f88cd66..75c92d8 100644 --- a/cli/Valet/PhpFpm.php +++ b/cli/Valet/PhpFpm.php @@ -224,7 +224,7 @@ public function useVersion(string $version, bool $force = false): ?string $version = $this->validateRequestedVersion($version); try { - if ($this->brew->linkedPhp() === $version && ! $force) { + if ($version === $this->brew->linkedPhp() && ! $force) { output(sprintf('Valet is already using version: %s. To re-link and re-configure use the --force parameter.'.PHP_EOL, $version)); exit(); diff --git a/cli/Valet/Server.php b/cli/Valet/Server.php index 85c37ed..0436f5c 100644 --- a/cli/Valet/Server.php +++ b/cli/Valet/Server.php @@ -168,7 +168,7 @@ public function sitePath(string $siteName): ?string $dirs = []; - while (false !== ($file = readdir($handle))) { + while (($file = readdir($handle)) !== false) { if (is_dir($path.'/'.$file) && ! in_array($file, ['.', '..'])) { $dirs[] = $file; } @@ -178,12 +178,12 @@ public function sitePath(string $siteName): ?string // Note: strtolower used below because Nginx only tells us lowercase names foreach ($dirs as $dir) { - if (strtolower($dir) === $siteName) { + if ($siteName === strtolower($dir)) { // early return when exact match for linked subdomain return $path.'/'.$dir; } - if (strtolower($dir) === $domain) { + if ($domain === strtolower($dir)) { // no early return here because the foreach may still have some subdomains to process with higher priority $valetSitePath = $path.'/'.$dir; } diff --git a/cli/Valet/Site.php b/cli/Valet/Site.php index f178251..f7af251 100644 --- a/cli/Valet/Site.php +++ b/cli/Valet/Site.php @@ -52,7 +52,7 @@ private function getLinkNameByCurrentDir(): ?string public function host(string $path): ?string { foreach ($this->files->scandir($this->sitesPath()) as $link) { - if (realpath($this->sitesPath($link)) === $path) { + if ($path === realpath($this->sitesPath($link))) { return $link; } }