Make WordPress Core

Opened 3 years ago

Closed 3 years 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 Owned by: SergeyBiryukov
Priority: normal Milestone: 6.5
Component: Options, Meta APIs Version: 6.4
Severity: normal Keywords:
Cc: Focuses: docs

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
3 years ago

  • Milestone Awaiting Review → 6.5

Good catch, thanks!

#2 @SergeyBiryukov
3 years ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → 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.