Comments (8)
+1
from assert.
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.
from assert.
I can imagine a solution like this:
\Assert\withCustom('CustomAssertionClass')
->that(null)
->notNull();
from assert.
+1 I'd also like to use my own exception class in a clean way when switching to the fluent interface.
from assert.
+1
from assert.
👍
from assert.
It headaches me too.
I forked it with my implementation here https://github.com/acgrid/assert which everything can be inherited and work with each other.
The significant issue to me is helper functions, I added two getter/setter functions to provide an interface to access which class to be used.
To make it production usable, I made the fork namespaced (avoid possible collusion with another composer component) and tagged version x.1.
Since the change would be BC-breaking, so I am not confident to PR.
from assert.
This issue should be solved as of release 2.6.7
from assert.
Related Issues (20)
- Invalidly required array instead of iterable HOT 3
- date does not work with variable precision of microseconds HOT 1
- Assertion::url() does not support url with underscores in subdomains HOT 1
- Assertion::keySet
- issues with NAN HOT 3
- Assert\Assertion in annotations HOT 1
- PHP 8.0 compatibility HOT 2
- Invalid psalm annotation
- [BC break] Changes introduced in v3.2.4-v3.2.7 are excluded in v3.3.0 HOT 1
- Assertion::url validates invalid domain names HOT 1
- PHP 8 vs is_resource() HOT 1
- method greaterThan really checks greaterOrEqualThan
- `Assertion::uuid` assertion generates fatal error
- Allow predicated validation in Lazy Assertions chains
- assert/CONTRIBUTING.md on `master`
- Is there a way to assert for known specific values? HOT 1
- API to improve describing property paths
- Support to return false when an assertion fails HOT 1
- How about an assertion for array shapes?
- Assertion:date fails when matching February 29th without date
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from assert.