Cache API: Address code quality issues with wp_cache_switch_to_blog().
This addresses 3 PHPStan errors at rule level 8: * `arguments.count`: Function `wp_cache_switch_to_blog_fallback()` invoked with 1 parameter, 0 required. * `method.nonObject`: Cannot call method `switch_to_blog()` on `class-string|object`. * `missingType.return`: Function `wp_cache_switch_to_blog()` has no return type specified. Developed as subset of https://github.com/WordPress/wordpress-develop/pull/11151 Follow-up to r61760. Props westonruter, johnjamesjacoby. See #23290, #64238. Built from https://develop.svn.wordpress.org/trunk@62028 git-svn-id: http://core.svn.wordpress.org/trunk@61310 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -327,11 +327,11 @@ if ( ! function_exists( 'wp_cache_switch_to_blog' ) ) :
|
||||
*
|
||||
* @param int $blog_id Site ID.
|
||||
*/
|
||||
function wp_cache_switch_to_blog( $blog_id ) {
|
||||
function wp_cache_switch_to_blog( $blog_id ): void {
|
||||
global $wp_object_cache;
|
||||
|
||||
// Attempt to use the drop-in object cache method if it exists.
|
||||
if ( method_exists( $wp_object_cache, 'switch_to_blog' ) ) {
|
||||
if ( is_object( $wp_object_cache ) && method_exists( $wp_object_cache, 'switch_to_blog' ) ) {
|
||||
$wp_object_cache->switch_to_blog( $blog_id );
|
||||
return;
|
||||
}
|
||||
@@ -340,6 +340,6 @@ if ( ! function_exists( 'wp_cache_switch_to_blog' ) ) :
|
||||
* Perform a fallback blog switch, which will reinitialize the caches
|
||||
* for the new blog ID.
|
||||
*/
|
||||
wp_cache_switch_to_blog_fallback( $blog_id );
|
||||
wp_cache_switch_to_blog_fallback();
|
||||
}
|
||||
endif;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '7.0-beta5-62027';
|
||||
$wp_version = '7.0-beta5-62028';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user