Docs: In various `@return` tags, list the expected type first, instead of `false` or `WP_Error`.

Follow-up to [46696], [47060], [49926], [49927].

See #51800.
Built from https://develop.svn.wordpress.org/trunk@49929


git-svn-id: http://core.svn.wordpress.org/trunk@49628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-01-04 17:18:04 +00:00
parent f4d610310c
commit 37662df05e
17 changed files with 26 additions and 27 deletions

View File

@ -306,7 +306,7 @@ class WP_Community_Events {
* @since 4.8.0
*
* @param array $location Should contain 'latitude' and 'longitude' indexes.
* @return false|string false on failure, or a string on success.
* @return string|false Transient key on success, false on failure.
*/
protected function get_events_transient_key( $location ) {
$key = false;

View File

@ -128,7 +128,7 @@ function get_real_file_to_edit( $file ) {
* @param int $parent Optional. Parent ID to retrieve categories for. Default 0.
* @param int $level Optional. Number of levels deep to display. Default 0.
* @param array $categories Optional. Categories to include in the control. Default 0.
* @return false|void False if no categories were found.
* @return void|false False if no categories were found.
*/
function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
_deprecated_function( __FUNCTION__, '3.0.0', 'wp_dropdown_categories()' );

View File

@ -130,7 +130,7 @@ function get_home_path() {
* @param string $folder Optional. Full path to folder. Default empty.
* @param int $levels Optional. Levels of folders to follow, Default 100 (PHP Loop limit).
* @param string[] $exclusions Optional. List of folders and files to skip.
* @return false|string[] False on failure, else array of files.
* @return string[]|false Array of files on success, false on failure.
*/
function list_files( $folder = '', $levels = 100, $exclusions = array() ) {
if ( empty( $folder ) ) {

View File

@ -680,7 +680,7 @@ function wp_exif_date2ts( $str ) {
* @since 2.5.0
*
* @param string $file
* @return false|array False on failure. Image metadata array on success.
* @return array|false Image metadata array on success, false on failure.
*/
function wp_read_image_metadata( $file ) {
if ( ! file_exists( $file ) ) {

View File

@ -311,7 +311,7 @@ function upload_space_setting( $id ) {
* @since 3.0.0
*
* @param int $id The user ID.
* @return false|int The ID of the refreshed user or false if the user does not exist.
* @return int|false The ID of the refreshed user or false if the user does not exist.
*/
function refresh_user_details( $id ) {
$id = (int) $id;

View File

@ -194,7 +194,7 @@ final class WP_Hook implements Iterator, ArrayAccess {
*
* @param string $tag Optional. The name of the filter hook. Default empty.
* @param callable|false $function_to_check Optional. The callback to check for. Default false.
* @return int|bool If `$function_to_check` is omitted, returns boolean for whether the hook has
* @return bool|int If `$function_to_check` is omitted, returns boolean for whether the hook has
* anything registered. When checking a specific function, the priority of that
* hook is returned, or false if the function is not attached.
*/

View File

@ -289,7 +289,7 @@ When seeking help with this issue, you may be asked for some of the following in
* @since 5.3.0
*
* @param array $extension The extension that caused the error.
* @return false|array A plugin array {@see get_plugins()} or `false` if no plugin was found.
* @return array|false A plugin array {@see get_plugins()} or `false` if no plugin was found.
*/
private function get_plugin( $extension ) {
if ( ! function_exists( 'get_plugins' ) ) {

View File

@ -754,7 +754,7 @@ function spawn_cron( $gmt_time = 0 ) {
* @since 2.1.0
* @since 5.1.0 Return value added to indicate success or failure.
*
* @return false|int On success an integer indicating number of events spawned (0 indicates no
* @return int|false On success an integer indicating number of events spawned (0 indicates no
* events needed to be spawned), false if spawning fails for one or more events.
*/
function wp_cron() {

View File

@ -938,7 +938,7 @@ function do_enclose( $content, $post ) {
*
* @param string $url URL to retrieve HTTP headers from.
* @param bool $deprecated Not Used.
* @return false|string False on failure, headers on success.
* @return string|false Headers on success, false on failure.
*/
function wp_get_http_headers( $url, $deprecated = false ) {
if ( ! empty( $deprecated ) ) {
@ -6914,7 +6914,7 @@ function mysql_to_rfc3339( $date_string ) {
* 'image', or an arbitrary other context. If an arbitrary context is passed,
* the similarly arbitrary {@see '$context_memory_limit'} filter will be
* invoked. Default 'admin'.
* @return false|int|string The limit that was set or false on failure.
* @return int|string|false The limit that was set or false on failure.
*/
function wp_raise_memory_limit( $context = 'admin' ) {
// Exit early if the limit cannot be changed.

View File

@ -132,7 +132,7 @@ function add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1
*
* @param string $tag The name of the filter hook.
* @param callable|false $function_to_check Optional. The callback to check for. Default false.
* @return int|bool If `$function_to_check` is omitted, returns boolean for whether the hook has
* @return bool|int If `$function_to_check` is omitted, returns boolean for whether the hook has
* anything registered. When checking a specific function, the priority of that
* hook is returned, or false if the function is not attached.
*/
@ -565,7 +565,7 @@ function do_action_ref_array( $tag, $args ) {
*
* @param string $tag The name of the action hook.
* @param callable|false $function_to_check Optional. The callback to check for. Default false.
* @return int|bool If `$function_to_check` is omitted, returns boolean for whether the hook has
* @return bool|int If `$function_to_check` is omitted, returns boolean for whether the hook has
* anything registered. When checking a specific function, the priority of that
* hook is returned, or false if the function is not attached.
*/

View File

@ -5060,7 +5060,7 @@ function get_enclosed( $post_id ) {
* @since 4.7.0 `$post_id` can be a WP_Post object.
*
* @param int|WP_Post $post_id Post ID or object.
* @return false|string[] Array of URLs already pinged for the given post, false if the post is not found.
* @return string[]|false Array of URLs already pinged for the given post, false if the post is not found.
*/
function get_pung( $post_id ) {
$post = get_post( $post_id );

View File

@ -50,7 +50,7 @@ class WP_REST_Block_Directory_Controller extends WP_REST_Controller {
*
* @param WP_REST_Request $request Full details about the request.
*
* @return WP_Error|true True if the request has permission, WP_Error object otherwise.
* @return true|WP_Error True if the request has permission, WP_Error object otherwise.
*/
public function get_items_permissions_check( $request ) {
if ( ! current_user_can( 'install_plugins' ) || ! current_user_can( 'activate_plugins' ) ) {
@ -71,7 +71,7 @@ class WP_REST_Block_Directory_Controller extends WP_REST_Controller {
*
* @param WP_REST_Request $request Full details about the request.
*
* @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.
* @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/
public function get_items( $request ) {
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
@ -115,7 +115,7 @@ class WP_REST_Block_Directory_Controller extends WP_REST_Controller {
* @param array $plugin The plugin metadata.
* @param WP_REST_Request $request Request object.
*
* @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.
* @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/
public function prepare_item_for_response( $plugin, $request ) {
// There might be multiple blocks in a plugin. Only the first block is mapped.

View File

@ -114,7 +114,7 @@ class WP_REST_Block_Types_Controller extends WP_REST_Controller {
* @since 5.5.0
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|true True if the request has read access, WP_Error object otherwise.
* @return true|WP_Error True if the request has read access, WP_Error object otherwise.
*/
public function get_items_permissions_check( $request ) {
return $this->check_read_permission();
@ -126,7 +126,7 @@ class WP_REST_Block_Types_Controller extends WP_REST_Controller {
* @since 5.5.0
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.
* @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/
public function get_items( $request ) {
$data = array();
@ -160,7 +160,7 @@ class WP_REST_Block_Types_Controller extends WP_REST_Controller {
* @since 5.5.0
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|true True if the request has read access for the item, WP_Error object otherwise.
* @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise.
*/
public function get_item_permissions_check( $request ) {
$check = $this->check_read_permission();
@ -181,7 +181,7 @@ class WP_REST_Block_Types_Controller extends WP_REST_Controller {
*
* @since 5.5.0
*
* @return WP_Error|true True if the block type is visible, WP_Error otherwise.
* @return true|WP_Error True if the block type is visible, WP_Error otherwise.
*/
protected function check_read_permission() {
if ( current_user_can( 'edit_posts' ) ) {
@ -219,7 +219,7 @@ class WP_REST_Block_Types_Controller extends WP_REST_Controller {
* @since 5.5.0
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.
* @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/
public function get_item( $request ) {
$block_name = sprintf( '%s/%s', $request['namespace'], $request['name'] );

View File

@ -403,8 +403,8 @@ if ( !function_exists('fetch_rss') ) :
* @package External
* @subpackage MagpieRSS
*
* @param string $url URL to retrieve feed
* @return false|MagpieRSS false on failure or MagpieRSS object on success.
* @param string $url URL to retrieve feed.
* @return MagpieRSS|false MagpieRSS object on success, false on failure.
*/
function fetch_rss ($url) {
// initialize constants

View File

@ -743,8 +743,7 @@ function unregister_taxonomy_for_object_type( $taxonomy, $object_type ) {
* @param int|array $term_ids Term ID or array of term IDs of terms that will be used.
* @param string|array $taxonomies String of taxonomy name or Array of string values of taxonomy names.
* @param array|string $args Change the order of the object_ids, either ASC or DESC.
* @return WP_Error|array If the taxonomy does not exist, then WP_Error will be returned. On success.
* the array can be empty meaning that there are no $object_ids found or it will return the $object_ids found.
* @return array|WP_Error An array of $object_ids on success, WP_Error if the taxonomy does not exist.
*/
function get_objects_in_term( $term_ids, $taxonomies, $args = array() ) {
global $wpdb;

View File

@ -1537,7 +1537,7 @@ function sanitize_user_field( $field, $value, $user_id, $context ) {
* @since 3.0.0
*
* @param object|WP_User $user User object or database row to be cached
* @return false|void Returns false on failure.
* @return void|false Returns false on failure.
*/
function update_user_caches( $user ) {
if ( $user instanceof WP_User ) {

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.7-alpha-49928';
$wp_version = '5.7-alpha-49929';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.