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
726726 if (!$ this ->recursive ) {
727727 return false ;
728728 }
729+
729730 return parent ::hasChildren ($ allowLinks );
730731 }
731732
@@ -743,7 +744,8 @@ public function getChildren(): RecursiveDirectoryIterator
743744 return $ children ;
744745 } catch (UnexpectedValueException $ e ) {
745746 if ($ this ->skipUnreadableDirs ) {
746- return new RecursiveArrayIterator ([]);
747+ return $ this ;
748+ // return null;
747749 // return new RecursiveDirectoryIterator([]);
748750 }
749751
Original file line number Diff line number Diff line change @@ -201,6 +201,9 @@ public static function joinPath(string $basePath, string ...$subPaths): string
201201 if (!$ subPaths ) {
202202 return $ basePath ;
203203 }
204+ if (!$ basePath ) {
205+ return implode (DIRECTORY_SEPARATOR , $ subPaths );
206+ }
204207
205208 return $ basePath . DIRECTORY_SEPARATOR . implode (DIRECTORY_SEPARATOR , $ subPaths );
206209 }
@@ -253,15 +256,26 @@ public static function assertIsDir(string $dirPath): void
253256 }
254257 }
255258
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+
256270 /**
257271 * 检查文件/夹/链接是否存在
258272 *
259273 * @param string $file 要检查的目标
260- * @param string $type
274+ * @param string $type file, dir, link
261275 *
262276 * @return bool
263277 */
264- public static function exists (string $ file , string $ type = '' ): bool
278+ public static function isExists (string $ file , string $ type = '' ): bool
265279 {
266280 if (!$ type ) {
267281 return file_exists ($ file );
You can’t perform that action at this time.
0 commit comments