Skip to content

Conversation

pfefferle
Copy link
Member

@pfefferle pfefferle commented Aug 26, 2025

Changed the return type documentation for follow methods to only return WP_Post or WP_Error. Improved error handling in Following::follow by returning a WP_Error if adding to outbox fails.

Fixes #2092

Proposed changes:

  • Updated docstring return types from int|false|\WP_Post|\WP_Error to \WP_Post|\WP_Error
  • Enhanced error handling in Following::follow to return a WP_Error when add_to_outbox fails

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • See tests.

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

Changed the return type documentation for follow methods to only return WP_Post or WP_Error. Improved error handling in Following::follow by returning a WP_Error if adding to outbox fails.
@pfefferle pfefferle self-assigned this Aug 26, 2025
@Copilot Copilot AI review requested due to automatic review settings August 26, 2025 16:38
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the return type documentation for follow methods to be more accurate and improves error handling by returning a WP_Error when adding to outbox fails.

  • Updated docstring return types from int|false|\WP_Post|\WP_Error to \WP_Post|\WP_Error
  • Enhanced error handling in Following::follow to return a WP_Error when add_to_outbox fails

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
includes/functions.php Updated docstring return type for the follow function
includes/collection/class-following.php Updated docstring return type and added error handling for failed outbox operations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@pfefferle pfefferle added the Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. label Aug 26, 2025
Deleted the .github/changelog/2094-from-description file as it is no longer needed.
Introduces a call to add_to_outbox when creating a follow activity, ensuring it is added with private visibility. This helps manage the visibility of follow actions and improves activity tracking.
Changed the example command from 'self-destruct' to 'self_destruct' in the class-cli.php file to reflect the correct command syntax.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] CLI [Feature] Collections Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify return types for Following::follow() method
2 participants