Skip to content

Commit

Permalink
Fix: Count uncountable variable in WithMultiSelectBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
luanfreitasdev committed Jul 20, 2024
1 parent ebda1a1 commit 5dbcb8e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Components/Filters/Builders/WithMultiSelectBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ public function builder(Builder|QueryBuilder $builder, string $field, array|int|

$empty = false;

/** @var array $values */
if (count($values) === 0) {
if (!is_array($values) || count($values) === 0) {
return;
}

/** @var array $values */
foreach ($values as $value) {
if ($value === '') {
$empty = true;
Expand All @@ -46,13 +46,13 @@ public function collection(Collection $collection, string $field, array|int|stri
return $closure($collection, $values);
}

/** @var array $values */
$empty = false;

if (!is_array($values) || count($values) === 0) {
return $collection;
}

/** @var array $values */
foreach ($values as $value) {
if ($value === '') {
$empty = true;
Expand Down

0 comments on commit 5dbcb8e

Please sign in to comment.