minor #13819 [Serializer] Optimize GetSetMethodNormalizer and PropertyNormalizer (dunglas)

This PR was merged into the 2.7 branch.

Discussion
----------

[Serializer] Optimize GetSetMethodNormalizer and PropertyNormalizer

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Commits
-------

c41346b [Serializer] Optimize GetSetMethodNormalizer and PropertyNormalizer
This commit is contained in:
Fabien Potencier 2015-03-03 09:27:38 +01:00
commit 9efec600e0
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)) {