In `cache.php`, clarify some `return` docs. Some `WP_Object_Cache` methods return `void`, so those wrapper functions don't need to return at all.

See #32444.


git-svn-id: https://develop.svn.wordpress.org/trunk@32528 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-05-21 20:21:22 +00:00
parent 4eb97de4cf
commit 63ab0981fc
1 changed files with 11 additions and 10 deletions

View File

@ -37,7 +37,7 @@ function wp_cache_add( $key, $data, $group = '', $expire = 0 ) {
* *
* @since 2.0.0 * @since 2.0.0
* *
* @return bool Always returns True * @return true Always returns True
*/ */
function wp_cache_close() { function wp_cache_close() {
return true; return true;
@ -105,7 +105,7 @@ function wp_cache_flush() {
* @param bool $force Whether to force an update of the local cache from the persistent cache (default is false) * @param bool $force Whether to force an update of the local cache from the persistent cache (default is false)
* @param bool &$found Whether key was found in the cache. Disambiguates a return of false, a storable value. * @param bool &$found Whether key was found in the cache. Disambiguates a return of false, a storable value.
* @return bool|mixed False on failure to retrieve contents or the cache * @return bool|mixed False on failure to retrieve contents or the cache
* contents on success * contents on success
*/ */
function wp_cache_get( $key, $group = '', $force = false, &$found = null ) { function wp_cache_get( $key, $group = '', $force = false, &$found = null ) {
global $wp_object_cache; global $wp_object_cache;
@ -135,7 +135,8 @@ function wp_cache_incr( $key, $offset = 1, $group = '' ) {
* Sets up Object Cache Global and assigns it. * Sets up Object Cache Global and assigns it.
* *
* @since 2.0.0 * @since 2.0.0
* @global WP_Object_Cache $wp_object_cache WordPress Object Cache * @global $wp_object_cache WordPress Object Cache instance
* @uses WP_Object_Cache
*/ */
function wp_cache_init() { function wp_cache_init() {
$GLOBALS['wp_object_cache'] = new WP_Object_Cache(); $GLOBALS['wp_object_cache'] = new WP_Object_Cache();
@ -192,7 +193,7 @@ function wp_cache_set( $key, $data, $group = '', $expire = 0 ) {
function wp_cache_switch_to_blog( $blog_id ) { function wp_cache_switch_to_blog( $blog_id ) {
global $wp_object_cache; global $wp_object_cache;
return $wp_object_cache->switch_to_blog( $blog_id ); $wp_object_cache->switch_to_blog( $blog_id );
} }
/** /**
@ -205,7 +206,7 @@ function wp_cache_switch_to_blog( $blog_id ) {
function wp_cache_add_global_groups( $groups ) { function wp_cache_add_global_groups( $groups ) {
global $wp_object_cache; global $wp_object_cache;
return $wp_object_cache->add_global_groups( $groups ); $wp_object_cache->add_global_groups( $groups );
} }
/** /**
@ -239,7 +240,7 @@ function wp_cache_reset() {
global $wp_object_cache; global $wp_object_cache;
return $wp_object_cache->reset(); $wp_object_cache->reset();
} }
/** /**
@ -499,8 +500,8 @@ class WP_Object_Cache {
* @param int|string $key What the contents in the cache are called * @param int|string $key What the contents in the cache are called
* @param string $group Where the cache contents are grouped * @param string $group Where the cache contents are grouped
* @param string $force Whether to force a refetch rather than relying on the local cache (default is false) * @param string $force Whether to force a refetch rather than relying on the local cache (default is false)
* @return bool|mixed False on failure to retrieve contents or the cache * @return false|mixed False on failure to retrieve contents or the cache
* contents on success * contents on success
*/ */
public function get( $key, $group = 'default', $force = false, &$found = null ) { public function get( $key, $group = 'default', $force = false, &$found = null ) {
if ( empty( $group ) ) if ( empty( $group ) )
@ -616,7 +617,7 @@ class WP_Object_Cache {
* @param mixed $data The contents to store in the cache * @param mixed $data The contents to store in the cache
* @param string $group Where to group the cache contents * @param string $group Where to group the cache contents
* @param int $expire Not Used * @param int $expire Not Used
* @return bool Always returns true * @return true Always returns true
*/ */
public function set( $key, $data, $group = 'default', $expire = 0 ) { public function set( $key, $data, $group = 'default', $expire = 0 ) {
if ( empty( $group ) ) if ( empty( $group ) )
@ -706,7 +707,7 @@ class WP_Object_Cache {
* *
* @since 2.0.8 * @since 2.0.8
* *
* @return bool True value. Won't be used by PHP * @return true True value. Won't be used by PHP
*/ */
public function __destruct() { public function __destruct() {
return true; return true;