Docs: Increase the specificity of various docblock parameter types and return types.

See #48303
Built from https://develop.svn.wordpress.org/trunk@46823


git-svn-id: http://core.svn.wordpress.org/trunk@46623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2019-12-06 22:43:04 +00:00
parent 15a566edef
commit f93ee2ca76
27 changed files with 79 additions and 79 deletions

View File

@ -144,7 +144,7 @@ $font_sizes = current( (array) get_theme_support( 'editor-font-sizes' ) );
*
* @param bool|array $allowed_block_types Array of block type slugs, or
* boolean to enable/disable all.
* @param object $post The post resource data.
* @param WP_Post $post The post resource data.
*/
$allowed_block_types = apply_filters( 'allowed_block_types', true, $post );

View File

@ -172,8 +172,8 @@ endif;
*
* @since 4.3.0
*
* @param string $html Output HTML to display miscellaneous action.
* @param object $comment Current comment object.
* @param string $html Output HTML to display miscellaneous action.
* @param WP_Comment $comment Current comment object.
*/
echo apply_filters( 'edit_comment_misc_actions', '', $comment );
?>

View File

@ -222,8 +222,8 @@ if ( $location ) {
*
* @since 4.6.0
*
* @param string $location The destination URL.
* @param object $tax The taxonomy object.
* @param string $location The destination URL.
* @param WP_Taxonomy $tax The taxonomy object.
*/
wp_redirect( apply_filters( 'redirect_term_location', $location, $tax ) );
exit;

View File

@ -557,10 +557,10 @@ class WP_Upgrader {
*
* @since 2.8.0
*
* @param mixed $removed Whether the destination was cleared. true on success, WP_Error on failure
* @param string $local_destination The local package destination.
* @param string $remote_destination The remote package destination.
* @param array $hook_extra Extra arguments passed to hooked filters.
* @param true|WP_Error $removed Whether the destination was cleared. true upon success, WP_Error on failure.
* @param string $local_destination The local package destination.
* @param string $remote_destination The remote package destination.
* @param array $hook_extra Extra arguments passed to hooked filters.
*/
$removed = apply_filters( 'upgrader_clear_destination', $removed, $local_destination, $remote_destination, $args['hook_extra'] );

View File

@ -1793,8 +1793,8 @@ function _admin_notice_post_locked() {
*
* @since 2.6.0
*
* @param mixed $post_data Associative array containing the post data or int post ID.
* @return mixed The autosave revision ID. WP_Error or 0 on error.
* @param array|int $post_data Associative array containing the post data or int post ID.
* @return int|WP_Error The autosave revision ID. WP_Error or 0 on error.
*/
function wp_create_post_autosave( $post_data ) {
if ( is_numeric( $post_data ) ) {

View File

@ -12,9 +12,9 @@
*
* @since 3.6.0
*
* @param object|int $post The post object. Also accepts a post ID.
* @param int $compare_from The revision ID to compare from.
* @param int $compare_to The revision ID to come to.
* @param WP_Post|int $post The post object or post ID.
* @param int $compare_from The revision ID to compare from.
* @param int $compare_to The revision ID to come to.
*
* @return array|bool Associative array of a post's revisioned fields and their diffs.
* Or, false on failure.
@ -158,9 +158,9 @@ function wp_get_revision_ui_diff( $post, $compare_from, $compare_to ) {
*
* @since 3.6.0
*
* @param object|int $post The post object. Also accepts a post ID.
* @param int $selected_revision_id The selected revision ID.
* @param int $from Optional. The revision ID to compare from.
* @param WP_Post|int $post The post object or post ID.
* @param int $selected_revision_id The selected revision ID.
* @param int $from Optional. The revision ID to compare from.
*
* @return array An associative array of revision data and related settings.
*/

View File

@ -32,7 +32,7 @@ require_once( ABSPATH . 'wp-admin/includes/class-wp-internal-pointers.php' );
* @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 object $walker Optional. Walker object to use to build the output.
* @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.
@ -68,7 +68,7 @@ function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $select
* @type int[] $selected_cats Array of category IDs to mark as checked. Default false.
* @type int[] $popular_cats Array of category IDs to receive the "popular-category" class.
* Default false.
* @type object $walker Walker object to use to build the output.
* @type Walker $walker Walker object to use to build the output.
* Default is a Walker_Category_Checklist instance.
* @type string $taxonomy Taxonomy to generate the checklist for. Default 'category'.
* @type bool $checked_ontop Whether to move checked items out of the hierarchy and to

View File

@ -1453,9 +1453,9 @@ function has_tag( $tag = '', $post = null ) {
*
* @since 3.1.0
*
* @param string|int|array $term Optional. The term name/term_id/slug or array of them to check for.
* @param string $taxonomy Taxonomy name
* @param int|object $post Optional. Post to check instead of the current post.
* @param string|int|array $term Optional. The term name/term_id/slug or array of them to check for.
* @param string $taxonomy Taxonomy name.
* @param int|WP_Post $post Optional. Post to check instead of the current post.
* @return bool True if the current post has any of the given tags (or any tag, if no tag specified).
*/
function has_term( $term = '', $taxonomy = '', $post = null ) {

View File

@ -39,7 +39,7 @@ final class WP_Customize_Nav_Menus {
*
* @since 4.3.0
*
* @param object $manager An instance of the WP_Customize_Manager class.
* @param WP_Customize_Manager $manager An instance of the WP_Customize_Manager class.
*/
public function __construct( $manager ) {
$this->manager = $manager;

View File

@ -822,10 +822,10 @@ class WP_Meta_Query {
*
* @since 4.1.0
*
* @param string|bool $alias Table alias, or false if none was found.
* @param array $clause First-order query clause.
* @param array $parent_query Parent of $clause.
* @param object $this WP_Meta_Query object.
* @param string|bool $alias Table alias, or false if none was found.
* @param array $clause First-order query clause.
* @param array $parent_query Parent of $clause.
* @param WP_Meta_Query $this WP_Meta_Query object.
*/
return apply_filters( 'meta_query_find_compatible_table_alias', $alias, $clause, $parent_query, $this );
}

View File

@ -1684,9 +1684,9 @@ function wp_get_comment_status( $comment_id ) {
*
* @since 2.7.0
*
* @param string $new_status New comment status.
* @param string $old_status Previous comment status.
* @param object $comment Comment data.
* @param string $new_status New comment status.
* @param string $old_status Previous comment status.
* @param WP_Comment $comment Comment object.
*/
function wp_transition_comment_status( $new_status, $old_status, $comment ) {
/*
@ -1716,7 +1716,7 @@ function wp_transition_comment_status( $new_status, $old_status, $comment ) {
*
* @param int|string $new_status The new comment status.
* @param int|string $old_status The old comment status.
* @param object $comment The comment data.
* @param WP_Comment $comment Comment object.
*/
do_action( 'transition_comment_status', $new_status, $old_status, $comment );
/**

View File

@ -773,8 +773,8 @@ function fetch_feed( $url ) {
*
* @since 3.0.0
*
* @param object $feed SimplePie feed object (passed by reference).
* @param mixed $url URL of feed to retrieve. If an array of URLs, the feeds are merged.
* @param SimplePie $feed SimplePie feed object (passed by reference).
* @param mixed $url URL of feed to retrieve. If an array of URLs, the feeds are merged.
*/
do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) );
$feed->init();

View File

@ -1339,8 +1339,8 @@ function single_post_title( $prefix = '', $display = true ) {
*
* @since 0.71
*
* @param string $_post_title The single post page title.
* @param object $_post The current queried object as returned by get_queried_object().
* @param string $_post_title The single post page title.
* @param WP_Post $_post The current post.
*/
$title = apply_filters( 'single_post_title', $_post->post_title, $_post );
if ( $display ) {

View File

@ -1040,11 +1040,11 @@ function get_edit_term_link( $term_id, $taxonomy = '', $object_type = '' ) {
*
* @since 3.1.0
*
* @param string $link Optional. Anchor text. If empty, default is 'Edit This'. Default empty.
* @param string $before Optional. Display before edit link. Default empty.
* @param string $after Optional. Display after edit link. Default empty.
* @param object $term Optional. Term object. If null, the queried object will be inspected. Default null.
* @param bool $echo Optional. Whether or not to echo the return. Default true.
* @param string $link Optional. Anchor text. If empty, default is 'Edit This'. Default empty.
* @param string $before Optional. Display before edit link. Default empty.
* @param string $after Optional. Display after edit link. Default empty.
* @param WP_Term $term Optional. Term object. If null, the queried object will be inspected. Default null.
* @param bool $echo Optional. Whether or not to echo the return. Default true.
* @return string|void HTML content.
*/
function edit_term_link( $link = '', $before = '', $after = '', $term = null, $echo = true ) {

View File

@ -769,9 +769,9 @@ function get_last_updated( $deprecated = '', $start = 0, $quantity = 40 ) {
*
* @since 3.3.0
*
* @param string $new_status The new post status
* @param string $old_status The old post status
* @param object $post Post object
* @param string $new_status The new post status.
* @param string $old_status The old post status.
* @param WP_Post $post Post object.
*/
function _update_blog_date_on_post_publish( $new_status, $old_status, $post ) {
$post_type_obj = get_post_type_object( $post->post_type );

View File

@ -1065,9 +1065,9 @@ function _wp_delete_tax_menu_item( $object_id = 0, $tt_id, $taxonomy ) {
* @since 3.0.0
* @access private
*
* @param string $new_status The new status of the post object.
* @param string $old_status The old status of the post object.
* @param object $post The post object being transitioned from one status to another.
* @param string $new_status The new status of the post object.
* @param string $old_status The old status of the post object.
* @param WP_Post $post The post object being transitioned from one status to another.
*/
function _wp_auto_add_pages_to_menu( $new_status, $old_status, $post ) {
if ( 'publish' != $new_status || 'publish' == $old_status || 'page' != $post->post_type ) {

View File

@ -41,8 +41,8 @@ function get_post_format( $post = null ) {
*
* @since 3.1.0
*
* @param string|array $format Optional. The format or formats to check.
* @param object|int|null $post Optional. The post to check. If not supplied, defaults to the current post if used in the loop.
* @param string|array $format Optional. The format or formats to check.
* @param WP_Post|int|null $post Optional. The post to check. If not supplied, defaults to the current post if used in the loop.
* @return bool True if the post has any of the given formats (or any format, if no format specified), false otherwise.
*/
function has_post_format( $format = array(), $post = null ) {

View File

@ -24,7 +24,7 @@ class WP_REST_Blocks_Controller extends WP_REST_Posts_Controller {
*
* @since 5.0.0
*
* @param object $post Post object that backs the block.
* @param WP_Post $post Post object that backs the block.
* @return bool Whether the block can be read.
*/
public function check_read_permission( $post ) {

View File

@ -1664,7 +1664,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
*
* @since 4.7.0
*
* @param object $comment Comment object.
* @param WP_Comment $comment Comment object.
* @return bool Whether the comment can be edited or deleted.
*/
protected function check_edit_permission( $comment ) {

View File

@ -227,9 +227,9 @@ class WP_REST_Post_Types_Controller extends WP_REST_Controller {
*
* @since 4.7.0
*
* @param WP_REST_Response $response The response object.
* @param object $item The original post type object.
* @param WP_REST_Request $request Request used to generate the response.
* @param WP_REST_Response $response The response object.
* @param WP_Post_Type $post_type The original post type object.
* @param WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( 'rest_prepare_post_type', $response, $post_type, $request );
}

View File

@ -869,7 +869,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
*
* @since 4.7.0
*
* @param object $post The deleted or trashed post.
* @param WP_Post $post The deleted or trashed post.
* @param WP_REST_Response $response The response data.
* @param WP_REST_Request $request The request sent to the API.
*/
@ -1145,8 +1145,8 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
*
* @since 4.7.0
*
* @param string $post_status Post status.
* @param object $post_type Post type.
* @param string $post_status Post status.
* @param WP_Post_Type $post_type Post type.
* @return string|WP_Error Post status or WP_Error if lacking the proper permission.
*/
protected function handle_status_param( $post_status, $post_type ) {
@ -1321,7 +1321,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
*
* @since 4.7.0
*
* @param object|string $post_type Post type name or object.
* @param WP_Post_Type|string $post_type Post type name or object.
* @return bool Whether the post type is allowed in REST.
*/
protected function check_is_post_type_allowed( $post_type ) {
@ -1343,7 +1343,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
*
* @since 4.7.0
*
* @param object $post Post object.
* @param WP_Post $post Post object.
* @return bool Whether the post can be read.
*/
public function check_read_permission( $post ) {
@ -1386,7 +1386,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
*
* @since 4.7.0
*
* @param object $post Post object.
* @param WP_Post $post Post object.
* @return bool Whether the post can be edited.
*/
protected function check_update_permission( $post ) {
@ -1404,7 +1404,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
*
* @since 4.7.0
*
* @param object $post Post object.
* @param WP_Post $post Post object.
* @return bool Whether the post can be created.
*/
protected function check_create_permission( $post ) {
@ -1422,7 +1422,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
*
* @since 4.7.0
*
* @param object $post Post object.
* @param WP_Post $post Post object.
* @return bool Whether the post can be deleted.
*/
protected function check_delete_permission( $post ) {

View File

@ -781,7 +781,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
* @since 4.7.0
*
* @param WP_REST_Response $response The response object.
* @param object $item The original term object.
* @param WP_Term $item The original term object.
* @param WP_REST_Request $request Request used to generate the response.
*/
return apply_filters( "rest_prepare_{$this->taxonomy}", $response, $item, $request );
@ -792,7 +792,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
*
* @since 4.7.0
*
* @param object $term Term object.
* @param WP_Term $term Term object.
* @return array Links for the given term.
*/
protected function prepare_links( $term ) {

View File

@ -961,7 +961,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
* @since 4.7.0
*
* @param WP_REST_Response $response The response object.
* @param object $user User object used to create response.
* @param WP_User $user User object used to create response.
* @param WP_REST_Request $request Request object.
*/
return apply_filters( 'rest_prepare_user', $response, $user, $request );

View File

@ -3683,8 +3683,8 @@ function _prime_term_caches( $term_ids, $update_meta_cache = true ) {
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param array $terms List of Term taxonomy IDs.
* @param object $taxonomy Current taxonomy object of terms.
* @param int[] $terms List of Term taxonomy IDs.
* @param WP_Taxonomy $taxonomy Current taxonomy object of terms.
*/
function _update_post_term_count( $terms, $taxonomy ) {
global $wpdb;
@ -3738,8 +3738,8 @@ function _update_post_term_count( $terms, $taxonomy ) {
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param array $terms List of term taxonomy IDs.
* @param object $taxonomy Current taxonomy object of terms.
* @param int[] $terms List of term taxonomy IDs.
* @param WP_Taxonomy $taxonomy Current taxonomy object of terms.
*/
function _update_generic_term_count( $terms, $taxonomy ) {
global $wpdb;
@ -4172,8 +4172,8 @@ function wp_term_is_shared( $term_id ) {
*
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
*
* @param object|int|string $term The term object, ID, or slug whose link will be retrieved.
* @param string $taxonomy Optional. Taxonomy. Default empty.
* @param WP_Term|int|string $term The term object, ID, or slug whose link will be retrieved.
* @param string $taxonomy Optional. Taxonomy. Default empty.
* @return string|WP_Error URL of the taxonomy term archive on success, WP_Error if term does not exist.
*/
function get_term_link( $term, $taxonomy = '' ) {
@ -4269,9 +4269,9 @@ function get_term_link( $term, $taxonomy = '' ) {
*
* @since 2.5.0
*
* @param string $termlink Term link URL.
* @param object $term Term object.
* @param string $taxonomy Taxonomy slug.
* @param string $termlink Term link URL.
* @param WP_Term $term Term object.
* @param string $taxonomy Taxonomy slug.
*/
return apply_filters( 'term_link', $termlink, $term, $taxonomy );
}

View File

@ -2450,8 +2450,8 @@ function reset_password( $user, $new_pass ) {
*
* @since 1.5.0
*
* @param object $user The user.
* @param string $new_pass New user password.
* @param WP_User $user The user.
* @param string $new_pass New user password.
*/
do_action( 'password_reset', $user, $new_pass );

View File

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

View File

@ -925,7 +925,7 @@ switch ( $action ) {
*
* @since 3.5.0
*
* @param object $errors WP Error object.
* @param WP_Error $errors WP Error object.
* @param WP_User|WP_Error $user WP_User object if the login and reset key match. WP_Error object otherwise.
*/
do_action( 'validate_password_reset', $errors, $user );
@ -1320,8 +1320,8 @@ switch ( $action ) {
*
* @since 3.6.0
*
* @param object $errors WP Error object.
* @param string $redirect_to Redirect destination URL.
* @param WP_Error $errors WP Error object.
* @param string $redirect_to Redirect destination URL.
*/
$errors = apply_filters( 'wp_login_errors', $errors, $redirect_to );