-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
Hi, thanks for providing this library. I have the following solution to allow "string or null", and will provide it below. However, if there is a better way to do this, please let me know.
First a null validator:
/**
* Class to allow nulls
*/
class AllowNull extends \Filterus\Filter
{
public function filter($var)
{
return $var;
}
public function validate($var)
{
return is_null($var);
}
}Then register like so:
use Filterus\Filter as F;
F::registerFilter('null', AllowNull::class);Finally use in a pool:
$validator = F::pool('string', 'null');Metadata
Metadata
Assignees
Labels
No labels