Make WordPress Core

Opened 2 weeks ago

Closed 2 weeks ago

#59904 closed feature request (fixed)

Change the data type of parameter descriptions such as wp_set_option_autoload_values function from array to string[].

Reported by: tmatsuur's profile tmatsuur Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.5 Priority: normal
Severity: normal Version: 6.4
Component: Options, Meta APIs Keywords:
Focuses: docs Cc:

Description

In the functions related to the newly added options, the data type of the $options parameter is listed as "array".

wp_prime_option_caches()

 * @param array $options An array of option names to be loaded.
 */
function wp_prime_option_caches( $options ) {

get_options()

 * @param array $options An array of option names to retrieve.
 * @return array An array of key-value pairs for the requested options.
 */
function get_options( $options ) {

wp_set_options_autoload()

 * @param array       $options  List of option names. Expected to not be SQL-escaped.
 * @param string|bool $autoload Autoload value to control whether to load the options when WordPress starts up.
 *                              Accepts 'yes'|true to enable or 'no'|false to disable.
 * @return array Associative array of all provided $options as keys and boolean values for whether their autoload value
 *               was updated.
 */
function wp_set_options_autoload( array $options, $autoload ) {

I think string[] would be better than array for $options for these three functions.

Change History (2)

#1 @SergeyBiryukov
2 weeks ago

  • Milestone changed from Awaiting Review to 6.5

Good catch, thanks!

#2 @SergeyBiryukov
2 weeks ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 57110:

Docs: Use typed array notation for the $options parameter in some new functions.

Follow-up to [56445], [56508], [57013].

Props tmatsuur.
Fixes #59904.

Note: See TracTickets for help on using tickets.