Skip to content
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

Fix: All public methods in Command class are treated as a wpcli command #3320

Merged
merged 15 commits into from
Feb 27, 2023

Conversation

burhandodhy
Copy link
Contributor

@burhandodhy burhandodhy commented Feb 16, 2023

Description of the Change

This PR adds a new Helper class for WP CLI commands and move the public method to Helper class so that they will be not treated as CLI command

Closes #3193

How to test the Change

Changelog Entry

Fixed - All public methods in Command class are treated as a wpcli command

Credits

Props @burhandodhy

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@burhandodhy burhandodhy marked this pull request as ready for review February 16, 2023 12:18
Copy link
Member

@felipeelia felipeelia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@burhandodhy asked for some changes on this one. Although I'm not a fan of introducing a whole new class to fix the original problem, I also see it being valid to separate concerns... 🤔

includes/classes/Command.php Outdated Show resolved Hide resolved
includes/classes/Command.php Outdated Show resolved Hide resolved
includes/classes/Command/Utility.php Outdated Show resolved Hide resolved
includes/classes/Command/Utility.php Outdated Show resolved Hide resolved
Copy link
Member

@felipeelia felipeelia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to the small change that still needs to be done here @burhandodhy, do you mind fixing the git conflict that arose? Thanks.

tests/php/TestCommands.php Outdated Show resolved Hide resolved
Copy link
Member

@felipeelia felipeelia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@burhandodhy the conflict was not properly fixed (the new code was reverted.) So I took a deeper look into the code and it seems we still have some inconsistencies and breaking changes. Do you mind giving it another thorough review? Are you 100% sure this does not break any existing behavior including hooks? Thanks.

includes/classes/Command.php Outdated Show resolved Hide resolved
includes/classes/Command.php Outdated Show resolved Hide resolved
includes/classes/Command.php Outdated Show resolved Hide resolved
includes/classes/Command.php Outdated Show resolved Hide resolved
Copy link
Member

@felipeelia felipeelia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@burhandodhy we are almost there. There is a change that didn't seem to be pushed and also I just remembered we need to change the --remove parameter here.

tests/php/TestCommands.php Outdated Show resolved Hide resolved
@felipeelia felipeelia merged commit 4a1736b into develop Feb 27, 2023
@felipeelia felipeelia deleted the fix/3193 branch February 27, 2023 20:31
@felipeelia felipeelia added this to the 4.5.0 milestone Feb 27, 2023
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.

BUG: All public methods in Command class are treated as a wpcli command
2 participants