File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -726,6 +726,7 @@ public function hasChildren(bool $allowLinks = false): bool
726
726
if (!$ this ->recursive ) {
727
727
return false ;
728
728
}
729
+
729
730
return parent ::hasChildren ($ allowLinks );
730
731
}
731
732
@@ -743,7 +744,8 @@ public function getChildren(): RecursiveDirectoryIterator
743
744
return $ children ;
744
745
} catch (UnexpectedValueException $ e ) {
745
746
if ($ this ->skipUnreadableDirs ) {
746
- return new RecursiveArrayIterator ([]);
747
+ return $ this ;
748
+ // return null;
747
749
// return new RecursiveDirectoryIterator([]);
748
750
}
749
751
Original file line number Diff line number Diff line change @@ -201,6 +201,9 @@ public static function joinPath(string $basePath, string ...$subPaths): string
201
201
if (!$ subPaths ) {
202
202
return $ basePath ;
203
203
}
204
+ if (!$ basePath ) {
205
+ return implode (DIRECTORY_SEPARATOR , $ subPaths );
206
+ }
204
207
205
208
return $ basePath . DIRECTORY_SEPARATOR . implode (DIRECTORY_SEPARATOR , $ subPaths );
206
209
}
@@ -253,15 +256,26 @@ public static function assertIsDir(string $dirPath): void
253
256
}
254
257
}
255
258
259
+ /**
260
+ * @param string $file
261
+ * @param string $type
262
+ *
263
+ * @return bool
264
+ */
265
+ public static function exists (string $ file , string $ type = '' ): bool
266
+ {
267
+ return self ::isExists ($ file , $ type );
268
+ }
269
+
256
270
/**
257
271
* 检查文件/夹/链接是否存在
258
272
*
259
273
* @param string $file 要检查的目标
260
- * @param string $type
274
+ * @param string $type file, dir, link
261
275
*
262
276
* @return bool
263
277
*/
264
- public static function exists (string $ file , string $ type = '' ): bool
278
+ public static function isExists (string $ file , string $ type = '' ): bool
265
279
{
266
280
if (!$ type ) {
267
281
return file_exists ($ file );
You can’t perform that action at this time.
0 commit comments