minor #14965 [Config] Remove duplicated paths (dosten)
This PR was merged into the 2.3 branch.
Discussion
----------
[Config] Remove duplicated paths
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| License | MIT
If someone sets the same path twice, the file locator will search for the the same file twice. We should remove duplicated paths before locate a file.
Commits
-------
97de887
Remove duplicated paths
This commit is contained in:
commit
11010ca691
@ -53,6 +53,7 @@ class FileLocator implements FileLocatorInterface
|
||||
array_unshift($paths, $currentPath);
|
||||
}
|
||||
|
||||
$paths = array_unique($paths);
|
||||
$filepaths = array();
|
||||
|
||||
foreach ($paths as $path) {
|
||||
@ -68,7 +69,7 @@ class FileLocator implements FileLocatorInterface
|
||||
throw new \InvalidArgumentException(sprintf('The file "%s" does not exist (in: %s).', $name, implode(', ', $paths)));
|
||||
}
|
||||
|
||||
return array_values(array_unique($filepaths));
|
||||
return $filepaths;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user