Docs: Various docblock corrections particularly relating to boolean types.

See #51800

Built from https://develop.svn.wordpress.org/trunk@49926


git-svn-id: http://core.svn.wordpress.org/trunk@49625 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2021-01-03 21:57:09 +00:00
parent bf51961e7e
commit 53da9208dd
16 changed files with 28 additions and 26 deletions

View File

@ -39,9 +39,9 @@ class WP_Community_Events {
* @since 4.8.0 * @since 4.8.0
* *
* @param int $user_id WP user ID. * @param int $user_id WP user ID.
* @param bool|array $user_location Stored location data for the user. * @param false|array $user_location {
* false to pass no location; * Stored location data for the user. false to pass no location.
* array to pass a location { *
* @type string $description The name of the location * @type string $description The name of the location
* @type string $latitude The latitude in decimal degrees notation, without the degree * @type string $latitude The latitude in decimal degrees notation, without the degree
* symbol. e.g.: 47.615200. * symbol. e.g.: 47.615200.

View File

@ -1538,7 +1538,7 @@ function wp_dashboard_primary_output( $widget_id, $feeds ) {
* *
* @since 3.0.0 * @since 3.0.0
* *
* @return bool|null True if not multisite, user can't upload files, or the space check option is disabled. * @return true|void True if not multisite, user can't upload files, or the space check option is disabled.
*/ */
function wp_dashboard_quota() { function wp_dashboard_quota() {
if ( ! is_multisite() || ! current_user_can( 'upload_files' ) || get_site_option( 'upload_space_check_disabled' ) ) { if ( ! is_multisite() || ! current_user_can( 'upload_files' ) || get_site_option( 'upload_space_check_disabled' ) ) {

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

View File

@ -1014,7 +1014,7 @@ function _load_image_to_edit_path( $attachment_id, $size = 'full' ) {
* *
* @since 3.1.0 * @since 3.1.0
* *
* @param string $image_url Current image URL. * @param string|false $image_url Current image URL.
* @param int $attachment_id Attachment ID. * @param int $attachment_id Attachment ID.
* @param string|int[] $size Requested image size. Can be any registered image size name, or * @param string|int[] $size Requested image size. Can be any registered image size name, or
* an array of width and height values in pixels (in that order). * an array of width and height values in pixels (in that order).

View File

@ -29,9 +29,9 @@ function translations_api( $type, $args = null ) {
* *
* @since 4.0.0 * @since 4.0.0
* *
* @param bool|array $result The result object. Default false. * @param false|object $result The result object. Default false.
* @param string $type The type of translations being requested. * @param string $type The type of translations being requested.
* @param object $args Translation API arguments. * @param object $args Translation API arguments.
*/ */
$res = apply_filters( 'translations_api', false, $type, $args ); $res = apply_filters( 'translations_api', false, $type, $args );

View File

@ -815,7 +815,7 @@ function default_topic_count_scale( $count ) {
* @type string $order How to order the tags. Accepts 'ASC' (ascending), * @type string $order How to order the tags. Accepts 'ASC' (ascending),
* 'DESC' (descending), or 'RAND' (random). Default 'ASC'. * 'DESC' (descending), or 'RAND' (random). Default 'ASC'.
* @type int|bool $filter Whether to enable filtering of the final output * @type int|bool $filter Whether to enable filtering of the final output
* via {@see 'wp_generate_tag_cloud'}. Default 1|true. * via {@see 'wp_generate_tag_cloud'}. Default 1.
* @type string $topic_count_text Nooped plural text from _n_noop() to supply to * @type string $topic_count_text Nooped plural text from _n_noop() to supply to
* tag counts. Default null. * tag counts. Default null.
* @type callable $topic_count_text_callback Callback used to generate nooped plural text for * @type callable $topic_count_text_callback Callback used to generate nooped plural text for

View File

@ -187,6 +187,9 @@ final class WP_Hook implements Iterator, ArrayAccess {
/** /**
* Checks if a specific action has been registered for this hook. * Checks if a specific action has been registered for this hook.
* *
* When using the $function_to_check argument, this function may return a non-boolean value
* that evaluates to false (e.g. 0), so use the === operator for testing the return value.
*
* @since 4.7.0 * @since 4.7.0
* *
* @param string $tag Optional. The name of the filter hook. Default empty. * @param string $tag Optional. The name of the filter hook. Default empty.

View File

@ -291,7 +291,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
* @param int $dst_h The destination height. * @param int $dst_h The destination height.
* @param string $filter_name Optional. The Imagick filter to use when resizing. Default 'FILTER_TRIANGLE'. * @param string $filter_name Optional. The Imagick filter to use when resizing. Default 'FILTER_TRIANGLE'.
* @param bool $strip_meta Optional. Strip all profiles, excluding color profiles, from the image. Default true. * @param bool $strip_meta Optional. Strip all profiles, excluding color profiles, from the image. Default true.
* @return bool|WP_Error * @return void|WP_Error
*/ */
protected function thumbnail_image( $dst_w, $dst_h, $filter_name = 'FILTER_TRIANGLE', $strip_meta = true ) { protected function thumbnail_image( $dst_w, $dst_h, $filter_name = 'FILTER_TRIANGLE', $strip_meta = true ) {
$allowed_filters = array( $allowed_filters = array(

View File

@ -70,7 +70,7 @@ class WP_Metadata_Lazyloader {
* *
* @param string $object_type Type of object whose meta is to be lazy-loaded. Accepts 'term' or 'comment'. * @param string $object_type Type of object whose meta is to be lazy-loaded. Accepts 'term' or 'comment'.
* @param array $object_ids Array of object IDs. * @param array $object_ids Array of object IDs.
* @return bool|WP_Error True on success, WP_Error on failure. * @return void|WP_Error WP_Error on failure.
*/ */
public function queue_objects( $object_type, $object_ids ) { public function queue_objects( $object_type, $object_ids ) {
if ( ! isset( $this->settings[ $object_type ] ) ) { if ( ! isset( $this->settings[ $object_type ] ) ) {
@ -110,7 +110,7 @@ class WP_Metadata_Lazyloader {
* @since 4.5.0 * @since 4.5.0
* *
* @param string $object_type Object type. Accepts 'comment' or 'term'. * @param string $object_type Object type. Accepts 'comment' or 'term'.
* @return bool|WP_Error True on success, WP_Error on failure. * @return void|WP_Error WP_Error on failure.
*/ */
public function reset_queue( $object_type ) { public function reset_queue( $object_type ) {
if ( ! isset( $this->settings[ $object_type ] ) ) { if ( ! isset( $this->settings[ $object_type ] ) ) {

View File

@ -2406,9 +2406,9 @@ function wp_set_comment_status( $comment_id, $comment_status, $wp_error = false
* *
* @since 1.5.0 * @since 1.5.0
* *
* @param int $comment_id Comment ID. * @param int $comment_id Comment ID.
* @param string|bool $comment_status Current comment status. Possible values include * @param string $comment_status Current comment status. Possible values include
* 'hold', 'approve', 'spam', 'trash', or false. * 'hold', '0', 'approve', '1, 'spam', and 'trash'.
*/ */
do_action( 'wp_set_comment_status', $comment->comment_ID, $comment_status ); do_action( 'wp_set_comment_status', $comment->comment_ID, $comment_status );

View File

@ -5545,8 +5545,8 @@ function wp_slash( $value ) {
* *
* @since 3.6.0 * @since 3.6.0
* *
* @param string|string[] $value String or array of strings to unslash. * @param string|array $value String or array of strings to unslash.
* @return string|string[] Unslashed $value * @return string|array Unslashed $value
*/ */
function wp_unslash( $value ) { function wp_unslash( $value ) {
return stripslashes_deep( $value ); return stripslashes_deep( $value );

View File

@ -837,7 +837,7 @@ function wp_extract_urls( $content ) {
* *
* @param string|null $content Post content. If `null`, the `post_content` field from `$post` is used. * @param string|null $content Post content. If `null`, the `post_content` field from `$post` is used.
* @param int|WP_Post $post Post ID or post object. * @param int|WP_Post $post Post ID or post object.
* @return null|bool Returns false if post is not found. * @return void|false Returns false if post is not found.
*/ */
function do_enclose( $content, $post ) { function do_enclose( $content, $post ) {
global $wpdb; global $wpdb;

View File

@ -133,7 +133,7 @@ function add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1
* anything registered. When checking a specific function, the priority of that * anything registered. When checking a specific function, the priority of that
* hook is returned, or false if the function is not attached. When using the * hook is returned, or false if the function is not attached. When using the
* $function_to_check argument, this function may return a non-boolean value * $function_to_check argument, this function may return a non-boolean value
* that evaluates to false (e.g.) 0, so use the === operator for testing the * that evaluates to false (e.g. 0), so use the === operator for testing the
* return value. * return value.
*/ */
function has_filter( $tag, $function_to_check = false ) { function has_filter( $tag, $function_to_check = false ) {
@ -566,7 +566,7 @@ function do_action_ref_array( $tag, $args ) {
* anything registered. When checking a specific function, the priority of that * anything registered. When checking a specific function, the priority of that
* hook is returned, or false if the function is not attached. When using the * hook is returned, or false if the function is not attached. When using the
* $function_to_check argument, this function may return a non-boolean value * $function_to_check argument, this function may return a non-boolean value
* that evaluates to false (e.g.) 0, so use the === operator for testing the * that evaluates to false (e.g. 0), so use the === operator for testing the
* return value. * return value.
*/ */
function has_action( $tag, $function_to_check = false ) { function has_action( $tag, $function_to_check = false ) {

View File

@ -6103,9 +6103,8 @@ function wp_get_attachment_metadata( $attachment_id = 0, $unfiltered = false ) {
* *
* @since 2.1.0 * @since 2.1.0
* *
* @param array|bool $data Array of meta data for the given attachment, or false * @param array $data Array of meta data for the given attachment.
* if the object does not exist. * @param int $attachment_id Attachment post ID.
* @param int $attachment_id Attachment post ID.
*/ */
return apply_filters( 'wp_get_attachment_metadata', $data, $attachment_id ); return apply_filters( 'wp_get_attachment_metadata', $data, $attachment_id );
} }

View File

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

View File

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