Make WordPress Core


Ignore:
Timestamp:
07/17/2024 12:51:34 AM (9 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/html-api/class-wp-html-processor.php

    r58714 r58742  
    242242     * @since 6.6.0
    243243     *
    244      * @var ?WP_HTML_Stack_Event
     244     * @var WP_HTML_Stack_Event|null
    245245     */
    246246    private $current_element = null;
     
    249249     * Context node if created as a fragment parser.
    250250     *
    251      * @var ?WP_HTML_Token
     251     * @var WP_HTML_Token|null
    252252     */
    253253    private $context_node = null;
     
    753753     *       SVG and MathML namespace.
    754754     *
    755      * @param  ?WP_HTML_Token $node Node to examine instead of current node, if provided.
    756      * @return bool Whether to expect a closer for the currently-matched node,
    757      *              or `null` if not matched on any token.
     755     * @param WP_HTML_Token|null $node Optional. Node to examine, if provided.
     756     *                                 Default is to examine current node.
     757     * @return bool|null Whether to expect a closer for the currently-matched node,
     758     *                   or `null` if not matched on any token.
    758759     */
    759760    public function expects_closer( $node = null ) {
Note: See TracChangeset for help on using the changeset viewer.