Commit 1d845e0700 for wordpress.org
commit 1d845e07000039e963eaefe5a6c3229031eafcfa
Author: westonruter <westonruter@git.wordpress.org>
Date: Thu Nov 5 20:46:56 2026 +0000
Code Quality: Fix the `booleanAnd.alwaysFalse` PHPStan error.
In `themes.php`, PHPStan only knew `$parent_file` as the `'themes.php'` literal assigned earlier in the file, so it reported the `empty( $parent_file )` clause of the Appearance submenu condition as never true. That is a false positive: `wp-admin/menu-header.php`, loaded via `admin-header.php`, passes `$parent_file` through the `parent_file` filter, and it also sets `$self`, while `$submenu` comes from `wp-admin/menu.php`. None of these are visible to PHPStan across the `require` chain. The condition is therefore left unchanged, and the globals are instead declared with a file-scope `global` statement and `@global` tags. An inline `@var` would not suffice, since with `treatPhpDocTypesAsCertain` disabled the always-true and always-false rules use the native type, which only the `global` statement resets.
This retires the `booleanAnd.alwaysFalse` baseline along with the remaining baseline entries for `themes.php`, and the `$submenu` array shape also resolves the `mixed` errors in the submenu loop at higher rule levels.
Developed in https://github.com/WordPress/wordpress-develop/pull/15478.
Follow-up to r63019, r63023.
Props bgturner, westonruter.
See #65817.
Built from https://develop.svn.wordpress.org/trunk@65282
git-svn-id: http://core.svn.wordpress.org/trunk@64431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-admin/themes.php b/wp-admin/themes.php
index 9e17386594..29b9fe2af6 100644
--- a/wp-admin/themes.php
+++ b/wp-admin/themes.php
@@ -248,6 +248,13 @@ wp_enqueue_script( 'theme' );
wp_enqueue_script( 'updates' );
require_once ABSPATH . 'wp-admin/admin-header.php';
+
+/**
+ * @global string $self The current admin page, set in wp-admin/menu-header.php.
+ * @global string $parent_file The parent menu file, filtered in wp-admin/menu-header.php.
+ * @global array<string, array<int, array{ 0: string, 1: string, 2: string, 3?: string, 4?: string }>> $submenu The admin submenu items keyed by parent slug, set in wp-admin/menu.php.
+ */
+global $self, $parent_file, $submenu;
?>
<div class="wrap">
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 3b3a3e0843..78b2881f79 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-beta4-65281';
+$wp_version = '7.2-beta4-65282';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.