-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[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
Conversation
This is something that i also proposed in #26613 IMO This should be in the property info component (but would add a dependcy here) |
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.
I like the idea
use Symfony\Component\Cache\Adapter\NullAdapter; | ||
use Symfony\Component\Inflector\Inflector; | ||
|
||
final class AccessInfoGuesser |
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.
Should have an associated interface if marked final. And I agree that it would fit in PropertyInfo.
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.
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) |
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.
public function getReadAccessInfo($class, $property) | |
public function getReadAccessInfo(string $class, string $property): array |
Typehint can be added everywhere because it's a new class.
I'm closing this one as #29405 is the way I want to go to improve |
This is an attempt to extract
PropertyAccessor::getReadAccessInfo
andPropertyAccessor::getWriteAccessInfo
in a dedicated class.This would allow:
PropertyAccessor
which will be faster than PSR-6 caching.WDYT?