-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[WIP][Serializer]Use PropertyInfo to extract properties #28775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP][Serializer]Use PropertyInfo to extract properties #28775
Conversation
dunglas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, it will allow to dramatically simplify the component, then to improve its performance.
src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php
Outdated
Show resolved
Hide resolved
| $properties = array(); | ||
| foreach ($reflectionProperties as $reflectionProperty) { | ||
| if ($reflectionProperty->isPublic()) { | ||
| if ($reflectionProperty->isPublic() && (!($context[self::EXCLUDE_STATIC_PROPERTIES] ?? false) || !$reflectionProperty->isStatic())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It almost looks like a bug to me that we used to include static properties. I would like to change the default behavior and add a flag to include static props instead, but it's maybe to late (BC break). WDYT @symfony/deciders?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I am afraid changing that would be a BC break.
src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php
Outdated
Show resolved
Hide resolved
…clude public static properties
|
I’m closing this PR because I don’t plan to work on it soon. |
This is a small refactoring to reduce the complexity of the ObjectNormalizer. It now use a
PropertyListExtractorInterfaceto get the class properties list.To achieve this, I also added a
exclude_static_propertiesoption to theReflectionExtractor::getPropertiesmethod.Starting from this PR,
symfony/serializerhas a hard dependency onsymfony/property-info.This was exposed by @dunglas in #19374 (comment).
To do
exclude_static_properties.