Skip to content
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

Merged
merged 1 commit into from
Dec 29, 2021

Conversation

azjezz
Copy link
Owner

@azjezz azjezz commented Dec 29, 2021

ref: #198

@azjezz azjezz self-assigned this Dec 29, 2021
@azjezz azjezz added Priority: High After critical issues are fixed, these should be dealt with before any further issues. Status: Completed Nothing further to be done with this issue. Awaiting to be closed by the requestor out of politeness Type: Enhancement Most issues will probably ask for additions or changes. Type: Maintenance Updating phrasing or wording to make things clearer or removing ambiguity labels Dec 29, 2021
@azjezz azjezz added this to the 2.0.0 milestone Dec 29, 2021
@azjezz azjezz force-pushed the chore/filesystem/rework-exceptions branch from 19946cd to 19bcdab Compare December 29, 2021 04:26
@coveralls
Copy link

coveralls commented Dec 29, 2021

Pull Request Test Coverage Report for Build 1632893479

  • 118 of 118 (100.0%) changed or added relevant lines in 32 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.0008%) to 99.881%

Totals Coverage Status
Change from base Build 1632337851: 0.0008%
Covered Lines: 3357
Relevant Lines: 3361

💛 - Coveralls

Signed-off-by: azjezz <azjezz@protonmail.com>
@azjezz azjezz force-pushed the chore/filesystem/rework-exceptions branch from 19bcdab to ee42346 Compare December 29, 2021 05:16
@azjezz azjezz merged commit e87d5e6 into 2.0.x Dec 29, 2021
@azjezz azjezz deleted the chore/filesystem/rework-exceptions branch December 29, 2021 05:19
Comment on lines 23 to 24
* @throws Psl\Exception\InvariantViolationException If $directory doesn't exist or is not writable.
* @throws Psl\Exception\InvariantViolationException If $prefix contains a directory separator.
Copy link
Contributor

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.

Copy link
Owner Author

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 :)

Comment on lines +18 to +19
* @throws Filesystem\Exception\RuntimeException If unable to create the file.
* @throws Filesystem\Exception\RuntimeException If unable to create the file.
Copy link
Contributor

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @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.
Copy link
Contributor

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?

Copy link
Owner Author

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. )

Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: High After critical issues are fixed, these should be dealt with before any further issues. Status: Completed Nothing further to be done with this issue. Awaiting to be closed by the requestor out of politeness Type: Enhancement Most issues will probably ask for additions or changes. Type: Maintenance Updating phrasing or wording to make things clearer or removing ambiguity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants