Skip to content

Commit f5d0a8f

Browse files
committed
✨ feat: fs add new helper method: assertIsExists
1 parent 910b3f8 commit f5d0a8f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/FileSystem.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,16 @@ public static function assertIsDir(string $dirPath): void
260260
}
261261
}
262262

263+
/**
264+
* @param string $path
265+
*/
266+
public static function assertIsExists(string $path): void
267+
{
268+
if (!file_exists($path)) {
269+
throw new InvalidArgumentException("No such file or directory: $path");
270+
}
271+
}
272+
263273
/**
264274
* @param string $file file or dir path
265275
* @param string $type allow: file, dir, link

0 commit comments

Comments
 (0)