Skip to content

notIn()

notIn() rejects values that match the supplied list using strict comparison.

use Fynix\Rule;
$username = Rule::string('username')
->notIn(['admin', 'root', 'system']);

A rejected value produces the value.disallowed error code.

Values not present in the deny-list continue through the rest of the validator pipeline. The comparison is strict.

$username = Rule::string('username')
->min(3)
->notIn(['admin', 'root']);
$username->validate('alice'); // null
$username->validate('admin'); // value.disallowed error

Use in() when an allow-list is clearer than a deny-list. The method is immutable.