Make WordPress Core

Changeset 53877


Ignore:
Timestamp:
08/11/2022 02:01:35 PM (3 years ago)
Author:
johnbillion
Message:

Docs: Correct and improve the documented types for various functions and hooks.

See #55646

Location:
trunk/src
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/template.php

    r53746 r53877  
    17771777 * @since 5.3.0 Added `warning` and `info` as possible values for `$type`.
    17781778 *
    1779  * @global array $wp_settings_errors Storage array of errors registered during this pageload
     1779 * @global array[] $wp_settings_errors Storage array of errors registered during this pageload
    17801780 *
    17811781 * @param string $setting Slug title of the setting to which this error applies.
     
    18141814 * @since 3.0.0
    18151815 *
    1816  * @global array $wp_settings_errors Storage array of errors registered during this pageload
     1816 * @global array[] $wp_settings_errors Storage array of errors registered during this pageload
    18171817 *
    18181818 * @param string $setting  Optional. Slug title of a specific setting whose errors you want.
  • trunk/src/wp-includes/blocks/search.php

    r53157 r53877  
    181181 * @param  array $attributes The block attributes.
    182182 *
    183  * @return array Style HTML attribute.
     183 * @return string[] Style HTML attributes.
    184184 */
    185185function styles_for_block_core_search( $attributes ) {
  • trunk/src/wp-includes/blocks/template-part.php

    r53157 r53877  
    160160
    161161/**
    162  * Returns an array of variation objects for the template part block.
     162 * Returns an array of variation arrays for the template part block.
    163163 *
    164  * @return array Array containing the block variation objects.
     164 * @return array[] Array containing the block variation data in an array.
    165165 */
    166166function build_template_part_block_variations() {
  • trunk/src/wp-includes/class-wp-block-type.php

    r53268 r53877  
    5555     *
    5656     * @since 5.5.0
    57      * @var array|null
     57     * @var string[]|null
    5858     */
    5959    public $parent = null;
     
    6464     *
    6565     * @since 6.0.0
    66      * @var array|null
     66     * @var string[]|null
    6767     */
    6868    public $ancestor = null;
     
    113113     *
    114114     * @since 5.8.0
    115      * @var array
     115     * @var array[]
    116116     */
    117117    public $variations = array();
     
    153153     *
    154154     * @since 5.5.0
    155      * @var array
     155     * @var string[]
    156156     */
    157157    public $uses_context = array();
     
    161161     *
    162162     * @since 5.5.0
    163      * @var array|null
     163     * @var string[]|null
    164164     */
    165165    public $provides_context = null;
     
    240240     *     @type string|null   $category         Block type category classification, used in
    241241     *                                           search interfaces to arrange block types by category.
    242      *     @type array|null    $parent           Setting parent lets a block require that it is only
     242     *     @type string[]|null $parent           Setting parent lets a block require that it is only
    243243     *                                           available when nested within the specified blocks.
    244      *     @type array|null    $ancestor         Setting ancestor makes a block available only inside the specified
     244     *     @type string[]|null $ancestor         Setting ancestor makes a block available only inside the specified
    245245     *                                           block types at any position of the ancestor's block subtree.
    246246     *     @type string|null   $icon             Block type icon.
     
    249249     *                                           result in search interfaces.
    250250     *     @type string|null   $textdomain       The translation textdomain.
    251      *     @type array         $styles           Alternative block styles.
    252      *     @type array         $variations       Block variations.
     251     *     @type array[]       $styles           Alternative block styles.
     252     *     @type array[]       $variations       Block variations.
    253253     *     @type array|null    $supports         Supported features.
    254254     *     @type array|null    $example          Structured data for the block preview.
    255255     *     @type callable|null $render_callback  Block type render callback.
    256256     *     @type array|null    $attributes       Block type attributes property schemas.
    257      *     @type array         $uses_context     Context values inherited by blocks of this type.
    258      *     @type array|null    $provides_context Context provided by blocks of this type.
     257     *     @type string[]      $uses_context     Context values inherited by blocks of this type.
     258     *     @type string[]|null $provides_context Context provided by blocks of this type.
    259259     *     @type string|null   $editor_script    Block type editor only script handle.
    260260     *     @type string|null   $script           Block type front end and editor script handle.
  • trunk/src/wp-includes/class-wp-customize-panel.php

    r52621 r53877  
    7373     *
    7474     * @since 4.0.0
    75      * @var string|string[]
     75     * @var mixed[]
    7676     */
    7777    public $theme_supports = '';
     
    147147     *     @type string          $capability      Capability required for the panel.
    148148     *                                            Default `edit_theme_options`.
    149      *     @type string|string[] $theme_supports  Theme features required to support the panel.
     149     *     @type mixed[]        $theme_supports  Theme features required to support the panel.
    150150     *     @type string          $title           Title of the panel to show in UI.
    151151     *     @type string          $description     Description to show in the UI.
  • trunk/src/wp-includes/link-template.php

    r53870 r53877  
    42404240 *     Along with the arguments passed in `$args`, this will contain a couple of extra arguments.
    42414241 *
    4242  *     @type bool   $found_avatar True if we were able to find an avatar for this user,
    4243  *                                false or not set if we couldn't.
    4244  *     @type string $url          The URL of the avatar we found.
     4242 *     @type bool         $found_avatar True if an avatar was found for this user,
     4243 *                                      false or not set if none was found.
     4244 *     @type string|false $url          The URL of the avatar that was found, or false.
    42454245 * }
    42464246 */
  • trunk/src/wp-includes/meta.php

    r53827 r53877  
    12321232 * @param string $primary_id_column Primary ID column name.
    12331233 * @param object $context           Optional. The main query object
    1234  * @return array Associative array of `JOIN` and `WHERE` SQL.
     1234 * @return string[]|false {
     1235 *     Array containing JOIN and WHERE SQL clauses to append to the main query,
     1236 *     or false if no table exists for the requested meta type.
     1237 *
     1238 *     @type string $join  SQL fragment to append to the main JOIN clause.
     1239 *     @type string $where SQL fragment to append to the main WHERE clause.
     1240 * }
    12351241 */
    12361242function get_meta_sql( $meta_query, $type, $primary_table, $primary_id_column, $context = null ) {
  • trunk/src/wp-includes/post.php

    r53837 r53877  
    862862 *                       correspond to a WP_Post object, an associative array, or a numeric array,
    863863 *                       respectively. Default OBJECT.
    864  * @return WP_Post[]|int[] Array of post objects or post IDs.
     864 * @return WP_Post[]|array[]|int[] Array of post objects, arrays, or IDs, depending on `$output`.
    865865 */
    866866function get_children( $args = '', $output = OBJECT ) {
     
    58075807 * @since 1.5.1
    58085808 *
    5809  * @param int   $page_id Page ID.
    5810  * @param array $pages   List of page objects from which descendants should be identified.
    5811  * @return array List of page children.
     5809 * @param int       $page_id Page ID.
     5810 * @param WP_Post[] $pages   List of page objects from which descendants should be identified.
     5811 * @return WP_Post[] List of page children.
    58125812 */
    58135813function get_page_children( $page_id, $pages ) {
  • trunk/src/wp-includes/rest-api.php

    r53455 r53877  
    11921192 * @param mixed $id_or_email The Gravatar to retrieve a URL for. Accepts a user_id, gravatar md5 hash,
    11931193 *                           user email, WP_User object, WP_Post object, or WP_Comment object.
    1194  * @return array Avatar URLs keyed by size. Each value can be a URL string or boolean false.
     1194 * @return (string|false)[] Avatar URLs keyed by size. Each value can be a URL string or boolean false.
    11951195 */
    11961196function rest_get_avatar_urls( $id_or_email ) {
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php

    r53760 r53877  
    572572     * @since 5.5.0
    573573     *
    574      * @param mixed           $item    Unmarked up and untranslated plugin data from {@see get_plugin_data()}.
     574     * @param array           $item    Unmarked up and untranslated plugin data from {@see get_plugin_data()}.
    575575     * @param WP_REST_Request $request Request object.
    576576     * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
  • trunk/src/wp-includes/rest-api/search/class-wp-rest-term-search-handler.php

    r49955 r53877  
    4242     *
    4343     * @param WP_REST_Request $request Full REST request.
    44      * @return array Associative array containing an `WP_REST_Search_Handler::RESULT_IDS` containing
    45      *               an array of found IDs and `WP_REST_Search_Handler::RESULT_TOTAL` containing the
    46      *               total count for the matching search results.
     44     * @return array {
     45     *     Associative array containing found IDs and total count for the matching search results.
     46     *
     47     *     @type int[]               $ids   Found IDs.
     48     *     @type string|int|WP_Error $total Numeric string containing the number of terms in that
     49     *                                      taxonomy, 0 if there are no results, or WP_Error if
     50     *                                      the requested taxonomy does not exist.
     51     * }
    4752     */
    4853    public function search_items( WP_REST_Request $request ) {
     
    133138     *
    134139     * @param int $id Item ID.
    135      * @return array Links for the given item.
     140     * @return array[] Array of link arrays for the given item.
    136141     */
    137142    public function prepare_item_links( $id ) {
  • trunk/src/wp-includes/revision.php

    r53842 r53877  
    1818 *                                  for insertion as a post revision. Default empty array.
    1919 * @param bool          $deprecated Not used.
    20  * @return array Array of fields that can be versioned.
     20 * @return string[] Array of fields that can be versioned.
    2121 */
    2222function _wp_post_revision_fields( $post = array(), $deprecated = false ) {
     
    4848     * @since 4.5.0 The `$post` parameter was added.
    4949     *
    50      * @param array $fields List of fields to revision. Contains 'post_title',
    51      *                      'post_content', and 'post_excerpt' by default.
    52      * @param array $post   A post array being processed for insertion as a post revision.
     50     * @param string[] $fields List of fields to revision. Contains 'post_title',
     51     *                         'post_content', and 'post_excerpt' by default.
     52     * @param array    $post   A post array being processed for insertion as a post revision.
    5353     */
    5454    $fields = apply_filters( '_wp_post_revision_fields', $fields, $post );
     
    490490 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
    491491 * @param array|null  $args Optional. Arguments for retrieving post revisions. Default null.
    492  * @return array An array of revisions, or an empty array if none.
     492 * @return WP_Post[]|int[] Array of revision objects or IDs, or an empty array if none.
    493493 */
    494494function wp_get_post_revisions( $post = 0, $args = null ) {
  • trunk/src/wp-includes/taxonomy.php

    r53873 r53877  
    18571857 * @internal The `$deprecated` parameter is parsed for backward compatibility only.
    18581858 *
    1859  * @param array|string $args       Optional. Array of arguments that get passed to get_terms().
    1860  *                                 Default empty array.
     1859 * @param array|string $args       Optional. Array or string of arguments. See WP_Term_Query::__construct()
     1860 *                                 for information on accepted arguments. Default empty array.
    18611861 * @param array|string $deprecated Optional. Argument array, when using the legacy function parameter format.
    18621862 *                                 If present, this parameter will be interpreted as `$args`, and the first
     
    47014701 *                                 linked to its archive.
    47024702 * }
    4703  * @return array List of taxonomies.
     4703 * @return string[] List of taxonomies.
    47044704 */
    47054705function get_the_taxonomies( $post = 0, $args = array() ) {
  • trunk/src/wp-includes/user.php

    r53818 r53877  
    12141214     * @since 5.1.0
    12151215     *
    1216      * @param null|string $result   The value to return instead. Default null to continue with the query.
    1217      * @param string      $strategy Optional. The computational strategy to use when counting the users.
    1218      *                              Accepts either 'time' or 'memory'. Default 'time'.
    1219      * @param int|null    $site_id  Optional. The site ID to count users for. Defaults to the current site.
     1216     * @param null|array $result   The value to return instead. Default null to continue with the query.
     1217     * @param string     $strategy Optional. The computational strategy to use when counting the users.
     1218     *                             Accepts either 'time' or 'memory'. Default 'time'.
     1219     * @param int        $site_id  The site ID to count users for.
    12201220     */
    12211221    $pre = apply_filters( 'pre_count_users', null, $strategy, $site_id );
     
    37443744 * @access private
    37453745 *
    3746  * @return array List of core privacy action types.
     3746 * @return string[] List of core privacy action types.
    37473747 */
    37483748function _wp_privacy_action_request_types() {
     
    37583758 * @since 4.9.6
    37593759 *
    3760  * @param array $exporters An array of personal data exporters.
    3761  * @return array An array of personal data exporters.
     3760 * @param array[] $exporters An array of personal data exporters.
     3761 * @return array[] An array of personal data exporters.
    37623762 */
    37633763function wp_register_user_personal_data_exporter( $exporters ) {
Note: See TracChangeset for help on using the changeset viewer.