From 77dfc892fe22e9c5384228245e3df6423ea0afa6 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 21 Feb 2023 16:39:19 +0000 Subject: [PATCH] Docs: Document default values for optional parameters in various DocBlocks. Props paulkevan, costdev, audrasjb, SergeyBiryukov. See #56792. Built from https://develop.svn.wordpress.org/trunk@55398 git-svn-id: http://core.svn.wordpress.org/trunk@54931 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/author-template.php | 4 +- wp-includes/bookmark.php | 2 +- wp-includes/class-wp-editor.php | 9 ++++- wp-includes/class-wp-error.php | 12 +++--- wp-includes/class-wp-meta-query.php | 2 + wp-includes/class-wp-widget.php | 4 +- wp-includes/class-wpdb.php | 29 +++++++------- wp-includes/comment-template.php | 2 +- wp-includes/comment.php | 22 +++++++---- wp-includes/functions.php | 59 ++++++++++++++++------------- wp-includes/meta.php | 19 +++++----- wp-includes/ms-blogs.php | 4 +- wp-includes/ms-functions.php | 9 +++-- wp-includes/post-formats.php | 2 +- wp-includes/revision.php | 5 ++- wp-includes/rss.php | 2 +- wp-includes/version.php | 2 +- 17 files changed, 110 insertions(+), 78 deletions(-) diff --git a/wp-includes/author-template.php b/wp-includes/author-template.php index b4c344dcbc..2570a4035b 100644 --- a/wp-includes/author-template.php +++ b/wp-includes/author-template.php @@ -155,7 +155,7 @@ function the_modified_author() { * @global WP_User $authordata The current author's data. * * @param string $field Optional. The user field to retrieve. Default empty. - * @param int|false $user_id Optional. User ID. + * @param int|false $user_id Optional. User ID. Defaults to the current post author. * @return string The author's field from the current author's DB object, otherwise an empty string. */ function get_the_author_meta( $field = '', $user_id = false ) { @@ -196,7 +196,7 @@ function get_the_author_meta( $field = '', $user_id = false ) { * * @param string $field Selects the field of the users record. See get_the_author_meta() * for the list of possible fields. - * @param int|false $user_id Optional. User ID. + * @param int|false $user_id Optional. User ID. Defaults to the current post author. * * @see get_the_author_meta() */ diff --git a/wp-includes/bookmark.php b/wp-includes/bookmark.php index 37a25a80f6..ee1e82d340 100644 --- a/wp-includes/bookmark.php +++ b/wp-includes/bookmark.php @@ -71,7 +71,7 @@ function get_bookmark( $bookmark, $output = OBJECT, $filter = 'raw' ) { * * @param string $field The name of the data field to return. * @param int $bookmark The bookmark ID to get field. - * @param string $context Optional. The context of how the field will be used. + * @param string $context Optional. The context of how the field will be used. Default 'display'. * @return string|WP_Error */ function get_bookmark_field( $field, $bookmark, $context = 'display' ) { diff --git a/wp-includes/class-wp-editor.php b/wp-includes/class-wp-editor.php index 9a35497923..48c8020c2a 100644 --- a/wp-includes/class-wp-editor.php +++ b/wp-includes/class-wp-editor.php @@ -1451,7 +1451,7 @@ final class _WP_Editors { * * @param string $mce_locale The locale used for the editor. * @param bool $json_only Optional. Whether to include the JavaScript calls to tinymce.addI18n() and - * tinymce.ScriptLoader.markDone(). + * tinymce.ScriptLoader.markDone(). Default false. * @return string Translation object, JSON encoded. */ public static function wp_mce_translation( $mce_locale = '', $json_only = false ) { @@ -1751,7 +1751,12 @@ final class _WP_Editors { * * @since 3.1.0 * - * @param array $args Optional. Accepts 'pagenum' and 's' (search) arguments. + * @param array $args { + * Optional. Array of link query arguments. + * + * @type int $pagenum Page number. Default 1. + * @type string $s Search keywords. + * } * @return array|false $results { * An array of associative arrays of query results, false if there are none. * diff --git a/wp-includes/class-wp-error.php b/wp-includes/class-wp-error.php index c8a976fb14..de721468fd 100644 --- a/wp-includes/class-wp-error.php +++ b/wp-includes/class-wp-error.php @@ -56,7 +56,7 @@ class WP_Error { * * @param string|int $code Error code. * @param string $message Error message. - * @param mixed $data Optional. Error data. + * @param mixed $data Optional. Error data. Default empty string. */ public function __construct( $code = '', $message = '', $data = '' ) { if ( empty( $code ) ) { @@ -103,7 +103,8 @@ class WP_Error { * * @since 2.1.0 * - * @param string|int $code Optional. Retrieve messages matching code, if exists. + * @param string|int $code Optional. Error code to retrieve the messages for. + * Default empty string. * @return string[] Error strings on success, or empty array if there are none. */ public function get_error_messages( $code = '' ) { @@ -132,7 +133,8 @@ class WP_Error { * * @since 2.1.0 * - * @param string|int $code Optional. Error code to retrieve message. + * @param string|int $code Optional. Error code to retrieve the message for. + * Default empty string. * @return string The error message. */ public function get_error_message( $code = '' ) { @@ -151,7 +153,7 @@ class WP_Error { * * @since 2.1.0 * - * @param string|int $code Optional. Error code. + * @param string|int $code Optional. Error code. Default empty string. * @return mixed Error data, if it exists. */ public function get_error_data( $code = '' ) { @@ -185,7 +187,7 @@ class WP_Error { * * @param string|int $code Error code. * @param string $message Error message. - * @param mixed $data Optional. Error data. + * @param mixed $data Optional. Error data. Default empty string. */ public function add( $code, $message, $data = '' ) { $this->errors[ $code ][] = $message; diff --git a/wp-includes/class-wp-meta-query.php b/wp-includes/class-wp-meta-query.php index f0c9e91277..4d31fd50ed 100644 --- a/wp-includes/class-wp-meta-query.php +++ b/wp-includes/class-wp-meta-query.php @@ -345,6 +345,7 @@ class WP_Meta_Query { * @param string $primary_id_column ID column for the filtered object in $primary_table. * @param object $context Optional. The main query object that corresponds to the type, for * example a `WP_Query`, `WP_User_Query`, or `WP_Site_Query`. + * Default null. * @return string[]|false { * Array containing JOIN and WHERE SQL clauses to append to the main query, * or false if no table exists for the requested meta type. @@ -521,6 +522,7 @@ class WP_Meta_Query { * @param array $parent_query Parent query array. * @param string $clause_key Optional. The array key used to name the clause in the original `$meta_query` * parameters. If not provided, a key will be generated automatically. + * Default empty string. * @return string[] { * Array containing JOIN and WHERE SQL clauses to append to a first-order query. * diff --git a/wp-includes/class-wp-widget.php b/wp-includes/class-wp-widget.php index 79a1efe1bf..d8e5d02e43 100644 --- a/wp-includes/class-wp-widget.php +++ b/wp-includes/class-wp-widget.php @@ -152,7 +152,7 @@ class WP_Widget { * * @since 2.8.0 * - * @param string $id_base Optional. Base ID for the widget, lowercase and unique. If left empty, + * @param string $id_base Base ID for the widget, lowercase and unique. If left empty, * a portion of the widget's PHP class name will be used. Has to be unique. * @param string $name Name for the widget displayed on the configuration page. * @param array $widget_options Optional. Widget options. See wp_register_sidebar_widget() for @@ -188,7 +188,7 @@ class WP_Widget { * * @see WP_Widget::__construct() * - * @param string $id_base Optional. Base ID for the widget, lowercase and unique. If left empty, + * @param string $id_base Base ID for the widget, lowercase and unique. If left empty, * a portion of the widget's PHP class name will be used. Has to be unique. * @param string $name Name for the widget displayed on the configuration page. * @param array $widget_options Optional. Widget options. See wp_register_sidebar_widget() for diff --git a/wp-includes/class-wpdb.php b/wp-includes/class-wpdb.php index 1c7899a9ad..662a035850 100644 --- a/wp-includes/class-wpdb.php +++ b/wp-includes/class-wpdb.php @@ -1072,7 +1072,7 @@ class wpdb { * @since 3.0.0 * * @param int $blog_id - * @param int $network_id Optional. + * @param int $network_id Optional. Network ID. Default 0. * @return int Previous blog ID. */ public function set_blog_id( $blog_id, $network_id = 0 ) { @@ -1101,7 +1101,8 @@ class wpdb { * * @since 3.0.0 * - * @param int $blog_id Optional. + * @param int $blog_id Optional. Blog ID to retrieve the table prefix for. + * Defaults to the current blog ID. * @return string Blog prefix. */ public function get_blog_prefix( $blog_id = null ) { @@ -1220,7 +1221,8 @@ class wpdb { * @since 0.71 * * @param string $db Database name. - * @param mysqli|resource $dbh Optional database connection. + * @param mysqli|resource $dbh Optional. Database connection. + * Defaults to the current database handle. */ public function select( $db, $dbh = null ) { if ( is_null( $dbh ) ) { @@ -2561,7 +2563,7 @@ class wpdb { * If string, that format will be used for all of the values in $data. * A format is one of '%d', '%f', '%s' (integer, float, string). * If omitted, all values in $data will be treated as strings unless otherwise - * specified in wpdb::$field_types. + * specified in wpdb::$field_types. Default null. * @return int|false The number of rows inserted, or false on error. */ public function insert( $table, $data, $format = null ) { @@ -2591,7 +2593,7 @@ class wpdb { * If string, that format will be used for all of the values in $data. * A format is one of '%d', '%f', '%s' (integer, float, string). * If omitted, all values in $data will be treated as strings unless otherwise - * specified in wpdb::$field_types. + * specified in wpdb::$field_types. Default null. * @return int|false The number of rows affected, or false on error. */ public function replace( $table, $data, $format = null ) { @@ -2618,7 +2620,7 @@ class wpdb { * If string, that format will be used for all of the values in $data. * A format is one of '%d', '%f', '%s' (integer, float, string). * If omitted, all values in $data will be treated as strings unless otherwise - * specified in wpdb::$field_types. + * specified in wpdb::$field_types. Default null. * @param string $type Optional. Type of operation. Possible values include 'INSERT' or 'REPLACE'. * Default 'INSERT'. * @return int|false The number of rows affected, or false on error. @@ -2684,11 +2686,11 @@ class wpdb { * If string, that format will be used for all of the values in $data. * A format is one of '%d', '%f', '%s' (integer, float, string). * If omitted, all values in $data will be treated as strings unless otherwise - * specified in wpdb::$field_types. + * specified in wpdb::$field_types. Default null. * @param array|string $where_format Optional. An array of formats to be mapped to each of the values in $where. * If string, that format will be used for all of the items in $where. * A format is one of '%d', '%f', '%s' (integer, float, string). - * If omitted, all values in $where will be treated as strings. + * If omitted, all values in $where will be treated as strings. Default null. * @return int|false The number of rows updated, or false on error. */ public function update( $table, $data, $where, $format = null, $where_format = null ) { @@ -2760,7 +2762,7 @@ class wpdb { * If string, that format will be used for all of the items in $where. * A format is one of '%d', '%f', '%s' (integer, float, string). * If omitted, all values in $data will be treated as strings unless otherwise - * specified in wpdb::$field_types. + * specified in wpdb::$field_types. Default null. * @return int|false The number of rows deleted, or false on error. */ public function delete( $table, $where, $where_format = null ) { @@ -2967,8 +2969,8 @@ class wpdb { * @since 0.71 * * @param string|null $query Optional. SQL query. Defaults to null, use the result from the previous query. - * @param int $x Optional. Column of value to return. Indexed from 0. - * @param int $y Optional. Row of value to return. Indexed from 0. + * @param int $x Optional. Column of value to return. Indexed from 0. Default 0. + * @param int $y Optional. Row of value to return. Indexed from 0. Default 0. * @return string|null Database query result (as string), or null on failure. */ public function get_var( $query = null, $x = 0, $y = 0 ) { @@ -3002,7 +3004,7 @@ class wpdb { * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which * correspond to an stdClass object, an associative array, or a numeric array, * respectively. Default OBJECT. - * @param int $y Optional. Row to return. Indexed from 0. + * @param int $y Optional. Row to return. Indexed from 0. Default 0. * @return array|object|null|void Database query result in format specified by $output or null on failure. */ public function get_row( $query = null, $output = OBJECT, $y = 0 ) { @@ -3046,7 +3048,7 @@ class wpdb { * @since 0.71 * * @param string|null $query Optional. SQL query. Defaults to previous query. - * @param int $x Optional. Column to return. Indexed from 0. + * @param int $x Optional. Column to return. Indexed from 0. Default 0. * @return array Database query result. Array indexed from 0 by SQL result row number. */ public function get_col( $query = null, $x = 0 ) { @@ -3083,6 +3085,7 @@ class wpdb { * or an object ( ->column = value ), respectively. With OBJECT_K, * return an associative array of row objects keyed by the value * of each row's first column's value. Duplicate keys are discarded. + * Default OBJECT. * @return array|object|null Database query results. */ public function get_results( $query = null, $output = OBJECT ) { diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index d5b7dc1833..77819cb49b 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -2159,7 +2159,7 @@ function _get_comment_reply_id( $post = null ) { * @type bool $short_ping Whether to output short pings. Default false. * @type bool $echo Whether to echo the output or return it. Default true. * } - * @param WP_Comment[] $comments Optional. Array of WP_Comment objects. + * @param WP_Comment[] $comments Optional. Array of WP_Comment objects. Default null. * @return void|string Void if 'echo' argument is true, or no comments to list. * Otherwise, HTML list of comments. */ diff --git a/wp-includes/comment.php b/wp-includes/comment.php index e7fef9a020..b1a1d46c4a 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -155,7 +155,13 @@ function check_comment( $author, $email, $url, $comment, $user_ip, $user_agent, * @since 4.1.0 Refactored to leverage WP_Comment_Query over a direct query. * * @param int $post_id The ID of the post. - * @param array $args Optional. See WP_Comment_Query::__construct() for information on accepted arguments. + * @param array $args { + * Optional. See WP_Comment_Query::__construct() for information on accepted arguments. + * + * @type int $status Comment status to limit results by. Defaults to approved comments. + * @type int $post_id Limit results to those affiliated with a given post ID. + * @type string $order How to order retrieved comments. Default 'ASC'. + * } * @return WP_Comment[]|int[]|int The approved comments, or number of comments if `$count` * argument is true. */ @@ -236,7 +242,7 @@ function get_comment( $comment = null, $output = OBJECT ) { * @since 2.7.0 * * @param string|array $args Optional. Array or string of arguments. See WP_Comment_Query::__construct() - * for information on accepted arguments. Default empty. + * for information on accepted arguments. Default empty string. * @return WP_Comment[]|int[]|int List of comments or number of found comments if `$count` argument is true. */ function get_comments( $args = '' ) { @@ -449,7 +455,7 @@ function add_comment_meta( $comment_id, $meta_key, $meta_value, $unique = false * @param string $meta_key Metadata name. * @param mixed $meta_value Optional. Metadata value. If provided, * rows will only be removed that match the value. - * Must be serializable if non-scalar. Default empty. + * Must be serializable if non-scalar. Default empty string. * @return bool True on success, false on failure. */ function delete_comment_meta( $comment_id, $meta_key, $meta_value = '' ) { @@ -465,7 +471,7 @@ function delete_comment_meta( $comment_id, $meta_key, $meta_value = '' ) { * * @param int $comment_id Comment ID. * @param string $key Optional. The meta key to retrieve. By default, - * returns data for all keys. + * returns data for all keys. Default empty string. * @param bool $single Optional. Whether to return a single value. * This parameter has no effect if `$key` is not specified. * Default false. @@ -495,7 +501,7 @@ function get_comment_meta( $comment_id, $key = '', $single = false ) { * @param mixed $meta_value Metadata value. Must be serializable if non-scalar. * @param mixed $prev_value Optional. Previous value to check before updating. * If specified, only update existing metadata entries with - * this value. Otherwise, update all entries. Default empty. + * this value. Otherwise, update all entries. Default empty string. * @return int|bool Meta ID if the key didn't exist, true on successful update, * false on failure or if the value passed to the function * is the same as the one that is already in the database. @@ -985,8 +991,10 @@ function separate_comments( &$comments ) { * @global WP_Query $wp_query WordPress Query object. * * @param WP_Comment[] $comments Optional. Array of WP_Comment objects. Defaults to `$wp_query->comments`. - * @param int $per_page Optional. Comments per page. - * @param bool $threaded Optional. Control over flat or threaded comments. + * @param int $per_page Optional. Comments per page. Defaults to the value of `comments_per_page` + * query var, option of the same name, or 1 (in that order). + * @param bool $threaded Optional. Control over flat or threaded comments. Defaults to the value + * of `thread_comments` option. * @return int Number of comment pages. */ function get_comment_pages_count( $comments = null, $per_page = null, $threaded = null ) { diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 0c51e9d7ab..c0c2725aa7 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1049,7 +1049,7 @@ function build_query( $data ) { * Default null. * @param string $sep Optional. Argument separator; defaults to 'arg_separator.output'. * Default null. - * @param string $key Optional. Used to prefix key name. Default empty. + * @param string $key Optional. Used to prefix key name. Default empty string. * @param bool $urlencode Optional. Whether to use urlencode() in the result. Default true. * @return string The query string. */ @@ -1438,6 +1438,7 @@ function get_status_header_desc( $code ) { * * @param int $code HTTP status code. * @param string $description Optional. A custom description for the HTTP status. + * Defaults to the result of get_status_header_desc() for the given code. */ function status_header( $code, $description = '' ) { if ( ! $description ) { @@ -3000,6 +3001,7 @@ function wp_get_default_extension_for_mime_type( $mime_type ) { * * @param string $filename File name or path. * @param string[] $mimes Optional. Array of allowed mime types keyed by their file extension regex. + * Defaults to the result of get_allowed_mime_types(). * @return array { * Values for the extension and mime type. * @@ -3042,6 +3044,7 @@ function wp_check_filetype( $filename, $mimes = null ) { * @param string $filename The name of the file (may differ from $file due to $file being * in a tmp directory). * @param string[] $mimes Optional. Array of allowed mime types keyed by their file extension regex. + * Defaults to the result of get_allowed_mime_types(). * @return array { * Values for the extension, mime type, and corrected filename. * @@ -3618,11 +3621,11 @@ function wp_nonce_ays( $action ) { * * @param string|WP_Error $message Optional. Error message. If this is a WP_Error object, * and not an Ajax or XML-RPC request, the error's messages are used. - * Default empty. + * Default empty string. * @param string|int $title Optional. Error title. If `$message` is a `WP_Error` object, * error data with the key 'title' may be used to specify the title. - * If `$title` is an integer, then it is treated as the response - * code. Default empty. + * If `$title` is an integer, then it is treated as the response code. + * Default empty string. * @param string|array|int $args { * Optional. Arguments to control behavior. If `$args` is an integer, then it is treated * as the response code. Default empty array. @@ -3725,7 +3728,7 @@ function wp_die( $message = '', $title = '', $args = array() ) { * @access private * * @param string|WP_Error $message Error message or WP_Error object. - * @param string $title Optional. Error title. Default empty. + * @param string $title Optional. Error title. Default empty string. * @param string|array $args Optional. Arguments to control behavior. Default empty array. */ function _default_wp_die_handler( $message, $title = '', $args = array() ) { @@ -3927,7 +3930,7 @@ function _default_wp_die_handler( $message, $title = '', $args = array() ) { * @access private * * @param string $message Error message. - * @param string $title Optional. Error title (unused). Default empty. + * @param string $title Optional. Error title (unused). Default empty string. * @param string|array $args Optional. Arguments to control behavior. Default empty array. */ function _ajax_wp_die_handler( $message, $title = '', $args = array() ) { @@ -3969,7 +3972,7 @@ function _ajax_wp_die_handler( $message, $title = '', $args = array() ) { * @access private * * @param string $message Error message. - * @param string $title Optional. Error title. Default empty. + * @param string $title Optional. Error title. Default empty string. * @param string|array $args Optional. Arguments to control behavior. Default empty array. */ function _json_wp_die_handler( $message, $title = '', $args = array() ) { @@ -4007,7 +4010,7 @@ function _json_wp_die_handler( $message, $title = '', $args = array() ) { * @access private * * @param string $message Error message. - * @param string $title Optional. Error title. Default empty. + * @param string $title Optional. Error title. Default empty string. * @param string|array $args Optional. Arguments to control behavior. Default empty array. */ function _jsonp_wp_die_handler( $message, $title = '', $args = array() ) { @@ -4051,7 +4054,7 @@ function _jsonp_wp_die_handler( $message, $title = '', $args = array() ) { * @global wp_xmlrpc_server $wp_xmlrpc_server * * @param string $message Error message. - * @param string $title Optional. Error title. Default empty. + * @param string $title Optional. Error title. Default empty string. * @param string|array $args Optional. Arguments to control behavior. Default empty array. */ function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) { @@ -4081,7 +4084,7 @@ function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) { * @access private * * @param string $message Error message. - * @param string $title Optional. Error title. Default empty. + * @param string $title Optional. Error title. Default empty string. * @param string|array $args Optional. Arguments to control behavior. Default empty array. */ function _xml_wp_die_handler( $message, $title = '', $args = array() ) { @@ -4125,8 +4128,8 @@ EOD; * @since 5.1.0 Added the $title and $args parameters. * @access private * - * @param string $message Optional. Response to print. Default empty. - * @param string $title Optional. Error title (unused). Default empty. + * @param string $message Optional. Response to print. Default empty string. + * @param string $title Optional. Error title (unused). Default empty string. * @param string|array $args Optional. Arguments to control behavior. Default empty array. */ function _scalar_wp_die_handler( $message = '', $title = '', $args = array() ) { @@ -4151,7 +4154,7 @@ function _scalar_wp_die_handler( $message = '', $title = '', $args = array() ) { * @access private * * @param string|WP_Error $message Error message or WP_Error object. - * @param string $title Optional. Error title. Default empty. + * @param string $title Optional. Error title. Default empty string. * @param string|array $args Optional. Arguments to control behavior. Default empty array. * @return array { * Processed arguments. @@ -4518,7 +4521,7 @@ function wp_check_jsonp_callback( $callback ) { * Optional. Options to be used with `json_decode()`. * * @type bool $associative Optional. When `true`, JSON objects will be returned as associative arrays. - * When `false`, JSON objects will be returned as objects. + * When `false`, JSON objects will be returned as objects. Default false. * } * * @return mixed Returns the value encoded in JSON in appropriate PHP type. @@ -5370,7 +5373,7 @@ function absint( $maybeint ) { * * @param string $function_name The function that was called. * @param string $version The version of WordPress that deprecated the function. - * @param string $replacement Optional. The function that should have been called. Default empty. + * @param string $replacement Optional. The function that should have been called. Default empty string. */ function _deprecated_function( $function_name, $version, $replacement = '' ) { @@ -5556,8 +5559,8 @@ function _deprecated_constructor( $class_name, $version, $parent_class = '' ) { * @param string $file The file that was included. * @param string $version The version of WordPress that deprecated the file. * @param string $replacement Optional. The file that should have been included based on ABSPATH. - * Default empty. - * @param string $message Optional. A message regarding the change. Default empty. + * Default empty string. + * @param string $message Optional. A message regarding the change. Default empty string. */ function _deprecated_file( $file, $version, $replacement = '', $message = '' ) { @@ -5654,7 +5657,7 @@ function _deprecated_file( $file, $version, $replacement = '', $message = '' ) { * * @param string $function_name The function that was called. * @param string $version The version of WordPress that deprecated the argument used. - * @param string $message Optional. A message regarding the change. Default empty. + * @param string $message Optional. A message regarding the change. Default empty string. */ function _deprecated_argument( $function_name, $version, $message = '' ) { @@ -5742,7 +5745,7 @@ function _deprecated_argument( $function_name, $version, $message = '' ) { * * @param string $hook The hook that was used. * @param string $version The version of WordPress that deprecated the hook. - * @param string $replacement Optional. The hook that should have been used. Default empty. + * @param string $replacement Optional. The hook that should have been used. Default empty string. * @param string $message Optional. A message regarding the change. Default empty. */ function _deprecated_hook( $hook, $version, $replacement = '', $message = '' ) { @@ -5986,7 +5989,7 @@ function iis7_supports_permalinks() { * @since 1.2.0 * * @param string $file File path. - * @param string[] $allowed_files Optional. Array of allowed files. + * @param string[] $allowed_files Optional. Array of allowed files. Default empty array. * @return int 0 means nothing is wrong, greater than 0 means something was wrong. */ function validate_file( $file, $allowed_files = array() ) { @@ -6104,7 +6107,8 @@ function wp_guess_url() { * @since 3.3.0 * * @param bool $suspend Optional. Suspends additions if true, re-enables them if false. - * @return bool The current suspend setting + * Defaults to not changing the current setting. + * @return bool The current suspend setting. */ function wp_suspend_cache_addition( $suspend = null ) { static $_suspend = false; @@ -6635,7 +6639,7 @@ function wp_scheduled_delete() { * @param string $file Absolute path to the file. * @param array $default_headers List of headers, in the format `array( 'HeaderKey' => 'Header Name' )`. * @param string $context Optional. If specified adds filter hook {@see 'extra_$context_headers'}. - * Default empty. + * Default empty string. * @return string[] Array of file header values keyed by header name. */ function get_file_data( $file, $default_headers, $context = '' ) { @@ -6809,8 +6813,8 @@ function _wp_mysql_week( $column ) { * @param callable $callback Function that accepts ( ID, $callback_args ) and outputs parent_ID. * @param int $start The ID to start the loop check at. * @param int $start_parent The parent_ID of $start to use instead of calling $callback( $start ). - * Use null to always use $callback - * @param array $callback_args Optional. Additional arguments to send to $callback. + * Use null to always use $callback. + * @param array $callback_args Optional. Additional arguments to send to $callback. Default empty array. * @return array IDs of all members of loop. */ function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) { @@ -7813,7 +7817,7 @@ function wp_privacy_anonymize_ip( $ip_addr, $ipv6_fallback = false ) { * @since 4.9.6 * * @param string $type The type of data to be anonymized. - * @param string $data Optional The data to be anonymized. + * @param string $data Optional. The data to be anonymized. Default empty string. * @return string The anonymous data for the requested type. */ function wp_privacy_anonymize_data( $type, $data = '' ) { @@ -8246,10 +8250,13 @@ function get_dirsize( $directory, $max_execution_time = null ) { * @param string $directory Full path of a directory. * @param string|string[] $exclude Optional. Full path of a subdirectory to exclude from the total, * or array of paths. Expected without trailing slash(es). + * Default null. * @param int $max_execution_time Optional. Maximum time to run before giving up. In seconds. * The timeout is global and is measured from the moment - * WordPress started to load. + * WordPress started to load. Defaults to the value of + * `max_execution_time` PHP setting. * @param array $directory_cache Optional. Array of cached directory paths. + * Defaults to the value of `dirsize_cache` transient. * @return int|false|null Size in bytes if a valid directory. False if not. Null if timeout. */ function recurse_dirsize( $directory, $exclude = null, $max_execution_time = null, &$directory_cache = null ) { diff --git a/wp-includes/meta.php b/wp-includes/meta.php index 73b883d10b..6b361aaa5e 100644 --- a/wp-includes/meta.php +++ b/wp-includes/meta.php @@ -171,7 +171,7 @@ function add_metadata( $meta_type, $object_id, $meta_key, $meta_value, $unique = * @param mixed $meta_value Metadata value. Must be serializable if non-scalar. * @param mixed $prev_value Optional. Previous value to check before updating. * If specified, only update existing metadata entries with - * this value. Otherwise, update all entries. Default empty. + * this value. Otherwise, update all entries. Default empty string. * @return int|bool The new meta field ID if a field with the given key didn't exist * and was therefore added, true on successful update, * false on failure or if the value passed to the function @@ -369,6 +369,7 @@ function update_metadata( $meta_type, $object_id, $meta_key, $meta_value, $prev_ * Pass `null`, `false`, or an empty string to skip this check. * (For backward compatibility, it is not possible to pass an empty string * to delete those entries with an empty string for a value.) + * Default empty string. * @param bool $delete_all Optional. If true, delete matching metadata entries for all objects, * ignoring the specified object_id. Otherwise, only delete * matching metadata entries for the specified object_id. Default false. @@ -558,7 +559,7 @@ function delete_metadata( $meta_type, $object_id, $meta_key, $meta_value = '', $ * or any other object type with an associated meta table. * @param int $object_id ID of the object metadata is for. * @param string $meta_key Optional. Metadata key. If not specified, retrieve all metadata for - * the specified object. Default empty. + * the specified object. Default empty string. * @param bool $single Optional. If true, return only the first value of the specified `$meta_key`. * This parameter has no effect if `$meta_key` is not specified. Default false. * @return mixed An array of values if `$single` is false. @@ -585,7 +586,7 @@ function get_metadata( $meta_type, $object_id, $meta_key = '', $single = false ) * or any other object type with an associated meta table. * @param int $object_id ID of the object metadata is for. * @param string $meta_key Optional. Metadata key. If not specified, retrieve all metadata for - * the specified object. Default empty. + * the specified object. Default empty string. * @param bool $single Optional. If true, return only the first value of the specified `$meta_key`. * This parameter has no effect if `$meta_key` is not specified. Default false. * @return mixed An array of values if `$single` is false. @@ -1230,7 +1231,7 @@ function wp_metadata_lazyloader() { * @param string $type Type of meta. * @param string $primary_table Primary database table name. * @param string $primary_id_column Primary ID column name. - * @param object $context Optional. The main query object + * @param object $context Optional. The main query object. Default null. * @return string[]|false { * Array containing JOIN and WHERE SQL clauses to append to the main query, * or false if no table exists for the requested meta type. @@ -1274,7 +1275,7 @@ function _get_meta_table( $type ) { * * @param string $meta_key Metadata key. * @param string $meta_type Optional. Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', - * or any other object type with an associated meta table. Default empty. + * or any other object type with an associated meta table. Default empty string. * @return bool Whether the meta key is considered protected. */ function is_protected_meta( $meta_key, $meta_type = '' ) { @@ -1304,7 +1305,7 @@ function is_protected_meta( $meta_key, $meta_type = '' ) { * @param mixed $meta_value Metadata value to sanitize. * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', * or any other object type with an associated meta table. - * @param string $object_subtype Optional. The subtype of the object type. + * @param string $object_subtype Optional. The subtype of the object type. Default empty string. * @return mixed Sanitized $meta_value. */ function sanitize_meta( $meta_key, $meta_value, $object_type, $object_subtype = '' ) { @@ -1580,7 +1581,7 @@ function filter_default_metadata( $value, $object_id, $meta_key, $single, $meta_ * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', * or any other object type with an associated meta table. * @param string $meta_key Metadata key. - * @param string $object_subtype Optional. The subtype of the object type. + * @param string $object_subtype Optional. The subtype of the object type. Default empty string. * @return bool True if the meta key is registered to the object type and, if provided, * the object subtype. False if not. */ @@ -1599,7 +1600,7 @@ function registered_meta_key_exists( $object_type, $meta_key, $object_subtype = * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', * or any other object type with an associated meta table. * @param string $meta_key Metadata key. - * @param string $object_subtype Optional. The subtype of the object type. + * @param string $object_subtype Optional. The subtype of the object type. Default empty string. * @return bool True if successful. False if the meta key was not registered. */ function unregister_meta_key( $object_type, $meta_key, $object_subtype = '' ) { @@ -1648,7 +1649,7 @@ function unregister_meta_key( $object_type, $meta_key, $object_subtype = '' ) { * * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', * or any other object type with an associated meta table. - * @param string $object_subtype Optional. The subtype of the object type. + * @param string $object_subtype Optional. The subtype of the object type. Default empty string. * @return array[] List of registered metadata args, keyed by their meta keys. */ function get_registered_meta_keys( $object_type, $object_subtype = '' ) { diff --git a/wp-includes/ms-blogs.php b/wp-includes/ms-blogs.php index 9f2916d7f9..19594eef6b 100644 --- a/wp-includes/ms-blogs.php +++ b/wp-includes/ms-blogs.php @@ -120,7 +120,7 @@ function get_id_from_blogname( $slug ) { * @global wpdb $wpdb WordPress database abstraction object. * * @param int|string|array $fields Optional. A blog ID, a blog slug, or an array of fields to query against. - * If not specified the current blog ID is used. + * Defaults to the current blog ID. * @param bool $get_all Whether to retrieve all details or only the details in the blogs table. * Default is true. * @return WP_Site|false Blog details on success. False on failure. @@ -397,7 +397,7 @@ function get_blog_option( $id, $option, $default_value = false ) { * * @param int $id A blog ID. Can be null to refer to the current blog. * @param string $option Name of option to add. Expected to not be SQL-escaped. - * @param mixed $value Optional. Option value, can be anything. Expected to not be SQL-escaped. + * @param mixed $value Option value, can be anything. Expected to not be SQL-escaped. * @return bool True if the option was added, false otherwise. */ function add_blog_option( $id, $option, $value ) { diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php index edc482d466..9a382c5174 100644 --- a/wp-includes/ms-functions.php +++ b/wp-includes/ms-functions.php @@ -330,7 +330,7 @@ function get_blog_permalink( $blog_id, $post_id ) { * @global wpdb $wpdb WordPress database abstraction object. * * @param string $domain Website domain. - * @param string $path Optional. Not required for subdomain installations. + * @param string $path Optional. Not required for subdomain installations. Default '/'. * @return int 0 if no blog found, otherwise the ID of the matching blog. */ function get_blog_id_from_url( $domain, $path = '/' ) { @@ -606,6 +606,7 @@ function wpmu_validate_user_signup( $user_name, $user_email ) { * @param string $blogname The blog name provided by the user. Must be unique. * @param string $blog_title The blog title provided by the user. * @param WP_User|string $user Optional. The user object to check against the new site name. + * Default empty string. * @return array { * Array of domain, path, blog name, blog title, user and error messages. * @@ -1354,6 +1355,7 @@ function wpmu_create_user( $user_name, $password, $email ) { * updated. Otherwise, keys and values will be used to set options for * the new site. Default empty array. * @param int $network_id Optional. Network ID. Only relevant on multi-network installations. + * Default 1. * @return int|WP_Error Returns WP_Error object on failure, the new site ID on success. */ function wpmu_create_blog( $domain, $path, $title, $user_id, $options = array(), $network_id = 1 ) { @@ -1539,7 +1541,8 @@ Disable these notifications: %3$s' * * @param string $domain The domain to be checked. * @param string $path The path to be checked. - * @param int $network_id Optional. Network ID. Relevant only on multi-network installations. + * @param int $network_id Optional. Network ID. Only relevant on multi-network installations. + * Default 1. * @return int|null The site ID if the site name exists, null otherwise. */ function domain_exists( $domain, $path, $network_id = 1 ) { @@ -1566,7 +1569,7 @@ function domain_exists( $domain, $path, $network_id = 1 ) { * @param int|null $result The site ID if the site name exists, null otherwise. * @param string $domain Domain to be checked. * @param string $path Path to be checked. - * @param int $network_id Network ID. Relevant only on multi-network installations. + * @param int $network_id Network ID. Only relevant on multi-network installations. */ return apply_filters( 'domain_exists', $result, $domain, $path, $network_id ); } diff --git a/wp-includes/post-formats.php b/wp-includes/post-formats.php index 11b6d63de6..282670bd21 100644 --- a/wp-includes/post-formats.php +++ b/wp-includes/post-formats.php @@ -41,7 +41,7 @@ function get_post_format( $post = null ) { * * @since 3.1.0 * - * @param string|string[] $format Optional. The format or formats to check. + * @param string|string[] $format Optional. The format or formats to check. Default empty array. * @param WP_Post|int|null $post Optional. The post to check. Defaults to the current post in the loop. * @return bool True if the post has any of the given formats (or any format, if no format specified), * false otherwise. diff --git a/wp-includes/revision.php b/wp-includes/revision.php index 5433d0a5ce..783bd06e15 100644 --- a/wp-includes/revision.php +++ b/wp-includes/revision.php @@ -260,7 +260,7 @@ function wp_save_post_revision( $post_id ) { * @global wpdb $wpdb WordPress database abstraction object. * * @param int $post_id The post ID. - * @param int $user_id Optional. The post author ID. + * @param int $user_id Optional. The post author ID. Default 0. * @return WP_Post|false The autosaved data or false on failure or when no autosave exists. */ function wp_get_post_autosave( $post_id, $user_id = 0 ) { @@ -343,6 +343,7 @@ function wp_is_post_autosave( $post ) { * * @param int|WP_Post|array|null $post Post ID, post object OR post array. * @param bool $autosave Optional. Whether the revision is an autosave or not. + * Default false. * @return int|WP_Error WP_Error or 0 if error, new revision ID if success. */ function _wp_put_post_revision( $post = null, $autosave = false ) { @@ -391,7 +392,7 @@ function _wp_put_post_revision( $post = null, $autosave = false ) { * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which * correspond to a WP_Post object, an associative array, or a numeric array, * respectively. Default OBJECT. - * @param string $filter Optional sanitization filter. See sanitize_post(). + * @param string $filter Optional sanitization filter. See sanitize_post(). Default 'raw'. * @return WP_Post|array|null WP_Post (or array) on success, or null on failure. */ function wp_get_post_revision( &$post, $output = OBJECT, $filter = 'raw' ) { diff --git a/wp-includes/rss.php b/wp-includes/rss.php index 455b6ecbaf..45e543c09c 100644 --- a/wp-includes/rss.php +++ b/wp-includes/rss.php @@ -541,7 +541,7 @@ endif; * @subpackage MagpieRSS * * @param string $url URL to retrieve - * @param array $headers Optional. Headers to send to the URL. + * @param array $headers Optional. Headers to send to the URL. Default empty string. * @return Snoopy style response */ function _fetch_remote_file($url, $headers = "" ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 8f61c3eff2..42b3d7c24b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.2-beta2-55397'; +$wp_version = '6.2-beta2-55398'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.