summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorSergey Biryukov <sergeybiryukov@git.wordpress.org>2021-01-04 17:16:43 +0000
committerSergey Biryukov <sergeybiryukov@git.wordpress.org>2021-01-04 17:16:43 +0000
commit715daf875a1cf7853d3403e388ee35cc939010d1 (patch)
tree0497576209943ccaf5100788e6155b5e28962e69
parent7bd678a553114bee22154718bcd24e1406b6c6a0 (diff)
downloadwordpress-715daf875a1cf7853d3403e388ee35cc939010d1.tar.gz
wordpress-715daf875a1cf7853d3403e388ee35cc939010d1.zip
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. git-svn-id: https://develop.svn.wordpress.org/trunk@49929 602fd350-edb4-49c9-b593-d223f7449a82
-rw-r--r--src/wp-admin/includes/class-wp-community-events.php2
-rw-r--r--src/wp-admin/includes/deprecated.php2
-rw-r--r--src/wp-admin/includes/file.php2
-rw-r--r--src/wp-admin/includes/image.php2
-rw-r--r--src/wp-admin/includes/ms.php2
-rw-r--r--src/wp-includes/class-wp-hook.php2
-rw-r--r--src/wp-includes/class-wp-recovery-mode-email-service.php2
-rw-r--r--src/wp-includes/cron.php2
-rw-r--r--src/wp-includes/functions.php4
-rw-r--r--src/wp-includes/plugin.php4
-rw-r--r--src/wp-includes/post.php2
-rw-r--r--src/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php6
-rw-r--r--src/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php10
-rw-r--r--src/wp-includes/rss.php4
-rw-r--r--src/wp-includes/taxonomy.php3
-rw-r--r--src/wp-includes/user.php2
16 files changed, 25 insertions, 26 deletions
diff --git a/src/wp-admin/includes/class-wp-community-events.php b/src/wp-admin/includes/class-wp-community-events.php
index af5ce241b7..8ccf490e29 100644
--- a/src/wp-admin/includes/class-wp-community-events.php
+++ b/src/wp-admin/includes/class-wp-community-events.php
@@ -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;
diff --git a/src/wp-admin/includes/deprecated.php b/src/wp-admin/includes/deprecated.php
index f5bfc6567c..ed9d699b8b 100644
--- a/src/wp-admin/includes/deprecated.php
+++ b/src/wp-admin/includes/deprecated.php
@@ -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()' );
diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php
index 6e726350a4..baef91be82 100644
--- a/src/wp-admin/includes/file.php
+++ b/src/wp-admin/includes/file.php
@@ -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 ) ) {
diff --git a/src/wp-admin/includes/image.php b/src/wp-admin/includes/image.php
index 8297791583..0bfdf288d6 100644
--- a/src/wp-admin/includes/image.php
+++ b/src/wp-admin/includes/image.php
@@ -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 ) ) {
diff --git a/src/wp-admin/includes/ms.php b/src/wp-admin/includes/ms.php
index 03018578ea..a69565d274 100644
--- a/src/wp-admin/includes/ms.php
+++ b/src/wp-admin/includes/ms.php
@@ -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;
diff --git a/src/wp-includes/class-wp-hook.php b/src/wp-includes/class-wp-hook.php
index 4b03862814..eb43c10c05 100644
--- a/src/wp-includes/class-wp-hook.php
+++ b/src/wp-includes/class-wp-hook.php
@@ -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.
*/
diff --git a/src/wp-includes/class-wp-recovery-mode-email-service.php b/src/wp-includes/class-wp-recovery-mode-email-service.php
index c4c1cf32ea..834099a56e 100644
--- a/src/wp-includes/class-wp-recovery-mode-email-service.php
+++ b/src/wp-includes/class-wp-recovery-mode-email-service.php
@@ -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' ) ) {
diff --git a/src/wp-includes/cron.php b/src/wp-includes/cron.php
index 992fd2885e..08ed7fb483 100644
--- a/src/wp-includes/cron.php
+++ b/src/wp-includes/cron.php
@@ -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() {
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index b67676900f..92cc8d1915 100644
--- a/src/wp-includes/functions.php
+++ b/src/wp-includes/functions.php
@@ -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.
diff --git a/src/wp-includes/plugin.php b/src/wp-includes/plugin.php
index 3228ad6949..7bcfc7aa94 100644
--- a/src/wp-includes/plugin.php
+++ b/src/wp-includes/plugin.php
@@ -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.
*/
diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
index 28ab7ab77e..dde5f92a4c 100644
--- a/src/wp-includes/post.php
+++ b/src/wp-includes/post.php
@@ -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 );
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php
index 7b20f78caa..c67bdb525d 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php
@@ -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.
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php
index 8ad098703f..64a1ce653a 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php
@@ -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'] );
diff --git a/src/wp-includes/rss.php b/src/wp-includes/rss.php
index 01e04c6c76..6bddad89d3 100644
--- a/src/wp-includes/rss.php
+++ b/src/wp-includes/rss.php
@@ -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
diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php
index eb086c47c9..b13bc99252 100644
--- a/src/wp-includes/taxonomy.php
+++ b/src/wp-includes/taxonomy.php
@@ -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;
diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php
index 9bfd9e4faf..4607a6dafb 100644
--- a/src/wp-includes/user.php
+++ b/src/wp-includes/user.php
@@ -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 ) {