diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 230a53eaf..1250f72d7 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -19,6 +19,8 @@ jobs: - '8.1' - '8.2' - '8.3' + - '8.4' + - '8.5' name: using PHP ${{ matrix.php-versions }} steps: 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" > diff --git a/src/JsonMapper.php b/src/JsonMapper.php index 25534d0a6..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); @@ -754,7 +758,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)]) 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;