Skip to content

Commit d8d38bc

Browse files
committed
minor #20161 [Serializer] Normalizer Callback params confusion: $innerObject should be called $attributeValue and $outerObject should be just $object (thibaut22200)
This PR was submitted for the 7.2 branch but it was merged into the 5.4 branch instead. Discussion ---------- [Serializer] Normalizer Callback params confusion: $innerObject should be called $attributeValue and $outerObject should be just $object Closes #20080 Commits ------- c58aea4 Fix #20080
2 parents 1666a1c + c58aea4 commit d8d38bc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

components/serializer.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -799,8 +799,8 @@ When serializing, you can set a callback to format a specific object property::
799799
$encoder = new JsonEncoder();
800800

801801
// all callback parameters are optional (you can omit the ones you don't use)
802-
$dateCallback = function ($innerObject, $outerObject, string $attributeName, ?string $format = null, array $context = []) {
803-
return $innerObject instanceof \DateTime ? $innerObject->format(\DateTime::ATOM) : '';
802+
$dateCallback = function ($attributeValue, $object, string $attributeName, ?string $format = null, array $context = []) {
803+
return $attributeValue instanceof \DateTime ? $attributeValue->format(\DateTime::ATOM) : '';
804804
};
805805

806806
$defaultContext = [

0 commit comments

Comments
 (0)