[Serializer] Optimize GetSetMethodNormalizer and PropertyNormalizer
This commit is contained in:
parent
c498389f59
commit
c41346baef
@ -68,7 +68,7 @@ class GetSetMethodNormalizer extends AbstractNormalizer
|
||||
}
|
||||
|
||||
$attributeValue = $method->invoke($object);
|
||||
if (array_key_exists($attributeName, $this->callbacks)) {
|
||||
if (isset($this->callbacks[$attributeName])) {
|
||||
$attributeValue = call_user_func($this->callbacks[$attributeName], $attributeValue);
|
||||
}
|
||||
if (null !== $attributeValue && !is_scalar($attributeValue)) {
|
||||
|
@ -64,7 +64,7 @@ class PropertyNormalizer extends AbstractNormalizer
|
||||
|
||||
$attributeValue = $property->getValue($object);
|
||||
|
||||
if (array_key_exists($property->name, $this->callbacks)) {
|
||||
if (isset($this->callbacks[$property->name])) {
|
||||
$attributeValue = call_user_func($this->callbacks[$property->name], $attributeValue);
|
||||
}
|
||||
if (null !== $attributeValue && !is_scalar($attributeValue)) {
|
||||
|
Reference in New Issue
Block a user