assert icon indicating copy to clipboard operation
assert copied to clipboard

[ENHANCEMENT] miss a notOneOf()

Open meshenka opened this issue 5 years ago • 5 comments

or basically the ability to just negate any assertion

Will try to submit a PR soon

meshenka avatar Feb 24 '20 10:02 meshenka

Could this be clarified more?

zerkms avatar May 30 '20 11:05 zerkms

one time i got a use case where i need value is not one in an array. As oneOf() throws an exception we could not just do !oneOf()

May be it is too an edge case IDY, but notOneOf() could be nice or functionnal style negation

or functionnal style Assert::Not().oneOf()

Does it help?

meshenka avatar Jun 01 '20 17:06 meshenka

I've played around with the idea of lazy/combined assertions, in a style like this:

Assert::either(
    Type::string(),
    Type::null()
)($input);

I put something together here https://github.com/BackEndTea/Assert but its not a perfect state, and it doesn't deal properly with static analysis.

BackEndTea avatar Jun 11 '20 16:06 BackEndTea

Assert::either(
    Type::string(),
    Type::null()
)($input);

ooooooh, please don't

zerkms avatar Jun 11 '20 21:06 zerkms

@BackEndTea are you planning to pursue it?

simPod avatar Sep 09 '21 07:09 simPod