Opened 4 years ago
Closed 4 years ago
#57047 closed defect (bug) (fixed)
Misleading PHPdoc for filter {$adjacent}_post_link
| Reported by: | apermo | Owned by: | SergeyBiryukov |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.2 |
| Component: | Posts, Post Types | Version: | 4.2 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | docs |
Description
The documentation for the filter {$adjacent}_post_link inside /wp-includes/link-template.php suggests that $post is a WP_Post.
The function get_adjacent_post() though will deliver an empty string if there is no adjacent post.
It is arguable if get_adjacent_post() shouldn't return null in that case, but nevertheless, in it's current state, the PHPdoc for the filter is misleading. If one uses these for typehinting, a fatal error will be thrown.
I've attached a patch, with my suggestion for an updated PHPdoc.
Attachments (1)
Change History (5)
#1
@
4 years ago
- Keywords has-patch added
- Version 6.1 → 4.2
Hello, thanks for the ticket and for the related patch,
Maybe we could use a similar wording than the one used in the get_adjacent_post() function?
Empty string if no corresponding post exists.
Updating the Version tag to 4.2 as this filter was added in this version.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Patch of the PHPdoc.