-
Notifications
You must be signed in to change notification settings - Fork 189
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
Fluent API does not use own Assertion class #57
Comments
+1 |
This is not going to work without a class alias or a globally set assertion class. Both are not really ideal. These function are namespace bound and internal code relying on either one of the solutions leads to code smell. I'd say, want to use the functions? Either use the default implementation or cop the functions into the namespace that your own implementation resides in. Some things would have to be altered, like the hardcoded FQCN in AssertionChain in order for that to work. Another option would be to replace the functions with public static methods, these are basically fancy alternative constructors and don't create state, which doesn't introduce anything into the global scope. |
I can imagine a solution like this: \Assert\withCustom('CustomAssertionClass')
->that(null)
->notNull(); |
+1 I'd also like to use my own exception class in a clean way when switching to the fluent interface. |
+1 |
1 similar comment
👍 |
It headaches me too. |
This issue should be solved as of release 2.6.7 |
There is no way to use a specific Assertion class when using the fluent api. So using fluent api andd an own excpetion type at the same time have a drawback to me. When changing the assertion a differnt exception will be thrown.
The text was updated successfully, but these errors were encountered: