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

Skip to content

[PropertyAccess] Extract AccessInfoGuesser from PropertyAccessor #29342

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 1 commit into from
Closed

[PropertyAccess] Extract AccessInfoGuesser from PropertyAccessor #29342

wants to merge 1 commit into from

Conversation

fbourigault
Copy link
Contributor

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets ?
License MIT
Doc PR todo

This is an attempt to extract PropertyAccessor::getReadAccessInfo and PropertyAccessor::getWriteAccessInfo in a dedicated class.

This would allow:

WDYT?

@joelwurtz
Copy link
Contributor

This is something that i also proposed in #26613

IMO This should be in the property info component (but would add a dependcy here)

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.

I like the idea

use Symfony\Component\Cache\Adapter\NullAdapter;
use Symfony\Component\Inflector\Inflector;

final class AccessInfoGuesser
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should have an associated interface if marked final. And I agree that it would fit in PropertyInfo.

Copy link
Contributor Author

@fbourigault fbourigault Nov 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not enthusiast about moving this code to PropertyInfo because return value of getReadAccessInfo is really hard to use. You have many cases to handle to get things working the right way. Moreover, it would be hard to apply BC promise on such return type.

*
* @return array
*/
public function getReadAccessInfo($class, $property)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public function getReadAccessInfo($class, $property)
public function getReadAccessInfo(string $class, string $property): array

Typehint can be added everywhere because it's a new class.

@fbourigault
Copy link
Contributor Author

I'm closing this one as #29405 is the way I want to go to improve ObjectNormalizer performances at the moment.

@fbourigault fbourigault closed this Dec 1, 2018
@fbourigault fbourigault deleted the access-info-guesser branch December 1, 2018 15:47
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.3 Apr 30, 2019
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