summaryrefslogtreecommitdiffstats
path: root/352.patch
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2020-11-06 09:08:25 +0100
committerRemi Collet <remi@remirepo.net>2020-11-06 09:08:25 +0100
commit8c7da2fd4ea1c17e6d5578adb5777da9e720db21 (patch)
tree4e92542b55e8399fc96c42772fd74534be29729f /352.patch
parentb2c1e22019477e88ad09e9bf01ee729882505335 (diff)
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
Diffstat (limited to '352.patch')
-rw-r--r--352.patch54
1 files changed, 54 insertions, 0 deletions
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 <remi@remirepo.net>
+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 <remi@remirepo.net>
+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) {