Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML API: Fix phpdoc nullable types #7031

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/wp-includes/class-wp-token-map.php
Original file line number Diff line number Diff line change
Expand Up @@ -520,10 +520,11 @@ public function contains( $word, $case_sensitivity = 'case-sensitive' ) {
*
* @since 6.6.0
*
* @param string $text String in which to search for a lookup key.
* @param int $offset Optional. How many bytes into the string where the lookup key ought to start. Default 0.
* @param ?int &$matched_token_byte_length Optional. Holds byte-length of found token matched, otherwise not set. Default null.
* @param string $case_sensitivity Optional. Pass 'ascii-case-insensitive' to ignore ASCII case when matching. Default 'case-sensitive'.
* @param string $text String in which to search for a lookup key.
* @param int $offset Optional. How many bytes into the string where the lookup key ought to start. Default 0.
* @param int|null &$matched_token_byte_length Optional. Holds byte-length of found token matched, otherwise not set. Default null.
* @param string $case_sensitivity Optional. Pass 'ascii-case-insensitive' to ignore ASCII case when matching. Default 'case-sensitive'.
*
* @return string|null Mapped value of lookup key if found, otherwise `null`.
*/
public function read_token( $text, $offset = 0, &$matched_token_byte_length = null, $case_sensitivity = 'case-sensitive' ) {
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -7497,7 +7497,7 @@ function get_tag_regex( $tag ) {
*
* @since 6.6.0
*
* @param ?string $blog_charset Slug representing a text character encoding, or "charset".
* @param string|null $blog_charset Slug representing a text character encoding, or "charset".
* E.g. "UTF-8", "Windows-1252", "ISO-8859-1", "SJIS".
* @return bool Whether the slug represents the UTF-8 encoding.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/html-api/class-wp-html-open-elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ public function walk_down() {
* @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 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;
Expand Down
11 changes: 6 additions & 5 deletions src/wp-includes/html-api/class-wp-html-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,14 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
*
* @since 6.6.0
*
* @var ?WP_HTML_Stack_Event
* @var WP_HTML_Stack_Event|null
*/
private $current_element = null;

/**
* Context node if created as a fragment parser.
*
* @var ?WP_HTML_Token
* @var WP_HTML_Token|null
*/
private $context_node = null;

Expand Down Expand Up @@ -752,9 +752,10 @@ public function matches_breadcrumbs( $breadcrumbs ) {
* this returns false for self-closing elements in the
* SVG and MathML namespace.
*
* @param ?WP_HTML_Token $node Node to examine instead of current node, if provided.
* @return bool Whether to expect a closer for the currently-matched node,
* or `null` if not matched on any token.
* @param WP_HTML_Token $node Node to examine instead of current node, if provided.
*
* @return bool|null Whether to expect a closer for the currently-matched node,
* or `null` if not matched on any token.
*/
public function expects_closer( $node = null ) {
$token_name = $node->node_name ?? $this->get_token_name();
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/html-api/wpHtmlProcessorHtml5lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public static function parse_html5_dat_testfile( $filename ) {
/**
* Represents which section of the test case is being parsed.
*
* @var ?string
* @var string|null
*/
$state = null;

Expand Down
Loading