From 37e081e8dc8da5e481dda145df2db23b4ab50da8 Mon Sep 17 00:00:00 2001 From: hellofromTonya Date: Wed, 18 Sep 2024 15:04:14 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@59053 git-svn-id: http://core.svn.wordpress.org/trunk@58449 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/html-api/class-wp-html-processor.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/html-api/class-wp-html-processor.php b/wp-includes/html-api/class-wp-html-processor.php index cf4f8d7b86..caa6de1d09 100644 --- a/wp-includes/html-api/class-wp-html-processor.php +++ b/wp-includes/html-api/class-wp-html-processor.php @@ -782,7 +782,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor { * @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( WP_HTML_Token $node = null ): ?bool { + public function expects_closer( ?WP_HTML_Token $node = null ): ?bool { $token_name = $node->node_name ?? $this->get_token_name(); if ( ! isset( $token_name ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 02599eb707..bf067aa9ef 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.7-alpha-59052'; +$wp_version = '6.7-alpha-59053'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.