From 8c7da2fd4ea1c17e6d5578adb5777da9e720db21 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 6 Nov 2020 09:08:25 +0100 Subject: add patch for PHP 8 from merged PR https://github.com/ramsey/uuid/pull/352 switch to phpunit9 https://github.com/ramsey/uuid/pull/350 ignore 1 test with erratic result from review #1884542 --- 352.patch | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 352.patch (limited to '352.patch') diff --git a/352.patch b/352.patch new file mode 100644 index 0000000..b7ba70d --- /dev/null +++ b/352.patch @@ -0,0 +1,54 @@ +From 2a39b0a67413e902274b09f640c6b68ffbd199fa Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Thu, 29 Oct 2020 16:34:55 +0100 +Subject: [PATCH 1/2] catch ValueError raised by PHP 8 + +--- + src/Generator/DefaultNameGenerator.php | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/Generator/DefaultNameGenerator.php b/src/Generator/DefaultNameGenerator.php +index 270e8fbe..be552b91 100644 +--- a/src/Generator/DefaultNameGenerator.php ++++ b/src/Generator/DefaultNameGenerator.php +@@ -29,7 +29,11 @@ class DefaultNameGenerator implements NameGeneratorInterface + public function generate(UuidInterface $ns, string $name, string $hashAlgorithm): string + { + /** @var string|bool $bytes */ +- $bytes = @hash($hashAlgorithm, $ns->getBytes() . $name, true); ++ try { ++ $bytes = @hash($hashAlgorithm, $ns->getBytes() . $name, true); ++ } catch (\ValueError $e) { ++ $bytes = false; // keep same behavior than PHP 7 */ ++ } + + if ($bytes === false) { + throw new NameException(sprintf( + +From 3a488f24e05e711809f61626aeb8740d53e56feb Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Thu, 29 Oct 2020 16:40:08 +0100 +Subject: [PATCH 2/2] CS + +--- + src/Generator/DefaultNameGenerator.php | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/Generator/DefaultNameGenerator.php b/src/Generator/DefaultNameGenerator.php +index be552b91..1c0b0048 100644 +--- a/src/Generator/DefaultNameGenerator.php ++++ b/src/Generator/DefaultNameGenerator.php +@@ -28,11 +28,11 @@ class DefaultNameGenerator implements NameGeneratorInterface + /** @psalm-pure */ + public function generate(UuidInterface $ns, string $name, string $hashAlgorithm): string + { +- /** @var string|bool $bytes */ + try { ++ /** @var string|bool $bytes */ + $bytes = @hash($hashAlgorithm, $ns->getBytes() . $name, true); + } catch (\ValueError $e) { +- $bytes = false; // keep same behavior than PHP 7 */ ++ $bytes = false; // keep same behavior than PHP 7 + } + + if ($bytes === false) { -- cgit