From 5dbcb8ec0a610520c22dc1eaad3239f853f7cc27 Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Sat, 20 Jul 2024 17:09:29 -0300 Subject: [PATCH] Fix: Count uncountable variable in WithMultiSelectBuilder --- src/Components/Filters/Builders/WithMultiSelectBuilder.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Components/Filters/Builders/WithMultiSelectBuilder.php b/src/Components/Filters/Builders/WithMultiSelectBuilder.php index a0da5872d..dd98eea7b 100644 --- a/src/Components/Filters/Builders/WithMultiSelectBuilder.php +++ b/src/Components/Filters/Builders/WithMultiSelectBuilder.php @@ -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; @@ -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;