We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0a0b2ec commit 9210914Copy full SHA for 9210914
src/Common/Resource/AbstractResource.php
@@ -145,7 +145,13 @@ public function serialize(): \stdClass
145
$val = $this->{$name};
146
147
$fn = function ($val) {
148
- return ($val instanceof Serializable) ? $val->serialize() : $val;
+ if ($val instanceof Serializable) {
149
+ return $val->serialize();
150
+ } elseif ($val instanceof \DateTimeImmutable) {
151
+ return $val->format('c');
152
+ } else {
153
+ return $val;
154
+ }
155
};
156
157
if (is_array($val)) {
0 commit comments