Skip to content

Commit 7724771

Browse files
committed
Merge branch 'master' of github.com:mpesari/jsonmapper into fork
2 parents 17294da + 3758139 commit 7724771

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

.github/workflows/phpunit.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
- '8.1'
2020
- '8.2'
2121
- '8.3'
22+
- '8.4'
23+
- '8.5'
2224

2325
name: using PHP ${{ matrix.php-versions }}
2426
steps:

phpunit.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
beStrictAboutChangesToGlobalState="true"
99
beStrictAboutOutputDuringTests="true"
1010
beStrictAboutTestsThatDoNotTestAnything="true"
11+
displayDetailsOnAllIssues="true"
12+
failOnAllIssues="true"
1113
>
1214
<testsuites>
1315
<testsuite name="all">

src/JsonMapper.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,9 @@ public function map($json, $object)
351351
$refDeserializePostMethod = $rc->getMethod(
352352
$this->postMappingMethod
353353
);
354-
$refDeserializePostMethod->setAccessible(true);
354+
if (\PHP_VERSION_ID < 80100) {
355+
$refDeserializePostMethod->setAccessible(true);
356+
}
355357
$refDeserializePostMethod->invoke(
356358
$object, ...$this->postMappingMethodArguments
357359
);
@@ -694,7 +696,9 @@ protected function setProperty(
694696
$object, $accessor, $value
695697
) {
696698
if (!$accessor->isPublic() && $this->bIgnoreVisibility) {
697-
$accessor->setAccessible(true);
699+
if (\PHP_VERSION_ID < 80100) {
700+
$accessor->setAccessible(true);
701+
}
698702
}
699703
if ($accessor instanceof ReflectionProperty) {
700704
$accessor->setValue($object, $value);
@@ -754,7 +758,7 @@ protected function createInstance(
754758
*/
755759
protected function getMappedType($type, $jvalue = null)
756760
{
757-
if (isset($this->classMap[$type])) {
761+
if (isset($this->classMap[$type ?? ''])) {
758762
$target = $this->classMap[$type];
759763
} else if (is_string($type) && $type !== '' && $type[0] == '\\'
760764
&& isset($this->classMap[substr($type, 1)])

tests/support/JsonMapperTest/Object.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class JsonMapperTest_Object
3131

3232
public $docblockNullableObject;
3333

34-
public function setNullableObject(JsonMapperTest_PlainObject $obj = null)
34+
public function setNullableObject(?JsonMapperTest_PlainObject $obj = null)
3535
{
3636
$this->nullableObject = $obj;
3737
}

tests/support/JsonMapperTest/PrivateWithSetter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function setPrivatePropertySetterWithoutDoc(int $privateProperty)
5252
return $this;
5353
}
5454

55-
public function setPrivatePropertyNullableSetterWithoutDoc(int $privateProperty = null)
55+
public function setPrivatePropertyNullableSetterWithoutDoc(?int $privateProperty = null)
5656
{
5757
$this->privatePropertyNullableSetterWithoutDoc = $privateProperty;
5858
return $this;

0 commit comments

Comments
 (0)