-
-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(filesystem): rework exceptions #328
Conversation
19946cd
to
19bcdab
Compare
Pull Request Test Coverage Report for Build 1632893479
💛 - Coveralls |
Signed-off-by: azjezz <azjezz@protonmail.com>
19bcdab
to
ee42346
Compare
* @throws Psl\Exception\InvariantViolationException If $directory doesn't exist or is not writable. | ||
* @throws Psl\Exception\InvariantViolationException If $prefix contains a directory separator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these cases are already covered by NotFoundException
and InvalidArgumentException
, except for “is not writable” part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
working on a PR to rework exceptions for File component as well, this is just done to satisfy psalm :)
* @throws Filesystem\Exception\RuntimeException If unable to create the file. | ||
* @throws Filesystem\Exception\RuntimeException If unable to create the file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate line.
* @throws Psl\Exception\InvariantViolationException If the file specified by | ||
* $filename does not exist. | ||
* @throws Exception\NotFileException If $file is not a file. | ||
* @throws Exception\NotFoundException If $file is not a found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @throws Exception\NotFoundException If $file is not a found. | |
* @throws Exception\NotFoundException If $file is not found. |
@@ -14,17 +14,19 @@ | |||
* | |||
* In other environments, it is the forward slash `/`. | |||
* | |||
* @param string|null $suffix If the filename ends in a suffix, this will also be cut off. | |||
* @param non-empty-string|null $suffix If the filename ends in a suffix, this will also be cut off. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why suffix can not be an empty string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
provide null in that case ^^ otherwise, it's useless ( this is done to encourage better typing down stream for users, so they know when they have a non-empty-string/empty-string. )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't string $suffix = ''
be more convinient for users? $maybeNull ?? ''
is easier to do than $maybeEmpty === '' ? null : $maybeEmpty
.
ref: #198