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.

Built from https://develop.svn.wordpress.org/trunk@58742


git-svn-id: http://core.svn.wordpress.org/trunk@58144 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dmsnell
2024-07-17 00:53:17 +00:00
parent c0f074c7ce
commit b7b504dc0d
5 changed files with 17 additions and 13 deletions

View File

@@ -499,7 +499,8 @@ class WP_HTML_Open_Elements {
* @since 6.4.0
* @since 6.5.0 Accepts $above_this_node to start traversal above a given node, if it exists.
*
* @param ?WP_HTML_Token $above_this_node Start traversing above this node, if provided and if the node exists.
* @param WP_HTML_Token|null $above_this_node Optional. Start traversing above this node,
* if provided and if the node exists.
*/
public function walk_up( $above_this_node = null ) {
$has_found_node = null === $above_this_node;