Skip to content

Commit

Permalink
✨ feat: fs add new helper method: assertIsExists
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Mar 25, 2024
1 parent 910b3f8 commit f5d0a8f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/FileSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,16 @@ public static function assertIsDir(string $dirPath): void
}
}

/**
* @param string $path
*/
public static function assertIsExists(string $path): void
{
if (!file_exists($path)) {
throw new InvalidArgumentException("No such file or directory: $path");
}
}

/**
* @param string $file file or dir path
* @param string $type allow: file, dir, link
Expand Down

0 comments on commit f5d0a8f

Please sign in to comment.