diff --git a/psalm.baseline.xml b/psalm.baseline.xml index 71d7f15737..1c9b9ada28 100644 --- a/psalm.baseline.xml +++ b/psalm.baseline.xml @@ -1,5 +1,5 @@ - + 0 @@ -140,11 +140,8 @@ - + [static::class, 'randomDigit'] - - $array - Closure diff --git a/src/Faker/Provider/Base.php b/src/Faker/Provider/Base.php index 5f3e388a0e..dc5dd02b5e 100644 --- a/src/Faker/Provider/Base.php +++ b/src/Faker/Provider/Base.php @@ -240,7 +240,11 @@ public static function randomElements($array = ['a', 'b', 'c'], $count = 1, $all */ public static function randomElement($array = ['a', 'b', 'c']) { - if (!$array || ($array instanceof \Traversable && !count($array))) { + if ([] === $array) { + return null; + } + + if ($array instanceof \Traversable && !count($array)) { return null; }