Commit e6d621ae7e for wordpress.org
commit e6d621ae7e00b3d6e960358e02c5b3348eabfbde
Author: westonruter <westonruter@git.wordpress.org>
Date: Wed Oct 21 06:14:56 2026 +0000
Code Quality: Remove dead code and document bookmark exceptions.
Several `step_*()` methods in the HTML Processor can throw an `Exception` via `insert_virtual_node()` when bookmarks run out. Documenting this with `@throws` shows PHPStan that the generic `catch` in `step()` is reachable, so its `catch.neverThrown` ignore is removed. The existing `identical.alwaysFalse` ignore now covers that `catch` as well, since PHPStan cannot see `$last_error` being set by a call that throws.
Dead code is also removed from `wp-admin/plugins.php`, along with a redundant check in `WP_REST_Users_Controller::check_reassign()`, whose documented types are corrected.
Developed in https://github.com/WordPress/wordpress-develop/pull/13073.
Follow-up to r39426, r63023, r64294.
Props dpantazis, westonruter.
See #65817.
Built from https://develop.svn.wordpress.org/trunk@64673
git-svn-id: http://core.svn.wordpress.org/trunk@63823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php
index 5c65801631..520bd03dee 100644
--- a/wp-admin/plugins.php
+++ b/wp-admin/plugins.php
@@ -740,8 +740,6 @@ if ( isset( $_GET['error'] ) ) {
wp_admin_notice( __( 'Plugin deactivated.' ), $updated_notice_args );
} elseif ( isset( $_GET['deactivate-multi'] ) ) {
wp_admin_notice( __( 'Selected plugins deactivated.' ), $updated_notice_args );
-} elseif ( 'update-selected' === $action ) {
- wp_admin_notice( __( 'All selected plugins are up to date.' ), $updated_notice_args );
} elseif ( isset( $_GET['resume'] ) ) {
wp_admin_notice( __( 'Plugin resumed.' ), $updated_notice_args );
} elseif ( isset( $_GET['enabled-auto-update'] ) ) {
diff --git a/wp-includes/html-api/class-wp-html-processor.php b/wp-includes/html-api/class-wp-html-processor.php
index 4cadb962dd..4f771535ed 100644
--- a/wp-includes/html-api/class-wp-html-processor.php
+++ b/wp-includes/html-api/class-wp-html-processor.php
@@ -1634,6 +1634,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
* @since 6.7.0
* @ignore
*
+ * @throws Exception When unable to allocate a bookmark for the next token in the input HTML document.
* @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input.
*
* @see WP_HTML_Processor::step
@@ -1732,6 +1733,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
* @since 6.7.0
* @ignore
*
+ * @throws Exception When unable to allocate a bookmark for the next token in the input HTML document.
* @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input.
*
* @see WP_HTML_Processor::step
@@ -2157,6 +2159,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
* @since 6.7.0
* @ignore
*
+ * @throws Exception When unable to allocate a bookmark for the next token in the input HTML document.
* @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input.
*
* @see WP_HTML_Processor::step
@@ -3420,6 +3423,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
* @since 6.7.0
* @ignore
*
+ * @throws Exception When unable to allocate a bookmark for the next token in the input HTML document.
* @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input.
*
* @see WP_HTML_Processor::step
@@ -3892,6 +3896,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
* @since 6.7.0
* @ignore
*
+ * @throws Exception When unable to allocate a bookmark for the next token in the input HTML document.
* @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input.
*
* @see WP_HTML_Processor::step
diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
index 9b25cf7974..2f70bf71a3 100644
--- a/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
+++ b/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
@@ -165,21 +165,30 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
/**
* Checks for a valid value for the reassign parameter when deleting users.
*
- * The value can be an integer, 'false', false, or ''.
+ * The value is expected to be an integer, a numeric string, 'false', false, or ''.
*
* @since 4.7.0
*
- * @param int|bool $value The value passed to the reassign parameter.
+ * @param mixed $value The value passed to the reassign parameter.
* @param WP_REST_Request $request Full details about the request.
* @param string $param The parameter that is being sanitized.
- * @return int|bool|WP_Error
+ * @return int|float|string|false|WP_Error The value unchanged if it is numeric, false if posts should not
+ * be reassigned, or a WP_Error if the value is invalid.
+ *
+ * @phpstan-template T
+ * @phpstan-param T $value
+ * @phpstan-return (
+ * T is numeric
+ * ? T
+ * : ( T is empty|'false' ? false : WP_Error )
+ * )
*/
public function check_reassign( $value, $request, $param ) {
if ( is_numeric( $value ) ) {
return $value;
}
- if ( empty( $value ) || false === $value || 'false' === $value ) {
+ if ( empty( $value ) || 'false' === $value ) {
return false;
}
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 408f4b7800..a3f4c75d2c 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-beta1-64672';
+$wp_version = '7.2-beta1-64673';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.