From 4bb63506bb179d7b067318149d384f5469cd65ae Mon Sep 17 00:00:00 2001 From: Mikko Pesari Date: Thu, 27 Nov 2025 14:28:05 +0200 Subject: [PATCH 1/6] Fail phpunit tests on all issues --- phpunit.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpunit.xml b/phpunit.xml index 4f4420bf5..92e12bb2f 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -8,6 +8,8 @@ beStrictAboutChangesToGlobalState="true" beStrictAboutOutputDuringTests="true" beStrictAboutTestsThatDoNotTestAnything="true" + displayDetailsOnAllIssues="true" + failOnAllIssues="true" > From ea8f9831ac1c52370ac7edd94f60709144fd6228 Mon Sep 17 00:00:00 2001 From: Mikko Pesari Date: Thu, 27 Nov 2025 14:25:03 +0200 Subject: [PATCH 2/6] Run tests on PHP 8.4 --- .github/workflows/phpunit.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 230a53eaf..93c89117b 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -19,6 +19,7 @@ jobs: - '8.1' - '8.2' - '8.3' + - '8.4' name: using PHP ${{ matrix.php-versions }} steps: From dbf3d2b1e049aa9fb841dbe738165e9a3007a005 Mon Sep 17 00:00:00 2001 From: Mikko Pesari Date: Thu, 27 Nov 2025 14:31:14 +0200 Subject: [PATCH 3/6] Fix deprecated use of implicitly nullable parameters (PHP 8.4) https://www.php.net/manual/en/migration84.deprecated.php#migration84.deprecated.core.implicitly-nullable-parameter --- tests/support/JsonMapperTest/Object.php | 2 +- tests/support/JsonMapperTest/PrivateWithSetter.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/support/JsonMapperTest/Object.php b/tests/support/JsonMapperTest/Object.php index 3021255eb..544b972cf 100644 --- a/tests/support/JsonMapperTest/Object.php +++ b/tests/support/JsonMapperTest/Object.php @@ -31,7 +31,7 @@ class JsonMapperTest_Object public $docblockNullableObject; - public function setNullableObject(JsonMapperTest_PlainObject $obj = null) + public function setNullableObject(?JsonMapperTest_PlainObject $obj = null) { $this->nullableObject = $obj; } diff --git a/tests/support/JsonMapperTest/PrivateWithSetter.php b/tests/support/JsonMapperTest/PrivateWithSetter.php index 5256e5156..fce0b6ee6 100644 --- a/tests/support/JsonMapperTest/PrivateWithSetter.php +++ b/tests/support/JsonMapperTest/PrivateWithSetter.php @@ -52,7 +52,7 @@ public function setPrivatePropertySetterWithoutDoc(int $privateProperty) return $this; } - public function setPrivatePropertyNullableSetterWithoutDoc(int $privateProperty = null) + public function setPrivatePropertyNullableSetterWithoutDoc(?int $privateProperty = null) { $this->privatePropertyNullableSetterWithoutDoc = $privateProperty; return $this; From b348d9a54c1cd7a247c8a90ad9cac78637f290ea Mon Sep 17 00:00:00 2001 From: Mikko Pesari Date: Thu, 27 Nov 2025 14:31:52 +0200 Subject: [PATCH 4/6] Run tests on PHP 8.5 --- .github/workflows/phpunit.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 93c89117b..1250f72d7 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -20,6 +20,7 @@ jobs: - '8.2' - '8.3' - '8.4' + - '8.5' name: using PHP ${{ matrix.php-versions }} steps: From 75ecff7fe81c4bfe27634da158e6029d2f2545c7 Mon Sep 17 00:00:00 2001 From: Mikko Pesari Date: Thu, 27 Nov 2025 14:32:53 +0200 Subject: [PATCH 5/6] Fix deprecated use of null as array key (PHP 8.5) https://www.php.net/manual/en/migration85.deprecated.php#migration85.deprecated.core.using-null-as-an-array-offset --- src/JsonMapper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/JsonMapper.php b/src/JsonMapper.php index 25534d0a6..d4307b4c6 100644 --- a/src/JsonMapper.php +++ b/src/JsonMapper.php @@ -754,7 +754,7 @@ protected function createInstance( */ protected function getMappedType($type, $jvalue = null) { - if (isset($this->classMap[$type])) { + if (isset($this->classMap[$type ?? ''])) { $target = $this->classMap[$type]; } else if (is_string($type) && $type !== '' && $type[0] == '\\' && isset($this->classMap[substr($type, 1)]) From 37581394a0474d4c02780c64e59fabf61da9e863 Mon Sep 17 00:00:00 2001 From: Mikko Pesari Date: Thu, 27 Nov 2025 14:37:52 +0200 Subject: [PATCH 6/6] Fix deprecated use of Reflection setAccessible() (PHP 8.5) The method is noop since PHP 8.1.0 and deprecated since 8.5.0 https://www.php.net/manual/en/migration81.other-changes.php#migration81.other-changes.functions.reflection https://www.php.net/manual/en/migration85.deprecated.php#migration85.deprecated.reflection --- src/JsonMapper.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/JsonMapper.php b/src/JsonMapper.php index d4307b4c6..937d971be 100644 --- a/src/JsonMapper.php +++ b/src/JsonMapper.php @@ -351,7 +351,9 @@ public function map($json, $object) $refDeserializePostMethod = $rc->getMethod( $this->postMappingMethod ); - $refDeserializePostMethod->setAccessible(true); + if (\PHP_VERSION_ID < 80100) { + $refDeserializePostMethod->setAccessible(true); + } $refDeserializePostMethod->invoke( $object, ...$this->postMappingMethodArguments ); @@ -694,7 +696,9 @@ protected function setProperty( $object, $accessor, $value ) { if (!$accessor->isPublic() && $this->bIgnoreVisibility) { - $accessor->setAccessible(true); + if (\PHP_VERSION_ID < 80100) { + $accessor->setAccessible(true); + } } if ($accessor instanceof ReflectionProperty) { $accessor->setValue($object, $value);