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

feat: sitekit resource loader #2

Merged
merged 13 commits into from
Nov 21, 2023

Conversation

sitepark-veltrup
Copy link
Member

No description provided.

@sitepark-veltrup sitepark-veltrup marked this pull request as draft October 26, 2023 15:43
@codecov
Copy link

codecov bot commented Oct 26, 2023

Welcome to Codecov 🎉

Once merged to your default branch, Codecov will compare your coverage reports and display the results in this comment.

Thanks for integrating Codecov - We've got you covered ☂️

@sitepark-veltrup sitepark-veltrup marked this pull request as ready for review October 27, 2023 08:21
@sitepark-veltrup sitepark-veltrup self-assigned this Oct 27, 2023
Copy link
Member

@sitepark-schaeper sitepark-schaeper left a comment

Choose a reason for hiding this comment

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

I think we should follow the common practice to call Exception classes "Exception" - InvalidResourceException and ResourceNotFoundException in this case. I'd also change the namespace to the singular Exception instead of Exceptions.

The Resource class may be better of beeing abstract or even an interface. Either way we should try to avoid constructors with this many arguments.

Lastly, is there a specific reason why all tests are missing declare(strict_types=1)?

src/Loader/SiteKitLoader.php Outdated Show resolved Hide resolved
src/Loader/SiteKitLoader.php Outdated Show resolved Hide resolved
src/Loader/SiteKitLoader.php Show resolved Hide resolved
src/Resource.php Show resolved Hide resolved
src/Resource.php Show resolved Hide resolved
src/Exceptions/InvalidResource.php Outdated Show resolved Hide resolved
src/Exceptions/ResourceNotFound.php Outdated Show resolved Hide resolved
src/Loader/SiteKitLoader.php Show resolved Hide resolved
@sitepark-veltrup
Copy link
Member Author

I think we should follow the common practice to call Exception classes "Exception" -

It is now very common to omit the exception suffix. This information is also redundant, since it is contained in the package name.

See e.g.

I would like to stay with the form without extension suffix because I find the information redundant and so everything is just easier.

@sitepark-schaeper
Copy link
Member

I would like to stay with the form without extension suffix because I find the information redundant and so everything is just easier.

Generally I'd agree that suffixes depicting superclasses or namespaces are redundent.
In this case ResourceNotFound is probably unmistakably easy to understand. But InvalidResource on the other hand could also be for example a subclass of a ResourceLoadingResult. To follow through with the advice from those articles one would have to name it ResourceIsInvalid instead.

Either way, somehow this feels off. I can't really tell wether this is just my perception or if Exceptions may really be an "exception". Could we gather a couple more opinons on this matter?

@sitepark-veltrup
Copy link
Member Author

Either way, somehow this feels off. I can't really tell wether this is just my perception or if Exceptions may really be an "exception". Could we gather a couple more opinons on this matter?

In agreement from the last meeting, I add the Exception suffix.

@sitepark-schaeper
Copy link
Member

These two points from my last comment might have gotten lost:

The Resource class may be better of beeing abstract or even an interface. Either way we should try to avoid constructors with this many arguments.

Lastly, is there a specific reason why all tests are missing declare(strict_types=1)?

I have nothing else to add other than that 👍

@sitepark-veltrup
Copy link
Member Author

The Resource class may be better of beeing abstract or even an interface. Either way we should try to avoid constructors with this many arguments.

I don't know exactly what we're doing with this class yet. So I would leave that open for the time being.

Lastly, is there a specific reason why all tests are missing declare(strict_types=1)?

No, that was not intentional. It was added.

@sitepark-veltrup sitepark-veltrup merged commit a579590 into main Nov 21, 2023
3 checks passed
@sitepark-veltrup sitepark-veltrup deleted the feature/sitepark-resource-loader branch November 21, 2023 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants