Skip to content

Commit 22a1083

Browse files
Document empty-argument behavior for all, any, and none
All three methods accept zero rules, but the existing PHPDoc left callers to infer what the resulting rule would do. An empty `All` or `None` always matches; an empty `Any` never does. Co-authored-by: Dennis <47061464+dennisorlando@users.noreply.github.com>
1 parent e8bdcfe commit 22a1083

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/Filter.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ public static function match(Rule $rule, array|object $row): bool
5151
/**
5252
* Create a rule that matches if **all** of the given rules do
5353
*
54+
* If no rules are given, the resulting rule always matches.
55+
*
5456
* @param Rule ...$rules
5557
*
5658
* @return Chain
@@ -66,7 +68,7 @@ public static function all(Rule ...$rules): Chain
6668
* @param All $rules
6769
* @param object $row
6870
*
69-
* @return bool
71+
* @return bool True if all rules match; always true if no rules are given
7072
*/
7173
protected function matchAll(All $rules, object $row): bool
7274
{
@@ -82,6 +84,8 @@ protected function matchAll(All $rules, object $row): bool
8284
/**
8385
* Create a rule that matches if **any** of the given rules do
8486
*
87+
* If no rules are given, the resulting rule never matches.
88+
*
8589
* @param Rule ...$rules
8690
*
8791
* @return Chain
@@ -97,7 +101,7 @@ public static function any(Rule ...$rules): Chain
97101
* @param Any $rules
98102
* @param object $row
99103
*
100-
* @return bool
104+
* @return bool True if any rule matches; always false if no rules are given
101105
*/
102106
protected function matchAny(Any $rules, object $row): bool
103107
{
@@ -113,6 +117,8 @@ protected function matchAny(Any $rules, object $row): bool
113117
/**
114118
* Create a rule that matches if **none** of the given rules do
115119
*
120+
* If no rules are given, the resulting rule always matches.
121+
*
116122
* @param Rule ...$rules
117123
*
118124
* @return Chain
@@ -128,7 +134,7 @@ public static function none(Rule ...$rules): Chain
128134
* @param None $rules
129135
* @param object $row
130136
*
131-
* @return bool
137+
* @return bool True if no rules match; always true if no rules are given
132138
*/
133139
protected function matchNone(None $rules, object $row): bool
134140
{

0 commit comments

Comments
 (0)