From 68ae2bb4bc3010cbb602bac988c5e99c5ac6ae55 Mon Sep 17 00:00:00 2001 From: Peter Elmered Date: Thu, 26 Sep 2024 17:38:26 +0200 Subject: [PATCH] Improve null check --- src/FakeCarHelper.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/FakeCarHelper.php b/src/FakeCarHelper.php index ba8d8b0..d959d14 100644 --- a/src/FakeCarHelper.php +++ b/src/FakeCarHelper.php @@ -78,7 +78,7 @@ public static function getRandomElementsFromArray(array $values, ?int $count = 1 return []; } - if (! $count) { + if ($count === null) { $count = $valuesLength === 1 ? 1 : random_int(1, $valuesLength); } @@ -100,6 +100,7 @@ public static function getRandomElementsFromArray(array $values, ?int $count = 1 */ public static function getWeighted(array $values, int $count = 1): string|int { + // TODO: Implement support for $count > 1 $currentTotal = 0; $firstRand = random_int(1, 100);