Skip to content

Commit 743016b

Browse files
authored
Merge pull request #8 from moufmouf/recursive_issue
Fixing recursive issue on Docker+Windows
2 parents 3c09649 + 4d32e78 commit 743016b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Glob/GlobClassExplorer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ private function doGetClasses(): array
9494

9595
$dirs = \array_map('dirname', $files);
9696

97+
$oldCwd = getcwd();
98+
chdir($this->rootPath);
9799
$classes = [];
98100
foreach ($dirs as $dir) {
99101
$filesForDir = \iterator_to_array($this->getPhpFilesForDir($dir));
@@ -104,6 +106,7 @@ private function doGetClasses(): array
104106
$classes[] = $namespace.\str_replace('/', '\\', $fileTrimPrefixSuffix);
105107
}
106108
}
109+
chdir($oldCwd);
107110
return $classes;
108111
}
109112

@@ -113,8 +116,6 @@ private function doGetClasses(): array
113116
*/
114117
private function getPhpFilesForDir(string $directory): \Iterator
115118
{
116-
$oldCwd = getcwd();
117-
chdir($this->rootPath);
118119
if (!\is_dir($directory)) {
119120
return new \EmptyIterator();
120121
}
@@ -124,7 +125,6 @@ private function getPhpFilesForDir(string $directory): \Iterator
124125
} else {
125126
$iterator = new GlobIterator($directory.'/*.php');
126127
}
127-
chdir($oldCwd);
128128
return $iterator;
129129
}
130130
}

0 commit comments

Comments
 (0)