Skip to content

Commit 7694ebf

Browse files
committed
Fix "creation of dynamic property" deprecation notices
with PHP 8.2
1 parent a725007 commit 7694ebf

File tree

5 files changed

+14
-2
lines changed

5 files changed

+14
-2
lines changed

tests/OtherTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,12 @@ public function testUndefinedPropertyHandler()
187187
new JsonMapperTest_Broken()
188188
);
189189

190-
$this->assertSame(123, $sn->ADDundefinedProperty);
190+
$this->assertSame(123, $sn->store['undefinedProperty']);
191191
}
192192

193193
public function setUnknownProperty($object, $propName, $jsonValue)
194194
{
195-
$object->{'ADD' . $propName} = $jsonValue;
195+
$object->store[$propName] = $jsonValue;
196196
}
197197

198198
public function testPrivatePropertyWithPublicSetter()

tests/support/JsonMapperTest/Broken.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,7 @@ class JsonMapperTest_Broken
3131
* @required
3232
*/
3333
public $pMissingData;
34+
35+
public $store;
3436
}
3537
?>

tests/support/JsonMapperTest/Object.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ class JsonMapperTest_Object
2727
*/
2828
public $pString;
2929

30+
public $nullableObject;
31+
32+
public $docblockNullableObject;
33+
3034
public function setNullableObject(JsonMapperTest_PlainObject $obj = null)
3135
{
3236
$this->nullableObject = $obj;

tests/support/JsonMapperTest/PHP7Object.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
class JsonMapperTest_PHP7Object
44
{
5+
public $nonNullableObject;
6+
7+
public $typeNullableObject;
8+
59
public function setTypeNullableObject(?JsonMapperTest_PlainObject $obj)
610
{
711
$this->typeNullableObject = $obj;

tests/support/JsonMapperTest/Simple.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
*/
2121
class JsonMapperTest_Simple
2222
{
23+
public $db;
24+
2325
/**
2426
* @var bool
2527
*/

0 commit comments

Comments
 (0)