Skip to content

Commit 954c187

Browse files
committed
Code Quality: Explicitly return null when documented instead of void.
This fixes a PHPStan rule level 3 error: `return.empty`. Developed in #10995 Props huzaifaalmesbah, westonruter, shailu25, mukesh27, noruzzaman. See #64238. git-svn-id: https://develop.svn.wordpress.org/trunk@61716 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 84e5ace commit 954c187

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/wp-admin/includes/file.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2187,7 +2187,7 @@ function WP_Filesystem( $args = false, $context = false, $allow_relaxed_file_own
21872187
$abstraction_file = apply_filters( 'filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method );
21882188

21892189
if ( ! file_exists( $abstraction_file ) ) {
2190-
return;
2190+
return null;
21912191
}
21922192

21932193
require_once $abstraction_file;

src/wp-admin/includes/plugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ function delete_plugins( $plugins, $deprecated = '' ) {
926926
require_once ABSPATH . 'wp-admin/admin-footer.php';
927927
exit;
928928
}
929-
return;
929+
return null;
930930
}
931931

932932
if ( ! WP_Filesystem( $credentials ) ) {
@@ -941,7 +941,7 @@ function delete_plugins( $plugins, $deprecated = '' ) {
941941
require_once ABSPATH . 'wp-admin/admin-footer.php';
942942
exit;
943943
}
944-
return;
944+
return null;
945945
}
946946

947947
if ( ! is_object( $wp_filesystem ) ) {

src/wp-admin/includes/theme.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function delete_theme( $stylesheet, $redirect = '' ) {
4040
require_once ABSPATH . 'wp-admin/admin-footer.php';
4141
exit;
4242
}
43-
return;
43+
return null;
4444
}
4545

4646
if ( ! WP_Filesystem( $credentials ) ) {
@@ -55,7 +55,7 @@ function delete_theme( $stylesheet, $redirect = '' ) {
5555
require_once ABSPATH . 'wp-admin/admin-footer.php';
5656
exit;
5757
}
58-
return;
58+
return null;
5959
}
6060

6161
if ( ! is_object( $wp_filesystem ) ) {

src/wp-includes/category.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ function get_category_by_path( $category_path, $full_match = true, $output = OBJ
144144
);
145145

146146
if ( empty( $categories ) ) {
147-
return;
147+
return null;
148148
}
149149

150150
foreach ( $categories as $category ) {

0 commit comments

Comments
 (0)