Skip to content

Commit

Permalink
minor #13819 [Serializer] Optimize GetSetMethodNormalizer and Propert…
Browse files Browse the repository at this point in the history
…yNormalizer (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
  • Loading branch information
fabpot committed Mar 3, 2015
2 parents c491332 + c41346b commit 9efec60
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -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)) {
Expand Down
Expand Up @@ -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)) {
Expand Down

0 comments on commit 9efec60

Please sign in to comment.