@@ -105,7 +105,8 @@ public function is_not_unique(?string $str, string $field, array $data): bool
105105 ->limit (1 );
106106
107107 if (
108- ! empty ($ whereField ) && ! empty ($ whereValue )
108+ $ whereField !== null && $ whereField !== ''
109+ && $ whereValue !== null && $ whereValue !== ''
109110 && ! preg_match ('/^\{(\w+)\}$/ ' , $ whereValue )
110111 ) {
111112 $ row = $ row ->where ($ whereField , $ whereValue );
@@ -150,7 +151,8 @@ public function is_unique(?string $str, string $field, array $data): bool
150151 ->limit (1 );
151152
152153 if (
153- ! empty ($ ignoreField ) && ! empty ($ ignoreValue )
154+ $ ignoreField !== null && $ ignoreField !== ''
155+ && $ ignoreValue !== null && $ ignoreValue !== ''
154156 && ! preg_match ('/^\{(\w+)\}$/ ' , $ ignoreValue )
155157 ) {
156158 $ row = $ row ->where ("{$ ignoreField } != " , $ ignoreValue );
@@ -276,8 +278,10 @@ public function required_with($str = null, ?string $fields = null, array $data =
276278
277279 foreach (explode (', ' , $ fields ) as $ field ) {
278280 if (
279- (array_key_exists ($ field , $ data ) && ! empty ($ data [$ field ]))
280- || (strpos ($ field , '. ' ) !== false && ! empty (dot_array_search ($ field , $ data )))
281+ (array_key_exists ($ field , $ data )
282+ && ! empty ($ data [$ field ])) // @phpstan-ignore-line Use empty()
283+ || (strpos ($ field , '. ' ) !== false
284+ && ! empty (dot_array_search ($ field , $ data ))) // @phpstan-ignore-line Use empty()
281285 ) {
282286 $ requiredFields [] = $ field ;
283287 }
@@ -323,7 +327,8 @@ public function required_without(
323327 foreach (explode (', ' , $ otherFields ) as $ otherField ) {
324328 if (
325329 (strpos ($ otherField , '. ' ) === false )
326- && (! array_key_exists ($ otherField , $ data ) || empty ($ data [$ otherField ]))
330+ && (! array_key_exists ($ otherField , $ data )
331+ || empty ($ data [$ otherField ])) // @phpstan-ignore-line Use empty()
327332 ) {
328333 return false ;
329334 }
@@ -338,7 +343,7 @@ public function required_without(
338343 $ fieldKey = $ fieldSplitArray [1 ];
339344
340345 if (is_array ($ fieldData )) {
341- return ! empty (dot_array_search ($ otherField , $ data )[$ fieldKey ]);
346+ return ! empty (dot_array_search ($ otherField , $ data )[$ fieldKey ]); // @phpstan-ignore-line Use empty()
342347 }
343348 $ nowField = str_replace ('* ' , $ fieldKey , $ otherField );
344349 $ nowFieldVaule = dot_array_search ($ nowField , $ data );
0 commit comments