From a9775c45d8461138756fa164847fb2479dd898ea Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 23 Feb 2026 05:34:45 +0000 Subject: [PATCH] Code Quality: Explicitly return `null` when documented instead of `void`. This fixes a PHPStan rule level 3 error: `return.empty`. Developed in https://github.com/WordPress/wordpress-develop/pull/10995 Props huzaifaalmesbah, westonruter, shailu25, mukesh27, noruzzaman. See #64238. Built from https://develop.svn.wordpress.org/trunk@61716 git-svn-id: http://core.svn.wordpress.org/trunk@61024 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/file.php | 2 +- wp-admin/includes/plugin.php | 4 ++-- wp-admin/includes/theme.php | 4 ++-- wp-includes/category.php | 2 +- wp-includes/version.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index 09d080da2d..99dc03c6cd 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -2187,7 +2187,7 @@ function WP_Filesystem( $args = false, $context = false, $allow_relaxed_file_own $abstraction_file = apply_filters( 'filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method ); if ( ! file_exists( $abstraction_file ) ) { - return; + return null; } require_once $abstraction_file; diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index 460874ca52..fae10f1a67 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -926,7 +926,7 @@ function delete_plugins( $plugins, $deprecated = '' ) { require_once ABSPATH . 'wp-admin/admin-footer.php'; exit; } - return; + return null; } if ( ! WP_Filesystem( $credentials ) ) { @@ -941,7 +941,7 @@ function delete_plugins( $plugins, $deprecated = '' ) { require_once ABSPATH . 'wp-admin/admin-footer.php'; exit; } - return; + return null; } if ( ! is_object( $wp_filesystem ) ) { diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php index 8fa5d06a16..ef5793b7dd 100644 --- a/wp-admin/includes/theme.php +++ b/wp-admin/includes/theme.php @@ -40,7 +40,7 @@ function delete_theme( $stylesheet, $redirect = '' ) { require_once ABSPATH . 'wp-admin/admin-footer.php'; exit; } - return; + return null; } if ( ! WP_Filesystem( $credentials ) ) { @@ -55,7 +55,7 @@ function delete_theme( $stylesheet, $redirect = '' ) { require_once ABSPATH . 'wp-admin/admin-footer.php'; exit; } - return; + return null; } if ( ! is_object( $wp_filesystem ) ) { diff --git a/wp-includes/category.php b/wp-includes/category.php index d1c43274d7..8fb6b1c547 100644 --- a/wp-includes/category.php +++ b/wp-includes/category.php @@ -144,7 +144,7 @@ function get_category_by_path( $category_path, $full_match = true, $output = OBJ ); if ( empty( $categories ) ) { - return; + return null; } foreach ( $categories as $category ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 375ace1013..1cb2457555 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '7.0-beta1-61715'; +$wp_version = '7.0-beta1-61716'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.