From 2fad6c1107d3effd9d63531f15c05b2e8f37c5e6 Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Sun, 27 Mar 2022 13:51:50 -0500 Subject: [PATCH] Specify length as a positive-int --- src/Generator/RandomGeneratorInterface.php | 2 +- tests/Generator/CombGeneratorTest.php | 6 ++++-- tests/Generator/RandomBytesGeneratorTest.php | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Generator/RandomGeneratorInterface.php b/src/Generator/RandomGeneratorInterface.php index 5c83cb4..80c219b 100644 --- a/src/Generator/RandomGeneratorInterface.php +++ b/src/Generator/RandomGeneratorInterface.php @@ -22,7 +22,7 @@ interface RandomGeneratorInterface /** * Generates a string of randomized binary data * - * @param int $length The number of bytes of random binary data to generate + * @param positive-int $length The number of bytes of random binary data to generate * * @return string A binary string */ diff --git a/tests/Generator/CombGeneratorTest.php b/tests/Generator/CombGeneratorTest.php index dd43d4a..75ef316 100644 --- a/tests/Generator/CombGeneratorTest.php +++ b/tests/Generator/CombGeneratorTest.php @@ -87,14 +87,16 @@ class CombGeneratorTest extends TestCase } /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array> */ public function lengthLessThanSix(): array { - return [[0], [1], [2], [3], [4], [5]]; + return [[1], [2], [3], [4], [5]]; } /** + * @param positive-int $length + * * @throws Exception * * @dataProvider lengthLessThanSix diff --git a/tests/Generator/RandomBytesGeneratorTest.php b/tests/Generator/RandomBytesGeneratorTest.php index 1b09b07..e6259fd 100644 --- a/tests/Generator/RandomBytesGeneratorTest.php +++ b/tests/Generator/RandomBytesGeneratorTest.php @@ -15,7 +15,7 @@ use function hex2bin; class RandomBytesGeneratorTest extends TestCase { /** - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification + * @return array */ public function lengthAndHexDataProvider(): array { @@ -27,6 +27,8 @@ class RandomBytesGeneratorTest extends TestCase } /** + * @param positive-int $length + * * @throws Exception * * @dataProvider lengthAndHexDataProvider