NotEmpty to allow null but dont allow no value
cbichis opened this issue · comments
Feature Request
Q | A |
---|---|
New Feature | yes |
RFC | no |
BC Break | no |
Summary
Is needed to allow null values as valid values but dont allow no value provided as a valid value. Currently as far as I know there is no such possibility.
By example it would be useful to run a Validator if the value provided is null...
This is highly specific functionality, and I would create a custom validator in this case, using the Callback
validator:
$validator = new Callback(function (mixed $value): bool {
if (null === $value) {
return true;
}
return ! empty($value);
});
Thanks @weierophinney for your suggestion. Is something easily doable so I agree with your conclusion.
Actually this is not good. In case we have null value the validators are not firing...