From 4decf4eecbeef248215f6a2d5b840f71544f4c72 Mon Sep 17 00:00:00 2001 From: Dennis <47061464+dennisorlando@users.noreply.github.com> Date: Mon, 29 Dec 2025 12:45:40 +0100 Subject: [PATCH] Document edgecases in 'All', 'None' and 'Any' Filters --- src/Filter.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Filter.php b/src/Filter.php index 3bbdd36..9e56e90 100644 --- a/src/Filter.php +++ b/src/Filter.php @@ -53,7 +53,9 @@ public static function match(Rule $rule, $row) } /** - * Create a rule that matches if **all** of the given rules do + * Create a rule that matches if **all** of the given rules do. + * If $rules is empty, the resulting Rule will always match. + * * * @param Rule ...$rules * @@ -65,7 +67,8 @@ public static function all(Rule ...$rules) } /** - * Return whether the given rules all match the given item + * Return true if all rules match the given item + * Returns true if $rules is empty * * @param All $rules * @param object $row @@ -84,7 +87,8 @@ protected function matchAll(All $rules, $row) } /** - * Create a rule that matches if **any** of the given rules do + * Create a rule that matches if **any** of the given rules do. + * If $rules is empty, the resulting Rule will never match. * * @param Rule ...$rules * @@ -96,7 +100,8 @@ public static function any(Rule ...$rules) } /** - * Return whether any of the given rules match the given item + * Return whether any rule matches the given item + * Returns false if $rules is empty * * @param Any $rules * @param object $row @@ -116,6 +121,7 @@ protected function matchAny(Any $rules, $row) /** * Create a rule that matches if **none** of the given rules do + * If $rules is empty, the resulting Rule will always match. * * @param Rule ...$rules * @@ -127,7 +133,8 @@ public static function none(Rule ...$rules) } /** - * Return whether none of the given rules match the given item + * Return whether no rules match the given item + * Returns true if $rules is empty * * @param None $rules * @param object $row