[wp-trac] [WordPress Trac] #57047: Misleading PHPdoc for filter {$adjacent}_post_link

WordPress Trac noreply at wordpress.org
Wed Nov 9 15:00:07 UTC 2022


#57047: Misleading PHPdoc for filter {$adjacent}_post_link
-------------------------------+-----------------------------
 Reporter:  apermo             |      Owner:  (none)
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Posts, Post Types  |    Version:  6.1
 Severity:  normal             |   Keywords:
  Focuses:                     |
-------------------------------+-----------------------------
 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57047>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list