[wp-trac] [WordPress Trac] #45597: Function does not return a value

WordPress Trac noreply at wordpress.org
Wed Dec 12 13:58:32 UTC 2018


#45597: Function does not return a value
------------------------------+-----------------------------
 Reporter:  subrataemfluence  |      Owner:  (none)
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  General           |    Version:  5.0
 Severity:  normal            |   Keywords:  dev-feedback
  Focuses:  coding-standards  |
------------------------------+-----------------------------
 Function `get_the_author_post_link()` has return type string but the
 following block of code does not return any value.


 {{{
 ...
 * @return string An HTML link to the author page.
 ...
 function get_the_author_posts_link() {
    ...
    if ( ! is_object( $authordata ) ) {
       return;
    }
    ...
 }
 }}}

 I think it could be rewritten as


 {{{
 if ( ! is_object( $authordata ) ) {
    return '';
 }
 }}}

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


More information about the wp-trac mailing list