Skip to content

Commit 9588070

Browse files
committed
Add support for custom lookup path using the SYMFONY_CLI_PHP_PATH environment varialbe
1 parent 25c6dba commit 9588070

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

discovery.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,14 +323,15 @@ func normalizeVersion(v string) string {
323323

324324
func (s *PHPStore) pathDirectories(configDir string) []string {
325325
phpShimDir := filepath.Join(configDir, "bin")
326+
additionalPath := os.Getenv("SYMFONY_CLI_PHP_PATH")
326327
path := os.Getenv("PATH")
327328
if runtime.GOOS == "windows" {
328329
path = os.Getenv("Path")
329330
}
330331
user := os.Getenv("USERPROFILE")
331332
dirs := []string{}
332333
seen := make(map[string]bool)
333-
for _, dir := range filepath.SplitList(path) {
334+
for _, dir := range filepath.SplitList(additionalPath + string(filepath.ListSeparator) + path) {
334335
dir = strings.Replace(dir, "%%USERPROFILE%%", user, 1)
335336
edir, err := evalSymlinks(dir)
336337
if err != nil {

0 commit comments

Comments
 (0)