Skip to content

Commit d6b79f6

Browse files
committed
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 WordPress/wordpress-develop#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
1 parent aa6866b commit d6b79f6

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

wp-includes/cache-compat.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,11 @@ function wp_cache_set_multiple_salted( $data, $group, $salt, $expire = 0 ) {
327327
*
328328
* @param int $blog_id Site ID.
329329
*/
330-
function wp_cache_switch_to_blog( $blog_id ) {
330+
function wp_cache_switch_to_blog( $blog_id ): void {
331331
global $wp_object_cache;
332332

333333
// Attempt to use the drop-in object cache method if it exists.
334-
if ( method_exists( $wp_object_cache, 'switch_to_blog' ) ) {
334+
if ( is_object( $wp_object_cache ) && method_exists( $wp_object_cache, 'switch_to_blog' ) ) {
335335
$wp_object_cache->switch_to_blog( $blog_id );
336336
return;
337337
}
@@ -340,6 +340,6 @@ function wp_cache_switch_to_blog( $blog_id ) {
340340
* Perform a fallback blog switch, which will reinitialize the caches
341341
* for the new blog ID.
342342
*/
343-
wp_cache_switch_to_blog_fallback( $blog_id );
343+
wp_cache_switch_to_blog_fallback();
344344
}
345345
endif;

wp-includes/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @global string $wp_version
1818
*/
19-
$wp_version = '7.0-beta5-62027';
19+
$wp_version = '7.0-beta5-62028';
2020

2121
/**
2222
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

0 commit comments

Comments
 (0)