minor #17400 Use is_subclass_of instead of Reflection when possible (Ener-Getick)
This PR was merged into the 2.3 branch.
Discussion
----------
Use is_subclass_of instead of Reflection when possible
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
For performance reason, I replaced a reflection instantiation by ``is_subclass_of``
Commits
-------
51e3652
Use is_subclass_of instead of Reflection when possible
This commit is contained in:
commit
5c034adc5d
@ -59,8 +59,6 @@ class CustomNormalizer extends SerializerAwareNormalizer implements NormalizerIn
|
||||
*/
|
||||
public function supportsDenormalization($data, $type, $format = null)
|
||||
{
|
||||
$class = new \ReflectionClass($type);
|
||||
|
||||
return $class->isSubclassOf('Symfony\Component\Serializer\Normalizer\DenormalizableInterface');
|
||||
return is_subclass_of($type, 'Symfony\Component\Serializer\Normalizer\DenormalizableInterface');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user