From ece85d818493016243835467dac2fce52e7ceee3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Anne?= <cedric.anne@gmail.com>
Date: Mon, 29 Jul 2024 09:14:15 +0200
Subject: [PATCH] Add PHP 8.4 support

- Explicitly mark nullable parameter
- Drop support of PHP < 7.1
---
 .github/workflows/test-unit.yml           | 2 +-
 composer.json                             | 5 +++--
 composer.lock                             | 9 +++++----
 src/InvalidFieldTypeException.php         | 2 +-
 src/MissingFieldException.php             | 2 +-
 src/PatchTestOperationFailedException.php | 2 +-
 src/PathException.php                     | 2 +-
 src/UnknownOperationException.php         | 2 +-
 8 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml
index 5696582..e0eaffe 100644
--- a/.github/workflows/test-unit.yml
+++ b/.github/workflows/test-unit.yml
@@ -11,7 +11,7 @@ jobs:
     strategy:
       matrix:
         operating-system: [ 'ubuntu-latest' ]
-        php-versions: [ '5.6', '7.0', '7.1', '7.2', '7.3', '8.0', '8.1' ]
+        php-versions: [ '7.1', '7.2', '7.3', '8.0', '8.1', '8.2', '8.3', '8.4' ]
     steps:
       - name: Checkout
         uses: actions/checkout@v2
diff --git a/composer.json b/composer.json
index 9a47543..a60b713 100644
--- a/composer.json
+++ b/composer.json
@@ -10,7 +10,8 @@
     }
   ],
   "require": {
-    "ext-json": "*"
+    "ext-json": "*",
+    "php": ">=7.1"
   },
   "require-dev": {
     "phperf/phpunit": "4.8.37"
@@ -27,7 +28,7 @@
   },
   "config": {
     "platform": {
-      "php": "5.4.45"
+      "php": "7.1.33"
     }
   }
 }
diff --git a/composer.lock b/composer.lock
index 68f0854..4dbc976 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "5713f54bfb717ba8d7193fc9e26a07d5",
+    "content-hash": "2db765b5376b2444b02b18922950f0d3",
     "packages": [],
     "packages-dev": [
         {
@@ -1138,11 +1138,12 @@
     "prefer-stable": false,
     "prefer-lowest": false,
     "platform": {
-        "ext-json": "*"
+        "ext-json": "*",
+        "php": ">=7.1"
     },
     "platform-dev": [],
     "platform-overrides": {
-        "php": "5.4.45"
+        "php": "7.1.33"
     },
-    "plugin-api-version": "2.3.0"
+    "plugin-api-version": "2.6.0"
 }
diff --git a/src/InvalidFieldTypeException.php b/src/InvalidFieldTypeException.php
index d807046..37b45bc 100644
--- a/src/InvalidFieldTypeException.php
+++ b/src/InvalidFieldTypeException.php
@@ -27,7 +27,7 @@ public function __construct(
         $expectedType,
         $operation,
         $code = 0,
-        Throwable $previous = null
+        ?Throwable $previous = null
     )
     {
         parent::__construct(
diff --git a/src/MissingFieldException.php b/src/MissingFieldException.php
index ab87967..d9e746e 100644
--- a/src/MissingFieldException.php
+++ b/src/MissingFieldException.php
@@ -22,7 +22,7 @@ public function __construct(
         $missingField,
         $operation,
         $code = 0,
-        Throwable $previous = null
+        ?Throwable $previous = null
     )
     {
         parent::__construct('Missing "' . $missingField . '" in operation data', $code, $previous);
diff --git a/src/PatchTestOperationFailedException.php b/src/PatchTestOperationFailedException.php
index 7204b7c..d668110 100644
--- a/src/PatchTestOperationFailedException.php
+++ b/src/PatchTestOperationFailedException.php
@@ -23,7 +23,7 @@ public function __construct(
         $operation,
         $actualValue,
         $code = 0,
-        Throwable $previous = null
+        ?Throwable $previous = null
     )
     {
         parent::__construct('Test operation ' . json_encode($operation, JSON_UNESCAPED_SLASHES)
diff --git a/src/PathException.php b/src/PathException.php
index 6d54fe4..2f2d6d4 100644
--- a/src/PathException.php
+++ b/src/PathException.php
@@ -29,7 +29,7 @@ public function __construct(
         $operation,
         $field,
         $code = 0,
-        Throwable $previous = null
+        ?Throwable $previous = null
     )
     {
         parent::__construct($message, $code, $previous);
diff --git a/src/UnknownOperationException.php b/src/UnknownOperationException.php
index 8d35abb..c0357b7 100644
--- a/src/UnknownOperationException.php
+++ b/src/UnknownOperationException.php
@@ -19,7 +19,7 @@ class UnknownOperationException extends Exception
     public function __construct(
         $operation,
         $code = 0,
-        Throwable $previous = null
+        ?Throwable $previous = null
     )
     {
         // @phpstan-ignore-next-line MissingFieldOperation will be thrown if op is not set