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:
commit
9efec600e0
@ -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