Make WordPress Core


Ignore:
Timestamp:
07/17/2024 12:51:34 AM (10 months ago)
Author:
dmsnell
Message:

Fix phpdoc nullable types in some files.

It was found that in several places in the HTML API and its supporting files,
the wrong form of type annotation was used for optional parameters.

Instead of using ?type, this patch uses type|type-of-default-value instead,
noting where important if the parameter is optional, and if so, what its default
value is.

Developed in https://github.com/WordPress/wordpress-develop/pull/7031
Discussed in https://core.trac.wordpress.org/ticket/61399

Props dmsnell, jonsurrell.
See #61399.

File:
1 edited

Legend:

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

    r58715 r58742  
    74987498 * @since 6.6.0
    74997499 *
    7500  * @param ?string $blog_charset Slug representing a text character encoding, or "charset".
    7501  *                              E.g. "UTF-8", "Windows-1252", "ISO-8859-1", "SJIS".
     7500 * @param string|null $blog_charset Optional. Slug representing a text character encoding, or "charset".
     7501 *                                  E.g. "UTF-8", "Windows-1252", "ISO-8859-1", "SJIS".
     7502 *                                  Default value is to infer from "blog_charset" option.
    75027503 * @return bool Whether the slug represents the UTF-8 encoding.
    75037504 */
Note: See TracChangeset for help on using the changeset viewer.