@@ -263,7 +263,6 @@ public function required_with($str = null, ?string $fields = null, array $data =
263263 // If the field is present we can safely assume that
264264 // the field is here, no matter whether the corresponding
265265 // search field is present or not.
266- $ fields = explode (', ' , $ fields );
267266 $ present = $ this ->required ($ str ?? '' );
268267
269268 if ($ present ) {
@@ -272,10 +271,10 @@ public function required_with($str = null, ?string $fields = null, array $data =
272271
273272 // Still here? Then we fail this test if
274273 // any of the fields are present in $data
275- // as $fields is the lis
274+ // as $fields is the list
276275 $ requiredFields = [];
277276
278- foreach ($ fields as $ field ) {
277+ foreach (explode ( ' , ' , $ fields) as $ field ) {
279278 if (
280279 (array_key_exists ($ field , $ data ) && ! empty ($ data [$ field ]))
281280 || (strpos ($ field , '. ' ) !== false && ! empty (dot_array_search ($ field , $ data )))
@@ -308,16 +307,15 @@ public function required_without($str = null, ?string $otherFields = null, array
308307 // If the field is present we can safely assume that
309308 // the field is here, no matter whether the corresponding
310309 // search field is present or not.
311- $ otherFields = explode (', ' , $ otherFields );
312- $ present = $ this ->required ($ str ?? '' );
310+ $ present = $ this ->required ($ str ?? '' );
313311
314312 if ($ present ) {
315313 return true ;
316314 }
317315
318316 // Still here? Then we fail this test if
319317 // any of the fields are not present in $data
320- foreach ($ otherFields as $ otherField ) {
318+ foreach (explode ( ' , ' , $ otherFields) as $ otherField ) {
321319 if ((strpos ($ otherField , '. ' ) === false ) && (! array_key_exists ($ otherField , $ data ) || empty ($ data [$ otherField ]))) {
322320 return false ;
323321 }
0 commit comments