Skip to content

Commit 82171f5

Browse files
Code Modernization: Fix implicitly nullable parameter in WP_HTML_Processor.
PHP 8.4 deprecates implicitly nullable parameters, i.e. typed parameters with a `null` default value, which are not explicitly declared as nullable. This commit the one instance of this in the `WP_HTML_Processor` class. Fixed by adding the nullability operator to the type, which is supported since PHP 7.1, so we can use it now the minimum supported PHP version is PHP 7.2. As this deprecation is thrown at compile time, it can be seen at the top of the test output when running on PHP 8.4 (which will be gone once this change has been committed). It is not possible to write a test to cover this. Ref: https://wiki.php.net/rfc/deprecate-implicitly-nullable-types Follow-up to [58867], [58769], [58304], [58192]. Props jrf. See #62061. git-svn-id: https://develop.svn.wordpress.org/trunk@59053 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 8fc4a00 commit 82171f5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/wp-includes/html-api/class-wp-html-processor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ public function matches_breadcrumbs( $breadcrumbs ): bool {
782782
* @return bool|null Whether to expect a closer for the currently-matched node,
783783
* or `null` if not matched on any token.
784784
*/
785-
public function expects_closer( WP_HTML_Token $node = null ): ?bool {
785+
public function expects_closer( ?WP_HTML_Token $node = null ): ?bool {
786786
$token_name = $node->node_name ?? $this->get_token_name();
787787

788788
if ( ! isset( $token_name ) ) {

0 commit comments

Comments
 (0)