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

See #51800, #52217


git-svn-id: https://develop.svn.wordpress.org/trunk@49936 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn
2021-01-05 17:14:24 +00:00
parent 5c82078df7
commit 8153c8ba02
25 changed files with 103 additions and 102 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(