From 6faccc33302fe02d3b80a31044178d8d2b47ef35 Mon Sep 17 00:00:00 2001 From: Gautier DELEGLISE Date: Sun, 8 Sep 2024 20:02:48 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/Extensions/Extension.php | 1 + tests/Unit/Extensions/ExtensionTest.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Extensions/Extension.php b/src/Extensions/Extension.php index 7de2f23..420b9c1 100644 --- a/src/Extensions/Extension.php +++ b/src/Extensions/Extension.php @@ -43,6 +43,7 @@ protected function pickArrayRandomElements(array $array, int $elements = 1) protected function pickArrayRandomElement(array $array) { $elements = $this->pickArrayRandomElements($array); + return reset($elements); } } diff --git a/tests/Unit/Extensions/ExtensionTest.php b/tests/Unit/Extensions/ExtensionTest.php index 461f0a3..a10af17 100644 --- a/tests/Unit/Extensions/ExtensionTest.php +++ b/tests/Unit/Extensions/ExtensionTest.php @@ -35,7 +35,7 @@ public function testExtensionPickArrayRandomElements(): void $elements = range(1, 100); $method = (new ReflectionClass(Extension::class))->getMethod('pickArrayRandomElements'); - $result = $method->invoke(new Extension(new Randomizer), $elements, 5); + $result = $method->invoke(new Extension(new Randomizer()), $elements, 5); $this->assertCount( 5, @@ -53,7 +53,7 @@ public function testExtensionPickArrayRandomElement(): void $elements = range(1, 100); $method = (new ReflectionClass(Extension::class))->getMethod('pickArrayRandomElement'); - $result = $method->invoke(new Extension(new Randomizer), $elements); + $result = $method->invoke(new Extension(new Randomizer()), $elements); $this->assertIsNotArray($result); $this->assertGreaterThanOrEqual(1, $result);