From 25ea9680aecaf4791c870658fd8085c10622ad05 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 17 Nov 2022 18:15:19 +0000 Subject: [PATCH] Docs: Update various DocBlocks and inline comments per the documentation standards. Includes minor formatting edits for consistency. Follow-up to [53/tests], [12179], [12946], [35288], [37884], [38810], [38928], [46596], [48131], [52955], [53548], [53813], [53873], [54118], [54316], [54420], [54421], [54803]. See #56792. Built from https://develop.svn.wordpress.org/trunk@54855 git-svn-id: http://core.svn.wordpress.org/trunk@54407 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/nav-menu.js | 4 ++-- wp-includes/class-wp-list-util.php | 7 ++++--- wp-includes/compat.php | 2 +- wp-includes/functions.php | 11 +++++----- wp-includes/l10n.php | 15 +++++++------- wp-includes/load.php | 4 ++-- wp-includes/post.php | 7 +++---- wp-includes/rest-api/class-wp-rest-server.php | 6 +++--- .../class-wp-rest-posts-controller.php | 20 ++++++++++--------- .../providers/class-wp-sitemaps-posts.php | 2 +- wp-includes/taxonomy.php | 4 ++-- wp-includes/theme.php | 2 +- wp-includes/version.php | 2 +- 13 files changed, 45 insertions(+), 41 deletions(-) diff --git a/wp-admin/js/nav-menu.js b/wp-admin/js/nav-menu.js index 10b1330a8d..9877f78217 100644 --- a/wp-admin/js/nav-menu.js +++ b/wp-admin/js/nav-menu.js @@ -1557,14 +1557,14 @@ }); }); - // Show bulk action + // Show bulk action. $( document ).on( 'menu-item-added', function() { if ( ! $( '.bulk-actions' ).is( ':visible' ) ) { $( '.bulk-actions' ).show(); } } ); - // Hide bulk action + // Hide bulk action. $( document ).on( 'menu-removing-item', function( e, el ) { var menuElement = $( el ).parents( '#menu-to-edit' ); if ( menuElement.find( 'li' ).length === 1 && $( '.bulk-actions' ).is( ':visible' ) ) { diff --git a/wp-includes/class-wp-list-util.php b/wp-includes/class-wp-list-util.php index a2ccfb5412..3648cd89f5 100644 --- a/wp-includes/class-wp-list-util.php +++ b/wp-includes/class-wp-list-util.php @@ -207,9 +207,10 @@ class WP_List_Util { * @since 4.7.0 * * @param string|array $orderby Optional. Either the field name to order by or an array - * of multiple orderby fields as $orderby => $order. - * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if $orderby - * is a string. + * of multiple orderby fields as `$orderby => $order`. + * Default empty array. + * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if `$orderby` + * is a string. Default 'ASC'. * @param bool $preserve_keys Optional. Whether to preserve keys. Default false. * @return array The sorted array. */ diff --git a/wp-includes/compat.php b/wp-includes/compat.php index 60e8c0772b..31112336c6 100644 --- a/wp-includes/compat.php +++ b/wp-includes/compat.php @@ -156,7 +156,7 @@ endif; /** * Internal compat function to mimic mb_strlen(). * - * Only understands UTF-8 and 8bit. All other character sets will be treated as 8bit. + * Only understands UTF-8 and 8bit. All other character sets will be treated as 8bit. * For `$encoding === UTF-8`, the `$str` input is expected to be a valid UTF-8 byte * sequence. The behavior of this function for invalid inputs is undefined. * diff --git a/wp-includes/functions.php b/wp-includes/functions.php index a38c78ccac..716be80980 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -934,7 +934,7 @@ function do_enclose( $content, $post ) { * @since 4.4.0 * * @param string[] $post_links An array of enclosure links. - * @param int $post_ID Post ID. + * @param int $post_id Post ID. */ $post_links = apply_filters( 'enclosure_links', $post_links, $post->ID ); @@ -3330,7 +3330,7 @@ function wp_get_mime_types() { * @since 3.5.0 * * @param string[] $wp_get_mime_types Mime types keyed by the file extension regex - * corresponding to those types. + * corresponding to those types. */ return apply_filters( 'mime_types', @@ -5200,9 +5200,10 @@ function wp_list_pluck( $list, $field, $index_key = null ) { * * @param array $list An array of objects or arrays to sort. * @param string|array $orderby Optional. Either the field name to order by or an array - * of multiple orderby fields as $orderby => $order. - * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if $orderby - * is a string. + * of multiple orderby fields as `$orderby => $order`. + * Default empty array. + * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if `$orderby` + * is a string. Default 'ASC'. * @param bool $preserve_keys Optional. Whether to preserve keys. Default false. * @return array The sorted array. */ diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php index c5148a02e8..40c653fdbe 100644 --- a/wp-includes/l10n.php +++ b/wp-includes/l10n.php @@ -176,7 +176,7 @@ function determine_locale() { * *Note:* Don't use translate() directly, use __() or related functions. * * @since 2.2.0 - * @since 5.5.0 Introduced gettext-{$domain} filter. + * @since 5.5.0 Introduced `gettext-{$domain}` filter. * * @param string $text Text to translate. * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. @@ -242,7 +242,7 @@ function before_last_bar( $string ) { * *Note:* Don't use translate_with_gettext_context() directly, use _x() or related functions. * * @since 2.8.0 - * @since 5.5.0 Introduced gettext_with_context-{$domain} filter. + * @since 5.5.0 Introduced `gettext_with_context-{$domain}` filter. * * @param string $text Text to translate. * @param string $context Context information for the translators. @@ -463,7 +463,7 @@ function esc_html_x( $text, $context, $domain = 'default' ) { * printf( _n( '%s person', '%s people', $count, 'text-domain' ), number_format_i18n( $count ) ); * * @since 2.8.0 - * @since 5.5.0 Introduced ngettext-{$domain} filter. + * @since 5.5.0 Introduced `ngettext-{$domain}` filter. * * @param string $single The text to be used if the number is singular. * @param string $plural The text to be used if the number is plural. @@ -521,7 +521,7 @@ function _n( $single, $plural, $number, $domain = 'default' ) { * printf( _nx( '%s group', '%s groups', $animals, 'group of animals', 'text-domain' ), number_format_i18n( $animals ) ); * * @since 2.8.0 - * @since 5.5.0 Introduced ngettext_with_context-{$domain} filter. + * @since 5.5.0 Introduced `ngettext_with_context-{$domain}` filter. * * @param string $single The text to be used if the number is singular. * @param string $plural The text to be used if the number is plural. @@ -1022,9 +1022,9 @@ function load_theme_textdomain( $domain, $path = false ) { } /** - * Loads the child themes translated strings. + * Loads the child theme's translated strings. * - * If the current locale exists as a .mo file in the child themes + * If the current locale exists as a .mo file in the child theme's * root directory, it will be included in the translated strings by the $domain. * * The .mo files must be named based on the locale exactly. @@ -1361,7 +1361,8 @@ function translate_user_role( $name, $domain = 'default' ) { * * @param string $dir A directory to search for language files. * Default WP_LANG_DIR. - * @return string[] An array of language codes or an empty array if no languages are present. Language codes are formed by stripping the .mo extension from the language file names. + * @return string[] An array of language codes or an empty array if no languages are present. + * Language codes are formed by stripping the .mo extension from the language file names. */ function get_available_languages( $dir = null ) { $languages = array(); diff --git a/wp-includes/load.php b/wp-includes/load.php index 3cf4b0d207..52453802c0 100644 --- a/wp-includes/load.php +++ b/wp-includes/load.php @@ -1322,10 +1322,10 @@ function get_current_network_id() { * @access private * * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry. - * @global WP_Locale $wp_locale WordPress date and time locale object. + * @global WP_Locale $wp_locale WordPress date and time locale object. */ function wp_load_translations_early() { - global $wp_locale, $wp_textdomain_registry; + global $wp_textdomain_registry, $wp_locale; static $loaded = false; if ( $loaded ) { diff --git a/wp-includes/post.php b/wp-includes/post.php index 70e05f9f73..185d2d5a08 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -1547,9 +1547,8 @@ function get_post_types( $args = array(), $output = 'names', $operator = 'and' ) * * @global array $wp_post_types List of post types. * - * @param string $post_type Post type key. Must not exceed 20 characters and may - * only contain lowercase alphanumeric characters, dashes, - * and underscores. See sanitize_key(). + * @param string $post_type Post type key. Must not exceed 20 characters and may only contain + * lowercase alphanumeric characters, dashes, and underscores. See sanitize_key(). * @param array|string $args { * Array or string of arguments for registering a post type. * @@ -4198,7 +4197,7 @@ function wp_insert_post( $postarr, $wp_error = false, $fire_after_hooks = true ) if ( $update && strtolower( urlencode( $post_name ) ) == $check_name && get_post_field( 'post_name', $post_ID ) == $check_name ) { $post_name = $check_name; - } else { // new post, or slug has changed. + } else { // New post, or slug has changed. $post_name = sanitize_title( $post_name ); } } diff --git a/wp-includes/rest-api/class-wp-rest-server.php b/wp-includes/rest-api/class-wp-rest-server.php index 1690a00eb8..0770c97a4a 100644 --- a/wp-includes/rest-api/class-wp-rest-server.php +++ b/wp-includes/rest-api/class-wp-rest-server.php @@ -553,7 +553,7 @@ class WP_REST_Server { * Converts a response to data to send. * * @since 4.4.0 - * @since 5.4.0 The $embed parameter can now contain a list of link relations to include. + * @since 5.4.0 The `$embed` parameter can now contain a list of link relations to include. * * @param WP_REST_Response $response Response object. * @param bool|string[] $embed Whether to embed all links, a filtered list of link relations, or no links. @@ -677,7 +677,7 @@ class WP_REST_Server { * Embeds the links from the data into the request. * * @since 4.4.0 - * @since 5.4.0 The $embed parameter can now contain a list of link relations to include. + * @since 5.4.0 The `$embed` parameter can now contain a list of link relations to include. * * @param array $data Data from the request. * @param bool|string[] $embed Whether to embed all links or a filtered list of link relations. @@ -759,7 +759,7 @@ class WP_REST_Server { * data instead. * * @since 4.4.0 - * @since 6.0.0 The $embed parameter can now contain a list of link relations to include + * @since 6.0.0 The `$embed` parameter can now contain a list of link relations to include. * * @param WP_REST_Response $response Response object. * @param bool|string[] $embed Whether to embed all links, a filtered list of link relations, or no links. diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php index 571a2fd5f4..94e067dfb3 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php @@ -659,11 +659,9 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { && in_array( $prepared_post->post_status, array( 'draft', 'pending' ), true ) ) { /* - * `wp_unique_post_slug()` returns the same - * slug for 'draft' or 'pending' posts. + * `wp_unique_post_slug()` returns the same slug for 'draft' or 'pending' posts. * - * To ensure that a unique slug is generated, - * pass the post data with the 'publish' status. + * To ensure that a unique slug is generated, pass the post data with the 'publish' status. */ $prepared_post->post_name = wp_unique_post_slug( $prepared_post->post_name, @@ -862,15 +860,19 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { } /* - * `wp_unique_post_slug()` returns the same - * slug for 'draft' or 'pending' posts. + * `wp_unique_post_slug()` returns the same slug for 'draft' or 'pending' posts. * - * To ensure that a unique slug is generated, - * pass the post data with the 'publish' status. + * To ensure that a unique slug is generated, pass the post data with the 'publish' status. */ if ( ! empty( $post->post_name ) && in_array( $post_status, array( 'draft', 'pending' ), true ) ) { $post_parent = ! empty( $post->post_parent ) ? $post->post_parent : 0; - $post->post_name = wp_unique_post_slug( $post->post_name, $post->ID, 'publish', $post->post_type, $post_parent ); + $post->post_name = wp_unique_post_slug( + $post->post_name, + $post->ID, + 'publish', + $post->post_type, + $post_parent + ); } // Convert the post object to an array, otherwise wp_update_post() will expect non-escaped input. diff --git a/wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php b/wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php index a545478771..dff85a70e1 100644 --- a/wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php +++ b/wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php @@ -221,7 +221,7 @@ class WP_Sitemaps_Posts extends WP_Sitemaps_Provider { 'no_found_rows' => true, 'update_post_term_cache' => false, 'update_post_meta_cache' => false, - 'ignore_sticky_posts' => true, // sticky posts will still appear, but they won't be moved to the front. + 'ignore_sticky_posts' => true, // Sticky posts will still appear, but they won't be moved to the front. ), $post_type ); diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 5b70968185..ac73242b5c 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -390,8 +390,8 @@ function is_taxonomy_hierarchical( $taxonomy ) { * * @global WP_Taxonomy[] $wp_taxonomies Registered taxonomies. * - * @param string $taxonomy Taxonomy key, must not exceed 32 characters and may only contain lowercase alphanumeric - * characters, dashes, and underscores. See sanitize_key(). + * @param string $taxonomy Taxonomy key. Must not exceed 32 characters and may only contain + * lowercase alphanumeric characters, dashes, and underscores. See sanitize_key(). * @param array|string $object_type Object type or array of object types with which the taxonomy should be associated. * @param array|string $args { * Optional. Array or query string of arguments for registering a taxonomy. diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 6eab6fcc00..61d5c13284 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -3567,7 +3567,7 @@ function _wp_customize_publish_changeset( $new_status, $old_status, $changeset_p remove_action( 'customize_register', array( $wp_customize, 'register_controls' ) ); $wp_customize->register_controls(); - /** This filter is documented in /wp-includes/class-wp-customize-manager.php */ + /** This filter is documented in wp-includes/class-wp-customize-manager.php */ do_action( 'customize_register', $wp_customize ); } $wp_customize->_publish_changeset_values( $changeset_post->ID ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 3464cf0dd7..419ae90281 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.2-alpha-54854'; +$wp_version = '6.2-alpha-54855'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.