Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Closed
wants to merge 8 commits into from
Closed

[WIP][Serializer]Use PropertyInfo to extract properties #28775

wants to merge 8 commits into from

Conversation

fbourigault
Copy link
Contributor

@fbourigault fbourigault commented Oct 8, 2018

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets ?
License MIT
Doc PR symfony/symfony-docs#10530

This is a small refactoring to reduce the complexity of the ObjectNormalizer. It now use a PropertyListExtractorInterface to get the class properties list.

To achieve this, I also added a exclude_static_properties option to the ReflectionExtractor::getProperties method.

Starting from this PR, symfony/serializer has a hard dependency on symfony/property-info.

This was exposed by @dunglas in #19374 (comment).

To do

  • add a CHANGELOG.md entry.
  • documentation for exclude_static_properties.
  • check for performance regression.

Copy link
Member

@dunglas dunglas left a 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.

@@ -75,7 +77,7 @@ public function getProperties($class, array $context = array())

$properties = array();
foreach ($reflectionProperties as $reflectionProperty) {
if ($reflectionProperty->isPublic()) {
if ($reflectionProperty->isPublic() && (!($context[self::EXCLUDE_STATIC_PROPERTIES] ?? false) || !$reflectionProperty->isStatic())) {
Copy link
Member

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?

Copy link
Member

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.

@fbourigault fbourigault changed the title [Serializer]Use PropertyInfo to extract properties [WIP][Serializer]Use PropertyInfo to extract properties Dec 10, 2018
@fbourigault
Copy link
Contributor Author

I’m closing this PR because I don’t plan to work on it soon.

@fbourigault fbourigault closed this Aug 9, 2019
@nicolas-grekas nicolas-grekas removed this from the next milestone Oct 27, 2019
@nicolas-grekas nicolas-grekas added this to the 4.4 milestone Oct 27, 2019
@fbourigault fbourigault deleted the object-normalizer-property-list-extractor branch June 24, 2021 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants