Allow typed finder arguments after the $options array#16780
Allow typed finder arguments after the $options array#16780othercorey wants to merge 1 commit into4.nextfrom
Conversation
| * @param mixed ...$args Finder arguments | ||
| */ | ||
| public function find(string $type = 'all', array $options = []): Query | ||
| public function find(string $type = 'all', array $options = [], ...$args): Query |
There was a problem hiding this comment.
I don't know if overriding find() is actually supported. If so, this has to be cake 5 only.
There was a problem hiding this comment.
We need to maintain BC for the public method's signature. It's possible that someone has overridden this method.
There was a problem hiding this comment.
Ok, cake 5 it is.
There was a problem hiding this comment.
Users will most certainly have overridden find.
|
There's |
I definitely forgot it exists. |
|
There's also |
| * @throws \BadMethodCallException When the method is unknown. | ||
| */ | ||
| public function callFinder(string $type, array $args = []): Query | ||
| public function callFinder(string $type, ...$args): Query |
There was a problem hiding this comment.
Isn't this also changing the same of args as now options are the 0th element instead of the only thing?
There was a problem hiding this comment.
I'm not really sure why BehaviorRegistry was using an array originally. Maybe it was trying to mimic __call().
| * @param mixed ...$args Finder arguments | ||
| */ | ||
| public function find(string $type = 'all', array $options = []): Query | ||
| public function find(string $type = 'all', array $options = [], ...$args): Query |
There was a problem hiding this comment.
Users will most certainly have overridden find.
refs #12787
This does not try to make
$optionsoptional.