Docs: Corrections and improvements to types used in various docblocks.

See #51800, #52217

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


git-svn-id: http://core.svn.wordpress.org/trunk@49635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2021-01-05 17:16:11 +00:00
parent 7ced0efbf4
commit b59c0f307b
26 changed files with 104 additions and 103 deletions

View File

@ -15,7 +15,7 @@
*/
class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {
/**
* @param array $fields
* @param array|false $fields Database fields to use.
*/
public function __construct( $fields = false ) {
if ( $fields ) {

View File

@ -787,13 +787,13 @@ class WP_Filesystem_Base {
* @since 2.5.0
* @abstract
*
* @param string $path Path for new directory.
* @param int|false $chmod Optional. The permissions as octal number (or false to skip chmod).
* Default false.
* @param string|int $chown Optional. A user name or number (or false to skip chown).
* Default false.
* @param string|int $chgrp Optional. A group name or number (or false to skip chgrp).
* Default false.
* @param string $path Path for new directory.
* @param int|false $chmod Optional. The permissions as octal number (or false to skip chmod).
* Default false.
* @param string|int|false $chown Optional. A user name or number (or false to skip chown).
* Default false.
* @param string|int|false $chgrp Optional. A group name or number (or false to skip chgrp).
* Default false.
* @return bool True on success, false on failure.
*/
public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {

View File

@ -521,13 +521,13 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
*
* @since 2.5.0
*
* @param string $path Path for new directory.
* @param int|false $chmod Optional. The permissions as octal number (or false to skip chmod).
* Default false.
* @param string|int $chown Optional. A user name or number (or false to skip chown).
* Default false.
* @param string|int $chgrp Optional. A group name or number (or false to skip chgrp).
* Default false.
* @param string $path Path for new directory.
* @param int|false $chmod Optional. The permissions as octal number (or false to skip chmod).
* Default false.
* @param string|int|false $chown Optional. A user name or number (or false to skip chown).
* Default false.
* @param string|int|false $chgrp Optional. A group name or number (or false to skip chgrp).
* Default false.
* @return bool True on success, false on failure.
*/
public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {

View File

@ -541,13 +541,13 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
*
* @since 2.5.0
*
* @param string $path Path for new directory.
* @param int|false $chmod Optional. The permissions as octal number (or false to skip chmod).
* Default false.
* @param string|int $chown Optional. A user name or number (or false to skip chown).
* Default false.
* @param string|int $chgrp Optional. A group name or number (or false to skip chgrp).
* Default false.
* @param string $path Path for new directory.
* @param int|false $chmod Optional. The permissions as octal number (or false to skip chmod).
* Default false.
* @param string|int|false $chown Optional. A user name or number (or false to skip chown).
* Default false.
* @param string|int|false $chgrp Optional. A group name or number (or false to skip chgrp).
* Default false.
* @return bool True on success, false on failure.
*/
public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {

View File

@ -551,13 +551,13 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
*
* @since 2.5.0
*
* @param string $path Path for new directory.
* @param int|false $chmod Optional. The permissions as octal number (or false to skip chmod).
* Default false.
* @param string|int $chown Optional. A user name or number (or false to skip chown).
* Default false.
* @param string|int $chgrp Optional. A group name or number (or false to skip chgrp).
* Default false.
* @param string $path Path for new directory.
* @param int|false $chmod Optional. The permissions as octal number (or false to skip chmod).
* Default false.
* @param string|int|false $chown Optional. A user name or number (or false to skip chown).
* Default false.
* @param string|int|false $chgrp Optional. A group name or number (or false to skip chgrp).
* Default false.
* @return bool True on success, false on failure.
*/
public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {

View File

@ -671,13 +671,13 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
*
* @since 2.7.0
*
* @param string $path Path for new directory.
* @param int|false $chmod Optional. The permissions as octal number (or false to skip chmod).
* Default false.
* @param string|int $chown Optional. A user name or number (or false to skip chown).
* Default false.
* @param string|int $chgrp Optional. A group name or number (or false to skip chgrp).
* Default false.
* @param string $path Path for new directory.
* @param int|false $chmod Optional. The permissions as octal number (or false to skip chmod).
* Default false.
* @param string|int|false $chown Optional. A user name or number (or false to skip chown).
* Default false.
* @param string|int|false $chgrp Optional. A group name or number (or false to skip chgrp).
* Default false.
* @return bool True on success, false on failure.
*/
public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {

View File

@ -539,9 +539,9 @@ final class WP_Screen {
*
* @since 3.3.0
*
* @param string $option Option name.
* @param string $key Optional. Specific array key for when the option is an array.
* Default false.
* @param string $option Option name.
* @param string|false $key Optional. Specific array key for when the option is an array.
* Default false.
* @return string The option value if set, null otherwise.
*/
public function get_option( $option, $key = false ) {

View File

@ -506,7 +506,7 @@ function wp_network_dashboard_right_now() {
*
* @global int $post_ID
*
* @param string $error_msg Optional. Error message. Default false.
* @param string|false $error_msg Optional. Error message. Default false.
*/
function wp_dashboard_quick_press( $error_msg = false ) {
global $post_ID;
@ -577,7 +577,7 @@ function wp_dashboard_quick_press( $error_msg = false ) {
*
* @since 2.7.0
*
* @param WP_Post[] $drafts Optional. Array of posts to display. Default false.
* @param WP_Post[]|false $drafts Optional. Array of posts to display. Default false.
*/
function wp_dashboard_recent_drafts( $drafts = false ) {
if ( ! $drafts ) {
@ -1151,7 +1151,7 @@ function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = ar
*
* @global callable[] $wp_dashboard_control_callbacks
*
* @param int $widget_control_id Registered Widget ID.
* @param int|false $widget_control_id Optional. Registered widget ID. Default false.
*/
function wp_dashboard_trigger_widget_control( $widget_control_id = false ) {
global $wp_dashboard_control_callbacks;

View File

@ -1255,7 +1255,7 @@ function verify_file_md5( $filename, $expected_md5 ) {
*
* @param string $filename The file to validate.
* @param string|array $signatures A Signature provided for the file.
* @param string $filename_for_errors A friendly filename for errors. Optional.
* @param string|false $filename_for_errors Optional. A friendly filename for errors.
* @return bool|WP_Error True on success, false if verification not attempted,
* or WP_Error describing an error condition.
*/

View File

@ -11,15 +11,15 @@
*
* @since 2.1.0
*
* @param string|int $src The source file or Attachment ID.
* @param int $src_x The start x position to crop from.
* @param int $src_y The start y position to crop from.
* @param int $src_w The width to crop.
* @param int $src_h The height to crop.
* @param int $dst_w The destination width.
* @param int $dst_h The destination height.
* @param bool $src_abs Optional. If the source crop points are absolute.
* @param string $dst_file Optional. The destination file to write to.
* @param string|int $src The source file or Attachment ID.
* @param int $src_x The start x position to crop from.
* @param int $src_y The start y position to crop from.
* @param int $src_w The width to crop.
* @param int $src_h The height to crop.
* @param int $dst_w The destination width.
* @param int $dst_h The destination height.
* @param bool|false $src_abs Optional. If the source crop points are absolute.
* @param string|false $dst_file Optional. The destination file to write to.
* @return string|WP_Error New filepath on success, WP_Error on failure.
*/
function wp_crop_image( $src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) {

View File

@ -49,7 +49,7 @@ function _usort_by_first_member( $a, $b ) {
* @param string $name Importer name and title.
* @param string $description Importer description.
* @param callable $callback Callback to run.
* @return WP_Error Returns WP_Error when $callback is WP_Error.
* @return void|WP_Error Void on success. WP_Error when $callback is WP_Error.
*/
function register_importer( $id, $name, $description, $callback ) {
global $wp_importers;

View File

@ -689,7 +689,7 @@ function mu_dropdown_languages( $lang_files = array(), $current = '' ) {
* @global int $wp_db_version WordPress database version.
* @global string $pagenow
*
* @return false False if the current user is not a super admin.
* @return void|false Void on success. False if the current user is not a super admin.
*/
function site_admin_notice() {
global $wp_db_version, $pagenow;

View File

@ -107,7 +107,7 @@ function get_clean_basedomain() {
*
* @global bool $is_apache
*
* @param WP_Error $errors
* @param false|WP_Error $errors Optional. Error object. Default false.
*/
function network_step1( $errors = false ) {
global $is_apache;
@ -384,7 +384,7 @@ function network_step1( $errors = false ) {
* @global wpdb $wpdb WordPress database abstraction object.
* @global bool $is_nginx Whether the server software is Nginx or something else.
*
* @param WP_Error $errors
* @param false|WP_Error $errors Optional. Error object. Default false.
*/
function network_step2( $errors = false ) {
global $wpdb, $is_nginx;

View File

@ -1231,7 +1231,8 @@ function is_uninstallable_plugin( $plugin ) {
* @since 2.7.0
*
* @param string $plugin Path to the plugin file relative to the plugins directory.
* @return true True if a plugin's uninstall.php file has been found and included.
* @return true|void True if a plugin's uninstall.php file has been found and included.
* Void otherwise.
*/
function uninstall_plugin( $plugin ) {
$file = plugin_basename( $plugin );

View File

@ -813,7 +813,7 @@ function post_exists( $title, $content = '', $date = '', $type = '' ) {
*
* @global WP_User $current_user
*
* @return int|WP_Error
* @return int|WP_Error Post ID on success, WP_Error on failure.
*/
function wp_write_post() {
if ( isset( $_POST['post_type'] ) ) {
@ -889,7 +889,7 @@ function wp_write_post() {
*
* @since 2.0.0
*
* @return int|null
* @return int|void Post ID on success, void on failure.
*/
function write_post() {
$result = wp_write_post();

View File

@ -25,17 +25,17 @@ require_once ABSPATH . 'wp-admin/includes/class-wp-internal-pointers.php';
*
* @see wp_terms_checklist()
*
* @param int $post_id Optional. Post to generate a categories checklist for. Default 0.
* $selected_cats must not be an array. Default 0.
* @param int $descendants_and_self Optional. ID of the category to output along with its descendants.
* Default 0.
* @param int[] $selected_cats Optional. Array of category IDs to mark as checked. Default false.
* @param int[] $popular_cats Optional. Array of category IDs to receive the "popular-category" class.
* Default false.
* @param Walker $walker Optional. Walker object to use to build the output.
* Default is a Walker_Category_Checklist instance.
* @param bool $checked_ontop Optional. Whether to move checked items out of the hierarchy and to
* the top of the list. Default true.
* @param int $post_id Optional. Post to generate a categories checklist for. Default 0.
* $selected_cats must not be an array. Default 0.
* @param int $descendants_and_self Optional. ID of the category to output along with its descendants.
* Default 0.
* @param int[]|false $selected_cats Optional. Array of category IDs to mark as checked. Default false.
* @param int[]|false $popular_cats Optional. Array of category IDs to receive the "popular-category" class.
* Default false.
* @param Walker $walker Optional. Walker object to use to build the output.
* Default is a Walker_Category_Checklist instance.
* @param bool $checked_ontop Optional. Whether to move checked items out of the hierarchy and to
* the top of the list. Default true.
*/
function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true ) {
wp_terms_checklist(

View File

@ -872,8 +872,8 @@ function get_super_admins() {
*
* @since 3.0.0
*
* @param int $user_id (Optional) The ID of a user. Defaults to the current user.
* @return bool True if the user is a site admin.
* @param int|false $user_id Optional. The ID of a user. Defaults to false, to check the current user.
* @return bool Whether the user is a site admin.
*/
function is_super_admin( $user_id = false ) {
if ( ! $user_id || get_current_user_id() == $user_id ) {

View File

@ -878,10 +878,10 @@ function get_comments_number( $post_id = 0 ) {
* @since 0.71
* @since 5.4.0 The `$deprecated` parameter was changed to `$post_id`.
*
* @param string $zero Optional. Text for no comments. Default false.
* @param string $one Optional. Text for one comment. Default false.
* @param string $more Optional. Text for more than one comment. Default false.
* @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is the global `$post`.
* @param string|false $zero Optional. Text for no comments. Default false.
* @param string|false $one Optional. Text for one comment. Default false.
* @param string|false $more Optional. Text for more than one comment. Default false.
* @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is the global `$post`.
*/
function comments_number( $zero = false, $one = false, $more = false, $post_id = 0 ) {
echo get_comments_number_text( $zero, $one, $more, $post_id );
@ -1108,9 +1108,9 @@ function get_comment_type( $comment_ID = 0 ) {
*
* @since 0.71
*
* @param string $commenttxt Optional. String to display for comment type. Default false.
* @param string $trackbacktxt Optional. String to display for trackback type. Default false.
* @param string $pingbacktxt Optional. String to display for pingback type. Default false.
* @param string|false $commenttxt Optional. String to display for comment type. Default false.
* @param string|false $trackbacktxt Optional. String to display for trackback type. Default false.
* @param string|false $pingbacktxt Optional. String to display for pingback type. Default false.
*/
function comment_type( $commenttxt = false, $trackbacktxt = false, $pingbacktxt = false ) {
if ( false === $commenttxt ) {
@ -1199,7 +1199,7 @@ function trackback_url( $deprecated_echo = true ) {
*
* @since 0.71
*
* @param int $deprecated Not used (Was $timezone = 0).
* @param int|string $deprecated Not used (Was $timezone = 0).
*/
function trackback_rdf( $deprecated = '' ) {
if ( ! empty( $deprecated ) ) {
@ -1980,13 +1980,13 @@ function comment_id_fields( $post_id = 0 ) {
*
* @global WP_Comment $comment Global comment object.
*
* @param string $no_reply_text Optional. Text to display when not replying to a comment.
* Default false.
* @param string $reply_text Optional. Text to display when replying to a comment.
* Default false. Accepts "%s" for the author of the comment
* being replied to.
* @param string $link_to_parent Optional. Boolean to control making the author's name a link
* to their comment. Default true.
* @param string|false $no_reply_text Optional. Text to display when not replying to a comment.
* Default false.
* @param string|false $reply_text Optional. Text to display when replying to a comment.
* Default false. Accepts "%s" for the author of the comment
* being replied to.
* @param bool $link_to_parent Optional. Boolean to control making the author's name a link
* to their comment. Default true.
*/
function comment_form_title( $no_reply_text = false, $reply_text = false, $link_to_parent = true ) {
global $comment;

View File

@ -2716,7 +2716,7 @@ function wp_update_comment_count_now( $post_id ) {
* @since 1.5.0
*
* @param string $url URL to ping.
* @param int $deprecated Not Used.
* @param string $deprecated Not Used.
* @return string|false String containing URI on success, false on failure.
*/
function discover_pingback_server_uri( $url, $deprecated = '' ) {

View File

@ -99,7 +99,7 @@ function wp_embed_defaults( $url = '' ) {
* @see WP_oEmbed
*
* @param string $url The URL that should be embedded.
* @param array $args {
* @param array|string $args {
* Optional. Additional arguments for retrieving embed HTML. Default empty.
*
* @type int|string $width Optional. The `maxwidth` value passed to the provider URL.

View File

@ -934,9 +934,9 @@ function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) {
* @since 1.5.0
* @since 4.6.0 The function now tries to load the .mo file from the languages directory first.
*
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
* @param string $path Optional. Path to the directory containing the .mo file.
* Default false.
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
* @param string|false $path Optional. Path to the directory containing the .mo file.
* Default false.
* @return bool True when textdomain is successfully loaded, false otherwise.
*/
function load_theme_textdomain( $domain, $path = false ) {
@ -974,9 +974,9 @@ function load_theme_textdomain( $domain, $path = false ) {
*
* @since 2.9.0
*
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
* @param string $path Optional. Path to the directory containing the .mo file.
* Default false.
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
* @param string|false $path Optional. Path to the directory containing the .mo file.
* Default false.
* @return bool True when the theme textdomain is successfully loaded, false otherwise.
*/
function load_child_theme_textdomain( $domain, $path = false ) {

View File

@ -3362,7 +3362,7 @@ add_shortcode( 'video', 'wp_video_shortcode' );
*
* @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
* of width and height values in pixels (in that order). Default 'thumbnail'.
* @param string $text Optional. Link text. Default false.
* @param string|false $text Optional. Link text. Default false.
*/
function previous_image_link( $size = 'thumbnail', $text = false ) {
adjacent_image_link( true, $size, $text );
@ -3377,7 +3377,7 @@ function previous_image_link( $size = 'thumbnail', $text = false ) {
*
* @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
* of width and height values in pixels (in that order). Default 'thumbnail'.
* @param string $text Optional. Link text. Default false.
* @param string|false $text Optional. Link text. Default false.
*/
function next_image_link( $size = 'thumbnail', $text = false ) {
adjacent_image_link( false, $size, $text );

View File

@ -2298,7 +2298,7 @@ function maybe_add_existing_user_to_blog() {
*
* @since MU (3.0.0)
*
* @param array $details {
* @param array|false $details {
* User details. Must at least contain values for the keys listed below.
*
* @type int $user_id The ID of the user being added to the current blog.

View File

@ -1058,8 +1058,8 @@ function wp_user_settings() {
*
* @since 2.7.0
*
* @param string $name The name of the setting.
* @param string $default Optional default value to return when $name is not set.
* @param string $name The name of the setting.
* @param string|false $default Optional. Default value to return when $name is not set. Default false.
* @return mixed The last saved user setting or the default value/false if it doesn't exist.
*/
function get_user_setting( $name, $default = false ) {

View File

@ -5843,7 +5843,7 @@ function is_local_attachment( $url ) {
* @see wp_insert_post()
*
* @param string|array $args Arguments for inserting an attachment.
* @param string $file Optional. Filename.
* @param string|false $file Optional. Filename.
* @param int $parent Optional. Parent post ID.
* @param bool $wp_error Optional. Whether to return a WP_Error on failure. Default false.
* @param bool $fire_after_hooks Optional. Whether to fire the after insert hooks. Default true.
@ -7415,7 +7415,7 @@ function _prime_post_caches( $ids, $update_term_cache = true, $update_meta_cache
* @access private
*
* @param string $post_name Slug.
* @param string $post_ID Optional. Post ID that should be ignored. Default 0.
* @param int $post_ID Optional. Post ID that should be ignored. Default 0.
*/
function wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_ID = 0 ) {
$trashed_posts_with_desired_slug = get_posts(

View File

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