Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
- '8.1'
- '8.2'
- '8.3'
- '8.4'
- '8.5'

name: using PHP ${{ matrix.php-versions }}
steps:
Expand Down
2 changes: 2 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
beStrictAboutChangesToGlobalState="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
displayDetailsOnAllIssues="true"
failOnAllIssues="true"
>
<testsuites>
<testsuite name="all">
Expand Down
10 changes: 7 additions & 3 deletions src/JsonMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)])
Expand Down
2 changes: 1 addition & 1 deletion tests/support/JsonMapperTest/Object.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/support/JsonMapperTest/PrivateWithSetter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down