@@ -183,16 +183,7 @@ private function pathInfoForKey(string $key): array
183
183
case Config::DEV_PATHS_PHP_CONFIG_DIR_KEY :
184
184
$ what = 'PHP config files ' ;
185
185
$ target = $ this ->directories ->phpConfigDir ();
186
- if ($ finder ) {
187
- $ finder = $ finder ->ignoreDotFiles (true )->exclude ('env ' );
188
- $ envs = Finder::create ()
189
- ->in ("{$ source }/env " )
190
- ->depth ('== 0 ' )
191
- ->ignoreUnreadableDirs ()
192
- ->ignoreVCS (true )
193
- ->ignoreDotFiles (true );
194
- $ finder = $ finder ->append ($ envs );
195
- }
186
+ $ finder and $ finder = $ this ->pathInfoForPhpConfigDir ($ finder , $ source );
196
187
break ;
197
188
case Config::DEV_PATHS_YAML_CONFIG_DIR_KEY :
198
189
$ what = 'Yaml config files ' ;
@@ -217,6 +208,28 @@ static function (SplFileInfo $info): bool {
217
208
return [$ what , $ source , $ target , $ finder ];
218
209
}
219
210
211
+ /**
212
+ * @param Finder $finder
213
+ * @param string $source
214
+ * @return Finder
215
+ */
216
+ private function pathInfoForPhpConfigDir (Finder $ finder , string $ source ): Finder
217
+ {
218
+ $ finder = $ finder ->ignoreDotFiles (true )->exclude ('env ' );
219
+ if (!is_dir ("{$ source }/env " )) {
220
+ return $ finder ;
221
+ }
222
+
223
+ $ envs = Finder::create ()
224
+ ->in ("{$ source }/env " )
225
+ ->depth ('== 0 ' )
226
+ ->ignoreUnreadableDirs ()
227
+ ->ignoreVCS (true )
228
+ ->ignoreDotFiles (true );
229
+
230
+ return $ finder ->append ($ envs );
231
+ }
232
+
220
233
/**
221
234
* @param Io $io
222
235
* @return int
0 commit comments