Make WordPress Core

Changeset 61280


Ignore:
Timestamp:
11/23/2025 05:06:20 AM (12 months ago)
Author:
westonruter
Message:

Docs: Fix phpdoc types for WP_Speculation_Rules members.

What was previously mixed is actually a speculation rule which can be more accurately be typed as array<string, mixed>. Additionally, the return value of jsonSerialize is fixed to indicate it returns an array of lists as opposed an array of associative arrays.

Developed in ​https://github.com/WordPress/wordpress-develop/pull/8946

Follow-up to [59837].

Props justlevine, johnbillion, westonruter.
See #64238, #63268, #62503.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-speculation-rules.php

    r59837 r61280  
    2222         *
    2323         * @since 6.8.0
    24          * @var array<string, array<string, mixed>>
     24         * @var array<string, array<string, array<string, mixed>>>
    2525         */
    2626        private $rules_by_mode = array();
    … …  
    231231         * @since 6.8.0
    232232         *
    233          * @return array<string, array<string, mixed>> Speculation rules data.
     233         * @return array<string, array<int, array<string, mixed>>> Speculation rules data.
    234234         */
    235235        #[ReturnTypeWillChange]
Note: See TracChangeset for help on using the changeset viewer.