[Serializer] Optimize GetSetMethodNormalizer and PropertyNormalizer

This commit is contained in:
Kévin Dunglas 2015-03-01 18:38:38 +01:00
parent c498389f59
commit c41346baef
2 changed files with 2 additions and 2 deletions

View File

@ -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)) {

View File

@ -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)) {