Skip to content

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

Merged
merged 2 commits into from
Jun 4, 2025

Conversation

LordSimal
Copy link
Contributor

@LordSimal LordSimal added this to the 6.0 milestone May 31, 2025
@@ -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
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Member

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.

Copy link
Contributor Author

@LordSimal LordSimal Jun 2, 2025

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 in 5.next
  • move current _execute() method contents to process() and call process() inside current _execute()
  • add deprecation warning to _execute()

Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

@ADmad ADmad Jun 2, 2025

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.

Copy link
Member

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.

Copy link
Member

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

Copy link
Member

@dereuromark dereuromark left a 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.

@LordSimal LordSimal marked this pull request as ready for review June 4, 2025 16:07
@LordSimal LordSimal merged commit 4e596aa into 6.x Jun 4, 2025
8 of 9 checks passed
@LordSimal LordSimal deleted the 6.x-rename-conflicting-underscored-methods branch June 4, 2025 16:08
@LordSimal
Copy link
Contributor Author

I'll add the docs for those changes right now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants