Negates a predicate. Takes a callable returning bool and returns a Closure that returns the opposite bool for any input.
/**
* @param callable(mixed):bool $callable
* @return Closure(mixed):bool
*/
Comparisons\not(callable $callable): ClosureWhen Comparisons\not() is called, it returns the following Closure which can be used like a regular function.
/**
* @param mixed $value
* @return bool
*/
$function ($value): boolThis can be used to create a simple closure which can be used as a regular function.
$isNotEmpty = Comparisons\not('empty');
$isNotString = Comparisons\not('is_string');
$isNotZero = Comparisons\not(Comparisons\isEqualTo(0));
var_dump($isNotZero(0)); // false
var_dump($isNotZero(1)); // true
$nonStrings = array_filter([1, 'a', 2, 'b'], $isNotString);
print_r($nonStrings); // [1, 2]