diff --git a/components/serializer.rst b/components/serializer.rst index f4f1a7ca123..aa0c3fd8c08 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -639,7 +639,7 @@ When serializing, you can set a callback to format a specific object property:: $encoder = new JsonEncoder(); // all callback parameters are optional (you can omit the ones you don't use) - $dateCallback = function ($innerObject, $outerObject, string $attributeName, string $format = null, array $context = []) { + $callback = function ($innerObject, $outerObject, string $attributeName, string $format = null, array $context = []) { return $innerObject instanceof \DateTime ? $innerObject->format(\DateTime::ISO8601) : ''; };