-
Notifications
You must be signed in to change notification settings - Fork 3.4k
6.x: rename conflicting underscored methods #18707
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
@@ -274,7 +274,7 @@ public function execute(array $data, array $options = []): bool | |||
* @param array $data Form data. | |||
* @return bool | |||
*/ | |||
protected function _execute(array $data): bool | |||
protected function process(array $data): bool |
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.
This will have to be explicitly mentioned in the migration docs as this method is meant to be overridden by user forms.
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.
that is my plan after this is all merged
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.
If we wanted to, we could deprecated this in cake 5 and check if _execute() is declared in a derived class or not.
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.
Is Form::_execute()
the only method we want to deprecate this way or do want to do that for all the other methods as well? Meaning:
- add
process()
method in5.next
- move current
_execute()
method contents toprocess()
and callprocess()
inside current_execute()
- add deprecation warning to
_execute()
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.
Any with extension point (likely to be existing on app/plugin side).
Afaik that only fits this one method, right?
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.
At least for these methods changed in here I don't see any as well.
But there are (probably) others which just have a removed _
so we can do that for those 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.
Is Form::_execute() the only method we want to deprecate this way or do want to do that for all the other methods as well?
I can't think of any other method currently, we don't need to go about doing similar for other protected methods. It's required for this one as it's specifically meant to be overridden in app code and documented as such.
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.
We could always do a method_exists
and call the _execute()
method if it exists for backwards compatibility. It would also give us a spot to trigger a deprecation.
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.
It's already been handled for 5.next :)
#18725
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.
We can now squash merge this already I guess.
I'll add the docs for those changes right now |
Refs: cakephp/upgrade#313 and #18687