Skip to content

Validation message

Created by: Arcesilas

Hi,

Found this great package out only yesterday and already love it.

I think it would be nice to allow custom validation error messages, instead of the standard "Operand %s has an invalid value", which does not really explain what is actually expected (especially in case of complex validations with closures).

The message could be provided as a second argument to Argument::setValidation() method and made available in Option::setValue() and Operand::setValue().

Behind the scene, a Validator object (instanciated in Argument::setValidation()) could hold the validation callback and the error message (which could be overridden in case of complex validation).

I may work on it if you're interested in adding this feature to a future release.