Commit bf1e2108bb for wordpress.org

commit bf1e2108bb883105bc2e0d3a96f9ff82b15fb8e2
Author: swissspidy <swissspidy@git.wordpress.org>
Date:   Tue Oct 6 17:01:52 2026 +0000

    Docs: Narrow unused deprecated parameters in PHPStan types.

    This adds `@phpstan-param` tags that narrow unused, deprecated parameters to the literal value of their default, so that static analysis flags callers which still pass something else. The types come from php-stubs/wordpress-stubs. `wp_get_typography_font_size_value()` narrows `$settings` to `array`, since passing a boolean was deprecated in 6.6.0.

    `validate_email()` also stops passing its `$check_domain` argument to `is_email()`, where it is deprecated and triggered a second deprecation notice.

    Developed in: https://github.com/WordPress/wordpress-develop/pull/13889

    Follow-up to r64045.

    Props marian1, swissspidy, westonruter.
    See #65817.
    Built from https://develop.svn.wordpress.org/trunk@64163


    git-svn-id: http://core.svn.wordpress.org/trunk@63314 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php
index 535a00cd3f..9149f50daa 100644
--- a/wp-admin/includes/meta-boxes.php
+++ b/wp-admin/includes/meta-boxes.php
@@ -1257,6 +1257,8 @@ function link_target_meta_box( $link ) {
  *                                 if it matches the current link's relationship.
  *                                 Default empty string.
  * @param mixed  $deprecated       Deprecated. Not used.
+ *
+ * @phpstan-param '' $deprecated
  */
 function xfn_check( $xfn_relationship, $xfn_value = '', $deprecated = '' ) {
 	global $link;
diff --git a/wp-admin/includes/plugin-install.php b/wp-admin/includes/plugin-install.php
index b37b956d34..ffae71c5b8 100644
--- a/wp-admin/includes/plugin-install.php
+++ b/wp-admin/includes/plugin-install.php
@@ -309,6 +309,8 @@ function install_dashboard() {
  * @since 4.6.0 The `$type_selector` parameter was deprecated.
  *
  * @param bool $deprecated Not used.
+ *
+ * @phpstan-param true $deprecated
  */
 function install_search_form( $deprecated = true ) {
 	$type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term';
diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php
index a34d473bca..39b6295f77 100644
--- a/wp-admin/includes/plugin.php
+++ b/wp-admin/includes/plugin.php
@@ -907,6 +907,7 @@ function activate_plugins( $plugins, $redirect = '', $network_wide = false, $sil
  * @return bool|null|WP_Error True on success, false if `$plugins` is empty, `WP_Error` on failure.
  *                            `null` if filesystem credentials are required to proceed.
  *
+ * @phpstan-param '' $deprecated
  * @phpstan-return ( $plugins is empty ? false : true|null|WP_Error )
  */
 function delete_plugins( $plugins, $deprecated = '' ) {
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index 93428dcc4a..e8f6c4f5ba 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -2143,6 +2143,8 @@ function _admin_search_query() {
  *
  * @param string $title      Optional. Title of the Iframe page. Default empty.
  * @param bool   $deprecated Not used.
+ *
+ * @phpstan-param false $deprecated
  */
 function iframe_header( $title = '', $deprecated = false ) {
 	global $hook_suffix, $admin_body_class, $body_id, $wp_locale;
diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php
index 833167da34..461ab78a21 100644
--- a/wp-admin/includes/upgrade.php
+++ b/wp-admin/includes/upgrade.php
@@ -43,6 +43,8 @@ if ( ! function_exists( 'wp_install' ) ) :
 	 *     @type string $password         The password of the site owner, if their user account didn't already exist.
 	 *     @type string $password_message The explanatory message regarding the password.
 	 * }
+	 *
+	 * @phpstan-param '' $deprecated
 	 */
 	function wp_install(
 		$blog_title,
diff --git a/wp-includes/author-template.php b/wp-includes/author-template.php
index 342132fead..204f69cac5 100644
--- a/wp-includes/author-template.php
+++ b/wp-includes/author-template.php
@@ -20,6 +20,8 @@
  *
  * @param string $deprecated Deprecated.
  * @return string The author's display name, empty string if unknown.
+ *
+ * @phpstan-param '' $deprecated
  */
 function get_the_author( $deprecated = '' ) {
 	global $authordata;
@@ -57,6 +59,9 @@ function get_the_author( $deprecated = '' ) {
  * @param string $deprecated      Deprecated.
  * @param bool   $deprecated_echo Deprecated. Use get_the_author(). Echo the string or return it.
  * @return string The author's display name, from get_the_author().
+ *
+ * @phpstan-param '' $deprecated
+ * @phpstan-param true $deprecated_echo
  */
 function the_author( $deprecated = '', $deprecated_echo = true ) {
 	if ( ! empty( $deprecated ) ) {
@@ -362,6 +367,8 @@ function get_the_author_posts_link() {
  * @since 4.4.0 Converted into a wrapper for get_the_author_posts_link()
  *
  * @param string $deprecated Unused.
+ *
+ * @phpstan-param '' $deprecated
  */
 function the_author_posts_link( $deprecated = '' ) {
 	if ( ! empty( $deprecated ) ) {
diff --git a/wp-includes/block-patterns.php b/wp-includes/block-patterns.php
index 50ca1a4263..3e50b349d2 100644
--- a/wp-includes/block-patterns.php
+++ b/wp-includes/block-patterns.php
@@ -277,6 +277,8 @@ function wp_normalize_remote_block_pattern( $pattern ) {
  * @since 6.3.0 Add 'pattern-directory/core' to the pattern's 'source'.
  *
  * @param WP_Screen $deprecated Unused. Formerly the screen that the current request was triggered from.
+ *
+ * @phpstan-param null $deprecated
  */
 function _load_remote_block_patterns( $deprecated = null ) {
 	if ( ! empty( $deprecated ) ) {
diff --git a/wp-includes/block-supports/typography.php b/wp-includes/block-supports/typography.php
index b0d2de2aed..6204ed02b6 100644
--- a/wp-includes/block-supports/typography.php
+++ b/wp-includes/block-supports/typography.php
@@ -573,9 +573,11 @@ function wp_get_computed_fluid_typography_value( $args = array() ) {
  *     @type string           $slug Kebab-case, unique identifier for the font size preset.
  *     @type string|int|float $size CSS font-size value, including units if applicable.
  * }
- * @param bool|array $settings Optional Theme JSON settings array that overrides any global theme settings.
- *                             Default is false.
+ * @param bool|array $settings Optional. Theme JSON settings array that overrides any global theme settings.
+ *                             Passing a boolean is deprecated. Default empty array.
  * @return string|null Font-size value or null if a size is not passed in $preset.
+ *
+ * @phpstan-param array $settings
  */
 function wp_get_typography_font_size_value( $preset, $settings = array() ) {
 	if ( ! isset( $preset['size'] ) ) {
diff --git a/wp-includes/block-template-utils.php b/wp-includes/block-template-utils.php
index 78cd1bbdc1..9c6be11c7d 100644
--- a/wp-includes/block-template-utils.php
+++ b/wp-includes/block-template-utils.php
@@ -1711,6 +1711,8 @@ function get_template_hierarchy( $slug, $is_custom = false, $template_prefix = '
  *                                    prepared for inserting or updating the database.
  * @param WP_REST_Request $deprecated Deprecated. Not used.
  * @return stdClass|WP_Error The updated object representing a template or template part.
+ *
+ * @phpstan-param null $deprecated
  */
 function inject_ignored_hooked_blocks_metadata_attributes( $changes, $deprecated = null ) {
 	if ( null !== $deprecated ) {
diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php
index 1d456f309d..b4c40d2ac9 100644
--- a/wp-includes/category-template.php
+++ b/wp-includes/category-template.php
@@ -43,6 +43,8 @@ function get_category_link( $category ) {
  * @param bool   $nicename    Optional. Whether to use nice name for display. Default false.
  * @param array  $deprecated  Not used.
  * @return string|WP_Error A list of category parents on success, WP_Error on failure.
+ *
+ * @phpstan-param array{} $deprecated
  */
 function get_category_parents( $category_id, $link = false, $separator = '/', $nicename = false, $deprecated = array() ) {

diff --git a/wp-includes/class-wp-object-cache.php b/wp-includes/class-wp-object-cache.php
index cda63e66d4..d79246ad2e 100644
--- a/wp-includes/class-wp-object-cache.php
+++ b/wp-includes/class-wp-object-cache.php
@@ -420,6 +420,8 @@ class WP_Object_Cache {
 	 * @param string     $group      Optional. Where the cache contents are grouped. Default 'default'.
 	 * @param bool       $deprecated Optional. Unused. Default false.
 	 * @return bool True on success, false if the contents were not deleted.
+	 *
+	 * @phpstan-param false $deprecated
 	 */
 	public function delete( $key, $group = 'default', $deprecated = false ) {
 		if ( ! $this->is_valid_key( $key ) ) {
diff --git a/wp-includes/class-wp-theme-json-resolver.php b/wp-includes/class-wp-theme-json-resolver.php
index dc236f8790..05eedbcd40 100644
--- a/wp-includes/class-wp-theme-json-resolver.php
+++ b/wp-includes/class-wp-theme-json-resolver.php
@@ -240,6 +240,8 @@ class WP_Theme_JSON_Resolver {
 	 *     @type bool $with_supports Whether to include theme supports in the data. Default true.
 	 * }
 	 * @return WP_Theme_JSON Entity that holds theme data.
+	 *
+	 * @phpstan-param array{} $deprecated
 	 */
 	public static function get_theme_data( $deprecated = array(), $options = array() ) {
 		if ( ! empty( $deprecated ) ) {
diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php
index f706836217..cc2608d422 100644
--- a/wp-includes/comment-template.php
+++ b/wp-includes/comment-template.php
@@ -893,6 +893,9 @@ function get_comments_link( $post = 0 ) {
  *
  * @param string $deprecated   Not Used.
  * @param string $deprecated_2 Not Used.
+ *
+ * @phpstan-param '' $deprecated
+ * @phpstan-param '' $deprecated_2
  */
 function comments_link( $deprecated = '', $deprecated_2 = '' ) {
 	if ( ! empty( $deprecated ) ) {
@@ -1279,6 +1282,8 @@ function trackback_url( $deprecated_echo = true ) {
  * @since 0.71
  *
  * @param int|string $deprecated Not used (Was $timezone = 0).
+ *
+ * @phpstan-param '' $deprecated
  */
 function trackback_rdf( $deprecated = '' ) {
 	if ( ! empty( $deprecated ) ) {
diff --git a/wp-includes/comment.php b/wp-includes/comment.php
index 9ad18180b7..9111358efc 100644
--- a/wp-includes/comment.php
+++ b/wp-includes/comment.php
@@ -3204,6 +3204,8 @@ function wp_update_comment_count_now( $post_id ) {
  * @param string $url        URL to ping.
  * @param string $deprecated Not Used.
  * @return string|false String containing URI on success, false on failure.
+ *
+ * @phpstan-param '' $deprecated
  */
 function discover_pingback_server_uri( $url, $deprecated = '' ) {
 	if ( ! empty( $deprecated ) ) {
diff --git a/wp-includes/feed.php b/wp-includes/feed.php
index 7f9988b29f..7f9b977656 100644
--- a/wp-includes/feed.php
+++ b/wp-includes/feed.php
@@ -99,6 +99,8 @@ function get_default_feed() {
  *
  * @param string $deprecated Unused.
  * @return string The document title.
+ *
+ * @phpstan-param '&#8211;' $deprecated
  */
 function get_wp_title_rss( $deprecated = '&#8211;' ) {
 	if ( '&#8211;' !== $deprecated ) {
@@ -125,6 +127,8 @@ function get_wp_title_rss( $deprecated = '&#8211;' ) {
  * @since 4.4.0 The optional `$sep` parameter was deprecated and renamed to `$deprecated`.
  *
  * @param string $deprecated Unused.
+ *
+ * @phpstan-param '&#8211;' $deprecated
  */
 function wp_title_rss( $deprecated = '&#8211;' ) {
 	if ( '&#8211;' !== $deprecated ) {
diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
index 480ca7fb5e..8895aede59 100644
--- a/wp-includes/formatting.php
+++ b/wp-includes/formatting.php
@@ -2525,6 +2525,8 @@ function sanitize_locale_name( $locale_name ) {
  * @param string $content    String of characters to be converted.
  * @param string $deprecated Not used.
  * @return string Converted string.
+ *
+ * @phpstan-param '' $deprecated
  */
 function convert_chars( $content, $deprecated = '' ) {
 	if ( ! empty( $deprecated ) ) {
@@ -3656,6 +3658,8 @@ function convert_smilies( $text ) {
  * @param string $email      Email address to verify.
  * @param bool   $deprecated Deprecated.
  * @return string|false Valid email address on success, false on failure.
+ *
+ * @phpstan-param false $deprecated
  */
 function is_email( $email, $deprecated = false ) {
 	if ( ! empty( $deprecated ) ) {
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index dd6113900f..d97fab076f 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -1005,6 +1005,8 @@ function do_enclose( $content, $post ) {
  * @param string $url        URL to retrieve HTTP headers from.
  * @param bool   $deprecated Not Used.
  * @return \WpOrg\Requests\Utility\CaseInsensitiveDictionary|false Headers on success, false on failure.
+ *
+ * @phpstan-param false $deprecated
  */
 function wp_get_http_headers( $url, $deprecated = false ) {
 	if ( ! empty( $deprecated ) ) {
@@ -2953,6 +2955,8 @@ function _wp_check_existing_file_names( $filename, $files ) {
  *                               Not set if there has been an error.
  *     @type string|false $error Error message, if there has been an error.
  * }
+ *
+ * @phpstan-param null $deprecated
  * @phpstan-return array{ file: non-empty-string, url: non-empty-string, type: string|false, error: false }
  *                |array{ error: string, ... }
  */
diff --git a/wp-includes/kses.php b/wp-includes/kses.php
index fe0ce97317..941f7166b0 100644
--- a/wp-includes/kses.php
+++ b/wp-includes/kses.php
@@ -2629,6 +2629,8 @@ function kses_init() {
  * @param string $css        A string of CSS rules, decoded from an HTML `style` attribute.
  * @param string $deprecated Not used.
  * @return string Filtered string of CSS rules, needing HTML escaping before sending back to a `style` attribute.
+ *
+ * @phpstan-param '' $deprecated
  */
 function safecss_filter_attr( $css, $deprecated = '' ) {
 	if ( ! empty( $deprecated ) ) {
diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php
index f83d1ce61f..446b828721 100644
--- a/wp-includes/l10n.php
+++ b/wp-includes/l10n.php
@@ -1025,6 +1025,8 @@ function load_default_textdomain( $locale = null ) {
  * @param string|false $plugin_rel_path Optional. Relative path to WP_PLUGIN_DIR where the .mo file resides.
  *                                      Default false.
  * @return bool True when textdomain is successfully loaded, false otherwise.
+ *
+ * @phpstan-param false $deprecated
  */
 function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path = false ) {
 	/** @var WP_Textdomain_Registry $wp_textdomain_registry */
diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php
index 6d334d5e9e..4a7300f5bf 100644
--- a/wp-includes/link-template.php
+++ b/wp-includes/link-template.php
@@ -1560,6 +1560,8 @@ function edit_post_link( $text = null, $before = '', $after = '', $post = 0, $cs
  * @param string      $deprecated   Not used.
  * @param bool        $force_delete Optional. Whether to bypass Trash and force deletion. Default false.
  * @return string|null The delete post link URL for the given post.
+ *
+ * @phpstan-param '' $deprecated
  */
 function get_delete_post_link( $post = 0, $deprecated = '', $force_delete = false ) {
 	if ( ! empty( $deprecated ) ) {
diff --git a/wp-includes/meta.php b/wp-includes/meta.php
index 6adcf389d5..765ce96e58 100644
--- a/wp-includes/meta.php
+++ b/wp-includes/meta.php
@@ -1490,6 +1490,8 @@ function sanitize_meta( $meta_key, $meta_value, $object_type, $object_subtype =
  * @return bool True if the meta key was successfully registered in the global array, false if not.
  *              Registering a meta key with distinct sanitize and auth callbacks will fire those callbacks,
  *              but will not add to the global registry.
+ *
+ * @phpstan-param null $deprecated
  */
 function register_meta( $object_type, $meta_key, $args, $deprecated = null ) {
 	global $wp_meta_keys;
diff --git a/wp-includes/ms-blogs.php b/wp-includes/ms-blogs.php
index c54563fbbd..2ac766ffc3 100644
--- a/wp-includes/ms-blogs.php
+++ b/wp-includes/ms-blogs.php
@@ -456,6 +456,8 @@ function delete_blog_option( $id, $option ) {
  * @param mixed  $value      The option value.
  * @param mixed  $deprecated Not used.
  * @return bool True if the value was updated, false otherwise.
+ *
+ * @phpstan-param null $deprecated
  */
 function update_blog_option( $id, $option, $value, $deprecated = null ) {
 	$id = (int) $id;
@@ -496,6 +498,8 @@ function update_blog_option( $id, $option, $value, $deprecated = null ) {
  * @param int  $new_blog_id The ID of the blog to switch to. Default: current blog.
  * @param bool $deprecated  Not used.
  * @return true Always returns true.
+ *
+ * @phpstan-param null $deprecated
  */
 function switch_to_blog( $new_blog_id, $deprecated = null ) {
 	global $wpdb;
@@ -819,6 +823,8 @@ function get_blog_status( $id, $pref ) {
  *                          Can be used for pagination. Default 0.
  * @param int   $quantity   Optional. The maximum number of blogs to retrieve. Default 40.
  * @return array The list of blogs.
+ *
+ * @phpstan-param '' $deprecated
  */
 function get_last_updated( $deprecated = '', $start = 0, $quantity = 40 ) {
 	global $wpdb;
diff --git a/wp-includes/ms-deprecated.php b/wp-includes/ms-deprecated.php
index c1de27db4c..8b4a1ff6f0 100644
--- a/wp-includes/ms-deprecated.php
+++ b/wp-includes/ms-deprecated.php
@@ -171,7 +171,7 @@ function is_main_blog() {
  */
 function validate_email( $email, $check_domain = true) {
 	_deprecated_function( __FUNCTION__, '3.0.0', 'is_email()' );
-	return is_email( $email, $check_domain );
+	return is_email( $email );
 }

 /**
diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php
index 81dda98f3e..b5097bca8a 100644
--- a/wp-includes/ms-functions.php
+++ b/wp-includes/ms-functions.php
@@ -1478,6 +1478,8 @@ function wpmu_create_blog( $domain, $path, $title, $user_id, $options = array(),
  * @param WP_Site|int $blog_id    The new site's object or ID.
  * @param string      $deprecated Not used.
  * @return bool
+ *
+ * @phpstan-param '' $deprecated
  */
 function newblog_notify_siteadmin( $blog_id, $deprecated = '' ) {
 	if ( is_object( $blog_id ) ) {
@@ -2088,6 +2090,8 @@ function check_upload_mimes( $mimes ) {
  * @global wpdb $wpdb WordPress database abstraction object.
  *
  * @param string $deprecated Not used.
+ *
+ * @phpstan-param '' $deprecated
  */
 function update_posts_count( $deprecated = '' ) {
 	global $wpdb;
diff --git a/wp-includes/option.php b/wp-includes/option.php
index d5c179c645..49ecfb6597 100644
--- a/wp-includes/option.php
+++ b/wp-includes/option.php
@@ -1065,6 +1065,8 @@ function update_option( $option, $value, $autoload = null ) {
  *                              to not autoload them, by using false.
  *                              Default is null, which means WordPress will determine the autoload value.
  * @return bool True if the option was added, false otherwise.
+ *
+ * @phpstan-param '' $deprecated
  */
 function add_option( $option, $value = '', $deprecated = '', $autoload = null ) {
 	global $wpdb;
@@ -1930,6 +1932,8 @@ function delete_all_user_settings() {
  * @param mixed  $default_value Optional. Value to return if the option doesn't exist. Default false.
  * @param bool   $deprecated    Whether to use cache. Multisite only. Always set to true.
  * @return mixed Value set for the option.
+ *
+ * @phpstan-param true $deprecated
  */
 function get_site_option( $option, $default_value = false, $deprecated = true ) {
 	return get_network_option( null, $option, $default_value );
diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php
index b817653aaf..8a571495e9 100644
--- a/wp-includes/post-template.php
+++ b/wp-includes/post-template.php
@@ -1640,6 +1640,8 @@ function walk_page_dropdown_tree( ...$args ) {
  * @param bool        $fullsize   Optional. Whether to use full size. Default false.
  * @param bool        $deprecated Deprecated. Not used.
  * @param bool        $permalink  Optional. Whether to include permalink. Default false.
+ *
+ * @phpstan-param false $deprecated
  */
 function the_attachment_link( $post = 0, $fullsize = false, $deprecated = false, $permalink = false ) {
 	if ( ! empty( $deprecated ) ) {
diff --git a/wp-includes/revision.php b/wp-includes/revision.php
index 31bbceeb4e..179a32c283 100644
--- a/wp-includes/revision.php
+++ b/wp-includes/revision.php
@@ -18,6 +18,8 @@
  *                                  for insertion as a post revision. Default empty array.
  * @param bool          $deprecated Not used.
  * @return string[] Array of fields that can be versioned.
+ *
+ * @phpstan-param false $deprecated
  */
 function _wp_post_revision_fields( $post = array(), $deprecated = false ) {
 	static $fields = null;
diff --git a/wp-includes/user.php b/wp-includes/user.php
index 92d0911655..352dcf357b 100644
--- a/wp-includes/user.php
+++ b/wp-includes/user.php
@@ -749,6 +749,8 @@ function get_current_user_id() {
  * @param int    $user       Optional. User ID.
  * @param string $deprecated Use get_option() to check for an option in the options table.
  * @return mixed User option value on success, false on failure.
+ *
+ * @phpstan-param '' $deprecated
  */
 function get_user_option( $option, $user = 0, $deprecated = '' ) {
 	global $wpdb;
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 0b19e5a305..d95b9411e0 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-alpha-64133';
+$wp_version = '7.2-alpha-64163';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php
index 5e679f4b92..d40a39ced0 100644
--- a/wp-includes/widgets.php
+++ b/wp-includes/widgets.php
@@ -1018,6 +1018,8 @@ function is_active_sidebar( $index ) {
  *
  * @param bool $deprecated Not used (argument deprecated).
  * @return array Upgraded list of widgets to version 3 array format when called from the admin.
+ *
+ * @phpstan-param true $deprecated
  */
 function wp_get_sidebars_widgets( $deprecated = true ) {
 	if ( true !== $deprecated ) {