Skip to content

Commit ba7017a

Browse files
authored
Add PHP72 to detectable PHP versions
Should we do this with a preg_match instead? `preg_match('~php(56|7[0-9])~', $matches)`
1 parent a0dbae7 commit ba7017a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

cli/Valet/Brew.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,15 @@ function linkedPhp()
171171

172172
$resolvedPath = $this->files->readLink('/usr/local/bin/php');
173173

174-
if (strpos($resolvedPath, 'php71') !== false) {
175-
return 'php71';
176-
} elseif (strpos($resolvedPath, 'php70') !== false) {
177-
return 'php70';
178-
} elseif (strpos($resolvedPath, 'php56') !== false) {
179-
return 'php56';
180-
} else {
181-
throw new DomainException("Unable to determine linked PHP.");
174+
// Check all currently supported PHP versions
175+
$phpVersions = ['php72', 'php71', 'php70', 'php56'];
176+
foreach ($phpVersions as $version) {
177+
if (strpos($resolvedPath, $version) !== false) {
178+
return $version;
179+
}
182180
}
181+
182+
throw new DomainException("Unable to determine linked PHP.");
183183
}
184184

185185
/**

0 commit comments

Comments
 (0)