From 969852d62e61cd96dc0443f895d1143deccf891a Mon Sep 17 00:00:00 2001 From: noruzzamans Date: Mon, 2 Feb 2026 11:04:09 +0600 Subject: [PATCH 1/4] Docs: Add missing @global annotations in meta.php and deprecated.php --- src/wp-includes/deprecated.php | 3 +++ src/wp-includes/meta.php | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/wp-includes/deprecated.php b/src/wp-includes/deprecated.php index 360acf5d4689f..6007362f17deb 100644 --- a/src/wp-includes/deprecated.php +++ b/src/wp-includes/deprecated.php @@ -101,6 +101,9 @@ function the_category_ID($display = true) { * @deprecated 0.71 Use get_the_category_by_ID() * @see get_the_category_by_ID() * + * @global int $currentcat + * @global int $previouscat + * * @param string $before Optional. Text to display before the category. Default empty. * @param string $after Optional. Text to display after the category. Default empty. */ diff --git a/src/wp-includes/meta.php b/src/wp-includes/meta.php index 5f53c12bc3dbf..9ca5bf96f86ba 100644 --- a/src/wp-includes/meta.php +++ b/src/wp-includes/meta.php @@ -1397,6 +1397,8 @@ function sanitize_meta( $meta_key, $meta_value, $object_type, $object_subtype = * @since 6.4.0 The `$revisions_enabled` argument was added to the arguments array. * @since 6.7.0 The `label` argument was added to the arguments array. * + * @global array $wp_meta_keys Global registry for meta keys. + * * @param string $object_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term', * 'user', or any other object type with an associated meta table. * @param string $meta_key Meta key to register. From b47e8b3412a2ac4f3643df90e77f9df40eb6c9df Mon Sep 17 00:00:00 2001 From: noruzzamans Date: Mon, 2 Feb 2026 11:41:37 +0600 Subject: [PATCH 2/4] Docs: Complete missing @global annotations in meta.php and deprecated.php --- src/wp-includes/deprecated.php | 2 ++ src/wp-includes/meta.php | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/wp-includes/deprecated.php b/src/wp-includes/deprecated.php index 6007362f17deb..92e324aa23801 100644 --- a/src/wp-includes/deprecated.php +++ b/src/wp-includes/deprecated.php @@ -3411,6 +3411,8 @@ function _search_terms_tidy( $t ) { * @since 2.1.0 * @deprecated 3.9.0 * + * @global bool $wp_rich_edit_exists Whether TinyMCE is available. + * * @return bool Whether TinyMCE exists. */ function rich_edit_exists() { diff --git a/src/wp-includes/meta.php b/src/wp-includes/meta.php index 9ca5bf96f86ba..c657c6c2e7af3 100644 --- a/src/wp-includes/meta.php +++ b/src/wp-includes/meta.php @@ -1569,6 +1569,8 @@ function register_meta( $object_type, $meta_key, $args, $deprecated = null ) { * * @since 5.5.0 * + * @global array $wp_meta_keys Global registry for meta keys. + * * @param mixed $value Current value passed to filter. * @param int $object_id ID of the object metadata is for. * @param string $meta_key Metadata key. @@ -1648,6 +1650,8 @@ function registered_meta_key_exists( $object_type, $meta_key, $object_subtype = * @since 4.6.0 * @since 4.9.8 The `$object_subtype` parameter was added. * + * @global array $wp_meta_keys Global registry for meta keys. + * * @param string $object_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term', * 'user', or any other object type with an associated meta table. * @param string $meta_key Metadata key. @@ -1698,6 +1702,8 @@ function unregister_meta_key( $object_type, $meta_key, $object_subtype = '' ) { * @since 4.6.0 * @since 4.9.8 The `$object_subtype` parameter was added. * + * @global array $wp_meta_keys Global registry for meta keys. + * * @param string $object_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term', * 'user', or any other object type with an associated meta table. * @param string $object_subtype Optional. The subtype of the object type. Default empty string. From 6517956489516e61325ab167669f037ff269faf4 Mon Sep 17 00:00:00 2001 From: noruzzamans Date: Mon, 2 Feb 2026 13:10:41 +0600 Subject: [PATCH 3/4] Revert changes in deprecated.php as per committer feedback --- src/wp-includes/deprecated.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/wp-includes/deprecated.php b/src/wp-includes/deprecated.php index 92e324aa23801..360acf5d4689f 100644 --- a/src/wp-includes/deprecated.php +++ b/src/wp-includes/deprecated.php @@ -101,9 +101,6 @@ function the_category_ID($display = true) { * @deprecated 0.71 Use get_the_category_by_ID() * @see get_the_category_by_ID() * - * @global int $currentcat - * @global int $previouscat - * * @param string $before Optional. Text to display before the category. Default empty. * @param string $after Optional. Text to display after the category. Default empty. */ @@ -3411,8 +3408,6 @@ function _search_terms_tidy( $t ) { * @since 2.1.0 * @deprecated 3.9.0 * - * @global bool $wp_rich_edit_exists Whether TinyMCE is available. - * * @return bool Whether TinyMCE exists. */ function rich_edit_exists() { From f308644b25e9f345b4726ae34b885bc51c227254 Mon Sep 17 00:00:00 2001 From: noruzzamans Date: Mon, 2 Feb 2026 13:19:10 +0600 Subject: [PATCH 4/4] Docs: Complete missing @global annotations in abstract-testcase.php --- tests/phpunit/includes/abstract-testcase.php | 37 ++++++++++++++------ 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/tests/phpunit/includes/abstract-testcase.php b/tests/phpunit/includes/abstract-testcase.php index d83b23ca4cf5c..2c2268b44de01 100644 --- a/tests/phpunit/includes/abstract-testcase.php +++ b/tests/phpunit/includes/abstract-testcase.php @@ -58,6 +58,8 @@ public static function get_called_class() { /** * Runs the routine before setting up all tests. + * + * @global wpdb $wpdb WordPress database abstraction object. */ public static function set_up_before_class() { global $wpdb; @@ -98,6 +100,8 @@ public static function tear_down_after_class() { /** * Runs the routine before each test is executed. + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite rules object. */ public function set_up() { set_time_limit( 0 ); @@ -155,6 +159,11 @@ public function wp_hash_password_options( array $options, string $algorithm ): a /** * After a test method runs, resets any state in WordPress the test method might have changed. + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global WP_Query $wp_the_query WordPress Query object. + * @global WP_Query $wp_query WordPress Query object. + * @global WP $wp WordPress environment object. */ public function tear_down() { global $wpdb, $wp_the_query, $wp_query, $wp; @@ -359,10 +368,10 @@ protected function reset__SERVER() { * Stores $wp_filter, $wp_actions, $wp_filters, and $wp_current_filter * on a class variable so they can be restored on tear_down() using _restore_hooks(). * - * @global array $wp_filter - * @global array $wp_actions - * @global array $wp_filters - * @global array $wp_current_filter + * @global array $wp_filter Stores all of the filters and actions. + * @global array $wp_actions Stores the number of times each action was triggered. + * @global array $wp_filters Stores the number of times each filter was triggered. + * @global array $wp_current_filter Stores the list of current filters with the current one last. */ protected function _backup_hooks() { self::$hooks_saved['wp_filter'] = array(); @@ -382,10 +391,10 @@ protected function _backup_hooks() { * Restores the hook-related globals to their state at set_up() * so that future tests aren't affected by hooks set during this last test. * - * @global array $wp_filter - * @global array $wp_actions - * @global array $wp_filters - * @global array $wp_current_filter + * @global array $wp_filter Stores all of the filters and actions. + * @global array $wp_actions Stores the number of times each action was triggered. + * @global array $wp_filters Stores the number of times each filter was triggered. + * @global array $wp_current_filter Stores the list of current filters with the current one last. */ protected function _restore_hooks() { if ( isset( self::$hooks_saved['wp_filter'] ) ) { @@ -407,6 +416,8 @@ protected function _restore_hooks() { /** * Flushes the WordPress object cache. + * + * @global WP_Object_Cache $wp_object_cache WordPress Object Cache object. */ public static function flush_cache() { global $wp_object_cache; @@ -452,7 +463,7 @@ public static function flush_cache() { * * @since 5.1.0 * - * @global array $wp_meta_keys + * @global array $wp_meta_keys Global registry for meta keys. */ public function unregister_all_meta_keys() { global $wp_meta_keys; @@ -470,6 +481,8 @@ public function unregister_all_meta_keys() { /** * Starts a database transaction. + * + * @global wpdb $wpdb WordPress database abstraction object. */ public function start_transaction() { global $wpdb; @@ -483,6 +496,8 @@ public function start_transaction() { * Commits the queries in a transaction. * * @since 4.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. */ public static function commit_transaction() { global $wpdb; @@ -1133,6 +1148,8 @@ public function normalizeDirectorySeparatorsInPath( $path ) { * @since 5.3.0 Formalized the existing `...$prop` parameter by adding it * to the function signature. * + * @global WP_Query $wp_query WordPress Query object. + * * @param string ...$prop Any number of WP_Query properties that are expected to be true for the current request. */ public function assertQueryTrue( ...$prop ) { @@ -1632,7 +1649,7 @@ public static function delete_user( $user_id ) { * * @since 4.4.0 * - * @global WP_Rewrite $wp_rewrite + * @global WP_Rewrite $wp_rewrite WordPress rewrite rules object. * * @param string $structure Optional. Permalink structure to set. Default empty. */