-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Class methods hydrator skips getters with optional parameters #4496
Class methods hydrator skips getters with optional parameters #4496
Conversation
…meters/no paremeters
Fixes test @b47c85e045b185cec8fd6b95b6db2d3d4ddf2a5c
Travis failed because of some filesystem tests |
*/ | ||
public function filter($property) | ||
{ | ||
try { |
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.
In theory, this result could be cached in a private static property since the result depends only on reflection.
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.
So... do you want me to wait to merge until you've done that improvement as well?
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.
Will do it tomorrow then - otherwise fine? :)
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.
Overall, looks good! I think caching the value makes sense, though, and would like to see that in.
@@ -30,6 +30,11 @@ class ClassMethods extends AbstractHydrator implements HydratorOptionsInterface | |||
protected $underscoreSeparatedKeys = true; | |||
|
|||
/** | |||
* @var \Zend\Stdlib\Hydrator\Filter\FilterInterface | |||
*/ | |||
private $callableMethodFilter; |
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.
Why private?
…optional-parameters Class methods hydrator skips getters with optional parameters
…fix/class-methods-hydrator-optional-parameters Class methods hydrator skips getters with optional parameters
Currently,
Zend\Stdlib\Hydrator\ClassMethods
skips getters likegetFoo($bar = null)
as they have>0
parameters.This hotfix allows to call those methods as long as all parameters are optional.