diff options
Diffstat (limited to 'vendor/symfony/finder/Finder.php')
-rw-r--r-- | vendor/symfony/finder/Finder.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/vendor/symfony/finder/Finder.php b/vendor/symfony/finder/Finder.php index c28aaf74..278b9841 100644 --- a/vendor/symfony/finder/Finder.php +++ b/vendor/symfony/finder/Finder.php @@ -540,9 +540,9 @@ class Finder implements \IteratorAggregate, \Countable foreach ((array) $dirs as $dir) { if (is_dir($dir)) { - $resolvedDirs[] = $dir; + $resolvedDirs[] = $this->normalizeDir($dir); } elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) { - $resolvedDirs = array_merge($resolvedDirs, $glob); + $resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob)); } else { throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir)); } @@ -728,4 +728,16 @@ class Finder implements \IteratorAggregate, \Countable return $iterator; } + + /** + * Normalizes given directory names by removing trailing slashes. + * + * @param string $dir + * + * @return string + */ + private function normalizeDir($dir) + { + return rtrim($dir, '/'.\DIRECTORY_SEPARATOR); + } } |