Comments (3)
@terah I don't think that will work... Won't that validate that the value is numeric
and false
? I think in this case you'd need to run two separate assertions to make this possible:
try {
Assert::string($value);
} catch (AssertionFailedException $e) {
Assert::integer($value);
}
from assert.
Maybe this?
\Assert\that($mVal)
->numeric("Must be an int or string")
->false(is_float($mVal), "Can't be a float.");
from assert.
@mdavis1982 ended up doing it, thanks.
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.