From 11691e8207ea24341a75c52f5777f09fa888ea28 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 11 Feb 2022 19:21:01 +0000 Subject: [PATCH] Docs: Improve `@return` tags for `wp_cache_*_multiple()` functions: * `wp_cache_add_multiple()` * `wp_cache_set_multiple()` * `wp_cache_get_multiple()` * `wp_cache_delete_multiple()` This aims to provide more details about the returned value types. Follow-up to [52700], [52702], [52703]. See #54729, #54574. Built from https://develop.svn.wordpress.org/trunk@52708 git-svn-id: http://core.svn.wordpress.org/trunk@52297 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/cache-compat.php | 12 ++++++++---- wp-includes/cache.php | 12 ++++++++---- wp-includes/class-wp-object-cache.php | 11 +++++++---- wp-includes/version.php | 2 +- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/wp-includes/cache-compat.php b/wp-includes/cache-compat.php index da4b9adee7..98f489931e 100644 --- a/wp-includes/cache-compat.php +++ b/wp-includes/cache-compat.php @@ -23,7 +23,8 @@ if ( ! function_exists( 'wp_cache_add_multiple' ) ) : * @param string $group Optional. Where the cache contents are grouped. Default empty. * @param int $expire Optional. When to expire the cache contents, in seconds. * Default 0 (no expiration). - * @return array Array of return values. + * @return bool[] Array of return values, grouped by key. Each value is either + * true on success, or false if cache key and group already exist. */ function wp_cache_add_multiple( array $data, $group = '', $expire = 0 ) { $values = array(); @@ -53,7 +54,8 @@ if ( ! function_exists( 'wp_cache_set_multiple' ) ) : * @param string $group Optional. Where the cache contents are grouped. Default empty. * @param int $expire Optional. When to expire the cache contents, in seconds. * Default 0 (no expiration). - * @return array Array of return values. + * @return bool[] Array of return values, grouped by key. Each value is either + * true on success, or false on failure. */ function wp_cache_set_multiple( array $data, $group = '', $expire = 0 ) { $values = array(); @@ -81,7 +83,8 @@ if ( ! function_exists( 'wp_cache_get_multiple' ) ) : * @param string $group Optional. Where the cache contents are grouped. Default empty. * @param bool $force Optional. Whether to force an update of the local cache * from the persistent cache. Default false. - * @return array Array of values organized into groups. + * @return array Array of return values, grouped by key. Each value is either + * the cache contents on success, or false on failure. */ function wp_cache_get_multiple( $keys, $group = '', $force = false ) { $values = array(); @@ -107,7 +110,8 @@ if ( ! function_exists( 'wp_cache_delete_multiple' ) ) : * * @param array $keys Array of keys under which the cache to deleted. * @param string $group Optional. Where the cache contents are grouped. Default empty. - * @return array Array of return values. + * @return bool[] Array of return values, grouped by key. Each value is either + * true on success, or false if the contents were not deleted. */ function wp_cache_delete_multiple( array $keys, $group = '' ) { $values = array(); diff --git a/wp-includes/cache.php b/wp-includes/cache.php index 67b791c584..b7e88efbd0 100644 --- a/wp-includes/cache.php +++ b/wp-includes/cache.php @@ -56,7 +56,8 @@ function wp_cache_add( $key, $data, $group = '', $expire = 0 ) { * @param string $group Optional. Where the cache contents are grouped. Default empty. * @param int $expire Optional. When to expire the cache contents, in seconds. * Default 0 (no expiration). - * @return array Array of return values. + * @return bool[] Array of return values, grouped by key. Each value is either + * true on success, or false if cache key and group already exist. */ function wp_cache_add_multiple( array $data, $group = '', $expire = 0 ) { global $wp_object_cache; @@ -122,7 +123,8 @@ function wp_cache_set( $key, $data, $group = '', $expire = 0 ) { * @param string $group Optional. Where the cache contents are grouped. Default empty. * @param int $expire Optional. When to expire the cache contents, in seconds. * Default 0 (no expiration). - * @return array Array of return values. + * @return bool[] Array of return values, grouped by key. Each value is either + * true on success, or false on failure. */ function wp_cache_set_multiple( array $data, $group = '', $expire = 0 ) { global $wp_object_cache; @@ -164,7 +166,8 @@ function wp_cache_get( $key, $group = '', $force = false, &$found = null ) { * @param string $group Optional. Where the cache contents are grouped. Default empty. * @param bool $force Optional. Whether to force an update of the local cache * from the persistent cache. Default false. - * @return array Array of values organized into groups. + * @return array Array of return values, grouped by key. Each value is either + * the cache contents on success, or false on failure. */ function wp_cache_get_multiple( $keys, $group = '', $force = false ) { global $wp_object_cache; @@ -200,7 +203,8 @@ function wp_cache_delete( $key, $group = '' ) { * * @param array $keys Array of keys under which the cache to deleted. * @param string $group Optional. Where the cache contents are grouped. Default empty. - * @return array Array of return values. + * @return bool[] Array of return values, grouped by key. Each value is either + * true on success, or false if the contents were not deleted. */ function wp_cache_delete_multiple( array $keys, $group = '' ) { global $wp_object_cache; diff --git a/wp-includes/class-wp-object-cache.php b/wp-includes/class-wp-object-cache.php index cc7b5850c5..89fd6ff011 100644 --- a/wp-includes/class-wp-object-cache.php +++ b/wp-includes/class-wp-object-cache.php @@ -188,7 +188,8 @@ class WP_Object_Cache { * @param string $group Optional. Where the cache contents are grouped. Default empty. * @param int $expire Optional. When to expire the cache contents, in seconds. * Default 0 (no expiration). - * @return array Array of return values. + * @return bool[] Array of return values, grouped by key. Each value is either + * true on success, or false if cache key and group already exist. */ public function add_multiple( array $data, $group = '', $expire = 0 ) { $values = array(); @@ -277,7 +278,7 @@ class WP_Object_Cache { * @param string $group Optional. Where the cache contents are grouped. Default empty. * @param int $expire Optional. When to expire the cache contents, in seconds. * Default 0 (no expiration). - * @return array Array of return values. + * @return bool[] Array of return values, grouped by key. Each value is always true. */ public function set_multiple( array $data, $group = '', $expire = 0 ) { $values = array(); @@ -341,7 +342,8 @@ class WP_Object_Cache { * @param string $group Optional. Where the cache contents are grouped. Default 'default'. * @param bool $force Optional. Whether to force an update of the local cache * from the persistent cache. Default false. - * @return array Array of values organized into groups. + * @return array Array of return values, grouped by key. Each value is either + * the cache contents on success, or false on failure. */ public function get_multiple( $keys, $group = 'default', $force = false ) { $values = array(); @@ -389,7 +391,8 @@ class WP_Object_Cache { * * @param array $keys Array of keys to be deleted. * @param string $group Optional. Where the cache contents are grouped. Default empty. - * @return array Array of return values. + * @return bool[] Array of return values, grouped by key. Each value is either + * true on success, or false if the contents were not deleted. */ public function delete_multiple( array $keys, $group = '' ) { $values = array(); diff --git a/wp-includes/version.php b/wp-includes/version.php index 06954bbd72..4eb5971729 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-alpha-52707'; +$wp_version = '6.0-alpha-52708'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.