Skip to content

Commit c9c6518

Browse files
committed
Docs: Explicitly return null when documented instead of void in link-template.php functions.
The phpdoc `@return` tags for these functions indicate they may return `null`. This also fixes "Missing return argument" warnings which an IDE may also complain about. Developed in #8955 Props justlevine. See #64238. git-svn-id: https://develop.svn.wordpress.org/trunk@61281 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 9e2d045 commit c9c6518

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/wp-includes/link-template.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,13 +1082,13 @@ function edit_tag_link( $link = '', $before = '', $after = '', $tag = null ) {
10821082
function get_edit_term_link( $term, $taxonomy = '', $object_type = '' ) {
10831083
$term = get_term( $term, $taxonomy );
10841084
if ( ! $term || is_wp_error( $term ) ) {
1085-
return;
1085+
return null;
10861086
}
10871087

10881088
$tax = get_taxonomy( $term->taxonomy );
10891089
$term_id = $term->term_id;
10901090
if ( ! $tax || ! current_user_can( 'edit_term', $term_id ) ) {
1091-
return;
1091+
return null;
10921092
}
10931093

10941094
$args = array(
@@ -1410,7 +1410,7 @@ function get_preview_post_link( $post = null, $query_args = array(), $preview_li
14101410
$post = get_post( $post );
14111411

14121412
if ( ! $post ) {
1413-
return;
1413+
return null;
14141414
}
14151415

14161416
$post_type_object = get_post_type_object( $post->post_type );
@@ -1454,7 +1454,7 @@ function get_edit_post_link( $post = 0, $context = 'display' ) {
14541454
$post = get_post( $post );
14551455

14561456
if ( ! $post ) {
1457-
return;
1457+
return null;
14581458
}
14591459

14601460
if ( 'revision' === $post->post_type ) {
@@ -1468,11 +1468,11 @@ function get_edit_post_link( $post = 0, $context = 'display' ) {
14681468
$post_type_object = get_post_type_object( $post->post_type );
14691469

14701470
if ( ! $post_type_object ) {
1471-
return;
1471+
return null;
14721472
}
14731473

14741474
if ( ! current_user_can( 'edit_post', $post->ID ) ) {
1475-
return;
1475+
return null;
14761476
}
14771477

14781478
$link = '';

0 commit comments

Comments
 (0)