Conversation
|
Hello! 👋 Thanks for opening this pull request! Please check out our contributing guidelines. We appreciate you taking the initiative to contribute to this project. Contributing isn't limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation. Here are some useful Composer commands to get you started:
To run a single Behat test, you can use the following command: # Run all tests in a single file
composer behat features/some-feature.feature
# Run only a specific scenario (where 123 is the line number of the "Scenario:" title)
composer behat features/some-feature.feature:123You can find a list of all available Behat steps in our handbook. |
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Pull request overview
This PR is a follow-up to #303 that prevents Core_Command’s HTTP hook callbacks from being accidentally exposed as WP-CLI subcommands by making the callback methods private and registering them via closures.
Changes:
- Register
pre_http_requestandhttp_api_debughooks using closures instead of[$this, 'method']. - Change
capture_version_check_error()andcapture_version_check_error_from_response()visibility frompublictoprivate.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Code Review
This pull request successfully refactors the get_updates method to use closures for pre_http_request and http_api_debug hooks. This change correctly allows the capture_version_check_error and capture_version_check_error_from_response methods to be declared as private, improving encapsulation and preventing their accidental exposure as commands. The implementation correctly handles the addition and removal of these hooks using the closure variables, ensuring proper cleanup. This is a good improvement for the codebase's maintainability and adherence to object-oriented principles.
This is a follow-up to #303
Avoids accidentally adding a
wp core capture_version_check_errorcommand 😅