diff --git a/src/Task/CopyDevPaths.php b/src/Task/CopyDevPaths.php index f07a3cf..f372c95 100644 --- a/src/Task/CopyDevPaths.php +++ b/src/Task/CopyDevPaths.php @@ -183,16 +183,7 @@ private function pathInfoForKey(string $key): array case Config::DEV_PATHS_PHP_CONFIG_DIR_KEY: $what = 'PHP config files'; $target = $this->directories->phpConfigDir(); - if ($finder) { - $finder = $finder->ignoreDotFiles(true)->exclude('env'); - $envs = Finder::create() - ->in("{$source}/env") - ->depth('== 0') - ->ignoreUnreadableDirs() - ->ignoreVCS(true) - ->ignoreDotFiles(true); - $finder = $finder->append($envs); - } + $finder and $finder = $this->pathInfoForPhpConfigDir($finder, $source); break; case Config::DEV_PATHS_YAML_CONFIG_DIR_KEY: $what = 'Yaml config files'; @@ -217,6 +208,28 @@ static function (SplFileInfo $info): bool { return [$what, $source, $target, $finder]; } + /** + * @param Finder $finder + * @param string $source + * @return Finder + */ + private function pathInfoForPhpConfigDir(Finder $finder, string $source): Finder + { + $finder = $finder->ignoreDotFiles(true)->exclude('env'); + if (!is_dir("{$source}/env")) { + return $finder; + } + + $envs = Finder::create() + ->in("{$source}/env") + ->depth('== 0') + ->ignoreUnreadableDirs() + ->ignoreVCS(true) + ->ignoreDotFiles(true); + + return $finder->append($envs); + } + /** * @param Io $io * @return int