Skip to content

Commit ed12cfe

Browse files
committed
explain
1 parent ab334b9 commit ed12cfe

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

tests/Definitions/Child.php

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
use Square\Pjson\Json;
66
use Square\Pjson\JsonSerialize;
77

8+
/**
9+
* Keep properties in this exact order in this class. We want to confirm valid serialization when serializing `parent`
10+
* set that value to `null` but something further down needs to set a nested property there.
11+
*/
812
// phpcs:ignore PSR1.Classes.ClassDeclaration
913
class Child
1014
{

tests/SerializationTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,8 @@ public function testCollections()
290290

291291
public function testMissingParent()
292292
{
293+
// Ensure that while the `parent` object is null, we can still serialize the parent.id property which is
294+
// nested under `parent`.
293295
$data = new Child();
294296
$json = '{"identifier":null,"parent":{"id":null}}';
295297

0 commit comments

Comments
 (0)