@@ -63,6 +63,7 @@ public function testRequired(array $data, bool $expected): void
63
63
public static function provideRequired (): iterable
64
64
{
65
65
yield from [
66
+ [[], false ],
66
67
[['foo ' => null ], false ],
67
68
[['foo ' => 123 ], true ],
68
69
[['foo ' => null , 'bar ' => 123 ], false ],
@@ -138,6 +139,11 @@ public static function providePermitEmpty(): iterable
138
139
{
139
140
yield from [
140
141
// If the rule is only `permit_empty`, any value will pass.
142
+ [
143
+ ['foo ' => 'permit_empty|valid_email ' ],
144
+ [],
145
+ true ,
146
+ ],
141
147
[
142
148
['foo ' => 'permit_empty|valid_email ' ],
143
149
['foo ' => '' ],
@@ -203,8 +209,8 @@ public static function providePermitEmpty(): iterable
203
209
['foo ' => 'invalid ' ],
204
210
false ,
205
211
],
206
- // Required has more priority
207
212
[
213
+ // Required has more priority
208
214
['foo ' => 'permit_empty|required|valid_email ' ],
209
215
['foo ' => '' ],
210
216
false ,
@@ -224,8 +230,8 @@ public static function providePermitEmpty(): iterable
224
230
['foo ' => false ],
225
231
false ,
226
232
],
227
- // This tests will return true because the input data is trimmed
228
233
[
234
+ // This tests will return true because the input data is trimmed
229
235
['foo ' => 'permit_empty|required ' ],
230
236
['foo ' => '0 ' ],
231
237
true ,
@@ -280,8 +286,8 @@ public static function providePermitEmpty(): iterable
280
286
['foo ' => '' , 'bar ' => 1 ],
281
287
true ,
282
288
],
283
- // Testing with closure
284
289
[
290
+ // Testing with closure
285
291
['foo ' => ['permit_empty ' , static fn ($ value ) => true ]],
286
292
['foo ' => '' ],
287
293
true ,
0 commit comments