From ed747fb5e8ed0ce6075e9c0670dd23e3a3145391 Mon Sep 17 00:00:00 2001 From: azjezz Date: Mon, 17 Aug 2020 22:34:22 +0100 Subject: [PATCH] [SecureRandom] ignore coverage for entropy exceptions --- src/Psl/SecureRandom/bytes.php | 2 ++ src/Psl/SecureRandom/int.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/Psl/SecureRandom/bytes.php b/src/Psl/SecureRandom/bytes.php index 4070afe..345e97a 100644 --- a/src/Psl/SecureRandom/bytes.php +++ b/src/Psl/SecureRandom/bytes.php @@ -22,6 +22,7 @@ function bytes(int $length): string try { return \random_bytes($length); + // @codeCoverageIgnoreStart } catch (\Exception $e) { $code = $e->getCode(); if (Str\is_string($code)) { @@ -29,5 +30,6 @@ function bytes(int $length): string } throw new Psl\Exception\RuntimeException('Unable to gather sufficient entropy.', $code, $e); + // @codeCoverageIgnoreEnd } } diff --git a/src/Psl/SecureRandom/int.php b/src/Psl/SecureRandom/int.php index 8ecb7e8..a3d78e0 100644 --- a/src/Psl/SecureRandom/int.php +++ b/src/Psl/SecureRandom/int.php @@ -20,6 +20,7 @@ function int(int $min = Math\INT64_MIN, int $max = Math\INT64_MAX): int try { return \random_int($min, $max); + // @codeCoverageIgnoreStart } catch (\Exception $e) { $code = $e->getCode(); if (Str\is_string($code)) { @@ -27,5 +28,6 @@ function int(int $min = Math\INT64_MIN, int $max = Math\INT64_MAX): int } throw new Psl\Exception\RuntimeException('Unable to gather sufficient entropy.', $code, $e); + // @codeCoverageIgnoreEnd } }