From c41346baef6da05ee198a4db25f40c01662258c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Sun, 1 Mar 2015 18:38:38 +0100 Subject: [PATCH] [Serializer] Optimize GetSetMethodNormalizer and PropertyNormalizer --- .../Component/Serializer/Normalizer/GetSetMethodNormalizer.php | 2 +- .../Component/Serializer/Normalizer/PropertyNormalizer.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php index 348ab78bb267..b3111eaa1820 100644 --- a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php @@ -68,7 +68,7 @@ public function normalize($object, $format = null, array $context = array()) } $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)) { diff --git a/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php index b54187abb298..5acadde2e7e3 100644 --- a/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php @@ -64,7 +64,7 @@ public function normalize($object, $format = null, array $context = array()) $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)) {