Comparisons\all()

higher-order predicate variadic returns Closure returns bool pure
...(T → bool) → (T → bool)
At a glance — Alias of groupAnd. Reads naturally: "all of these predicates".

Creates a predicate Closure that is true only when every bound predicate returns true for the input value. Alias of groupAnd.

/**
  * @param callable(mixed):bool ...$callables
  * @return Closure(mixed):bool
  */
Comparisons\all(callable ...$callables): Closure

Returned Closure

When Comparisons\all() is called, it returns the following Closure which can be used like a regular function.

/**
  * @param mixed $value
  * @return bool
  */
$function ($value): bool

Examples

Partial Application

This can be used to create a simple closure which can be used as a regular function.

$adultString = Comparisons\all(
  'is_string',
  fn($s) => strlen($s) >= 18
);

var_dump($adultString('a full length name here')); // true
var_dump($adultString('short'));                   // false

Details

Comparisons Functions

Releated Combinators Functions