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

dx: throw exception if policy could not be found in policy registry #8

Merged
merged 1 commit into from
Dec 22, 2023

Conversation

Bl00D4NGEL
Copy link
Contributor

This PR make the HasPolicies trait throw an exception if it can not find a policy for a subject with a (hopefully) useful exception message pointing the developer into a direction where or how they could fix the issue. Additionally I moved away from reflection classes in favor of built-in PHP methods to check for method existance and return value types.

In order to properly test these changes I went ahead and added phpunit as a dependency to add tests for this behaviour and added a GH actions definition (mostly copied from https://github.com/geekcell/container-facade/blob/main/.github/workflows/tests.yaml).

While this technically is a backwards compatibility break, in the previous version(s) of this bundle, if a policy was not found, the code would just error out completely because php cannot instantiate a reflection class of null.

@janvt janvt merged commit a5dfb69 into geekcell:main Dec 22, 2023
1 check failed
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