Skip to content

Commit 3b2967f

Browse files
committed
Added check for .valetrc on the valet use command which holds this projects version of PHP. Similar to how .nvmrc works with nvm use
1 parent dbf050b commit 3b2967f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cli/valet.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,15 @@
495495
*/
496496
$app->command('use [phpVersion] [--force]', function ($phpVersion, $force) {
497497
if (!$phpVersion) {
498-
return info('Valet is using ' . Brew::linkedPhp());
498+
if (file_exists($path = getcwd() . '/.valetrc')) {
499+
if ($phpVersion = trim(file_get_contents($path))) {
500+
info('Found \'' . $path . '/.valetrc\' with version <' . $phpVersion . '>');
501+
} else {
502+
return info('.valetrc does not contain a valid PHP version' . $phpVersion);
503+
}
504+
} else {
505+
return info('Valet is using ' . Brew::linkedPhp());
506+
}
499507
}
500508

501509
PhpFpm::validateRequestedVersion($phpVersion);

0 commit comments

Comments
 (0)