From 4014c1b0302e81f984745e94e5b8b7b9c8ab9ba5 Mon Sep 17 00:00:00 2001 From: divinity76 Date: Tue, 19 Mar 2024 15:41:40 +0100 Subject: [PATCH] StyleCI --- src/AutoDiscover.php | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/AutoDiscover.php b/src/AutoDiscover.php index 42b4682..e61be4f 100644 --- a/src/AutoDiscover.php +++ b/src/AutoDiscover.php @@ -39,23 +39,26 @@ public function guessChromeBinaryPath(): string return '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'; case 'Windows': return self::getFromRegistry() ?? '%ProgramFiles(x86)%\Google\Chrome\Application\chrome.exe'; - default: { - $valid_names = array( - 'google-chrome', - 'chromium-browser', - 'chrome', - 'chromium', - ); - foreach (\explode(\PATH_SEPARATOR, \getenv('PATH')) as $dir) { - foreach ($valid_names as $name) { - $file = $dir . \DIRECTORY_SEPARATOR . $name; - if (\is_file($file) && \is_executable($file)) { - return $file; - } + default: + $valid_names = [ + 'google-chrome', + 'chromium-browser', + 'chrome', + 'chromium', + ]; + foreach (\explode(\PATH_SEPARATOR, \getenv('PATH')) as $dir) { + foreach ($valid_names as $name) { + $file = $dir.\DIRECTORY_SEPARATOR.$name; + if (\is_file($file) && \is_executable($file)) { + return $file; } } return 'chrome'; // ... very unlikely to actually work, but this retains the original behavior.. throw new \RuntimeException('Could not find chrome binary'); // this makes more sense tbh + } + + return 'chrome'; // ... very unlikely to actually work, but this retains the original behavior.. + // this would make more sense: throw new \RuntimeException('Could not find chrome binary'); } } }