Implement `Not` rule
new Not(
new Number(min: 7, max: 12)
)
What an expected result for value e.g. not-a-number in that case?
What an expected result for value e.g.
not-a-numberin that case?
Simple logic: if internal rule is valid, then Not return error, otherwise return success.
Looks cool at first, but it's ambiguous. Maybe the provided example is not the best one, but I agree with @BoShurik - can't think where it can be used in practice (not a number). Combining it with Callback is even more confusing (an exception can be thrown, but depending on specific rules is not good).
Also we have $not properties for inverting logic in certain rules, like in Regex. Maybe use interface / trait pair instead like with "skip on empty", "skip on error", "when" only where it's supported / needed?
Also suggest to delay it to after initial release.
@vjik your example meant to accept numbers not in range 7 and 12 but it also accepts not valid numbers. And it may be not obvious to add additional Number rule
It's synthetic example for show syntax only.
It shows that you can't invert all rules. E.g. new Not(new TrueValue()) will accept incorrect input
Let's wait for real use-cases for rule inversion first.