Commit 2f3ca6d1ca for wordpress.org

commit 2f3ca6d1cab15d76d5ae13526fdc40b3606a3bc2
Author: westonruter <westonruter@git.wordpress.org>
Date:   Tue Oct 27 02:44:57 2026 +0000

    Docs: Add PHPStan types for optional callback parameters.

    The `add_*_page()` functions and the `Custom_Background` and `Custom_Image_Header` constructors default their callback to an empty string, and plugins as well as core pass `null` to them, neither of which a plain `callable` allows. Their callbacks are now documented as `''|(callable(): mixed)|null`, since the page and header hooks invoke them without arguments. The type is written out at each use rather than declared as a global alias, as aliases defined only for core's own analysis are lost to anyone analyzing against core's source or the stubs generated from it.

    The deprecated third parameter of `unregister_setting()` is narrowed to its default of an empty string, in the same way as other unused deprecated parameters, so that static analysis flags callers still passing a sanitize callback. The callbacks of `register_activation_hook()`, `register_deactivation_hook()`, `register_uninstall_hook()`, and `add_feed()` are documented with the arguments core calls them with.

    This resolves every entry in the `parameter.defaultValue` PHPStan baseline, so that baseline is removed.

    Developed in https://github.com/WordPress/wordpress-develop/pull/13890.
    Follow-up to r63020, r64163, r64756.

    Props swissspidy, marian1, westonruter.
    See #65817.

    Built from https://develop.svn.wordpress.org/trunk@64793


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

diff --git a/wp-admin/includes/class-custom-background.php b/wp-admin/includes/class-custom-background.php
index e147739162..1e3a39da94 100644
--- a/wp-admin/includes/class-custom-background.php
+++ b/wp-admin/includes/class-custom-background.php
@@ -18,7 +18,9 @@ class Custom_Background {
 	 * Callback for administration header.
 	 *
 	 * @since 3.0.0
-	 * @var callable
+	 * @var callable|string|null
+	 *
+	 * @phpstan-var ''|(callable(): mixed)|null
 	 */
 	public $admin_header_callback;

@@ -26,7 +28,9 @@ class Custom_Background {
 	 * Callback for header div.
 	 *
 	 * @since 3.0.0
-	 * @var callable
+	 * @var callable|string|null
+	 *
+	 * @phpstan-var ''|(callable(): mixed)|null
 	 */
 	public $admin_image_div_callback;

@@ -43,10 +47,13 @@ class Custom_Background {
 	 *
 	 * @since 3.0.0
 	 *
-	 * @param callable $admin_header_callback    Optional. Administration header callback.
-	 *                                           Default empty string.
-	 * @param callable $admin_image_div_callback Optional. Custom image div output callback.
-	 *                                           Default empty string.
+	 * @param callable|string|null $admin_header_callback    Optional. Administration header callback.
+	 *                                                       Empty string or null for none. Default empty string.
+	 * @param callable|string|null $admin_image_div_callback Optional. Custom image div output callback.
+	 *                                                       Empty string or null for none. Default empty string.
+	 *
+	 * @phpstan-param ''|(callable(): mixed)|null $admin_header_callback
+	 * @phpstan-param ''|(callable(): mixed)|null $admin_image_div_callback
 	 */
 	public function __construct( $admin_header_callback = '', $admin_image_div_callback = '' ) {
 		$this->admin_header_callback    = $admin_header_callback;
diff --git a/wp-admin/includes/class-custom-image-header.php b/wp-admin/includes/class-custom-image-header.php
index a4cf43b1ce..147f44cc10 100644
--- a/wp-admin/includes/class-custom-image-header.php
+++ b/wp-admin/includes/class-custom-image-header.php
@@ -18,7 +18,9 @@ class Custom_Image_Header {
 	 * Callback for administration header.
 	 *
 	 * @since 2.1.0
-	 * @var callable
+	 * @var callable|string|null
+	 *
+	 * @phpstan-var ''|(callable(): mixed)|null
 	 */
 	public $admin_header_callback;

@@ -26,7 +28,9 @@ class Custom_Image_Header {
 	 * Callback for header div.
 	 *
 	 * @since 3.0.0
-	 * @var callable
+	 * @var callable|string|null
+	 *
+	 * @phpstan-var ''|(callable(): mixed)|null
 	 */
 	public $admin_image_div_callback;

@@ -51,9 +55,13 @@ class Custom_Image_Header {
 	 *
 	 * @since 2.1.0
 	 *
-	 * @param callable $admin_header_callback    Administration header callback.
-	 * @param callable $admin_image_div_callback Optional. Custom image div output callback.
-	 *                                           Default empty string.
+	 * @param callable|string|null $admin_header_callback    Administration header callback.
+	 *                                                       Empty string or null for none.
+	 * @param callable|string|null $admin_image_div_callback Optional. Custom image div output callback.
+	 *                                                       Empty string or null for none. Default empty string.
+	 *
+	 * @phpstan-param ''|(callable(): mixed)|null $admin_header_callback
+	 * @phpstan-param ''|(callable(): mixed)|null $admin_image_div_callback
 	 */
 	public function __construct( $admin_header_callback, $admin_image_div_callback = '' ) {
 		$this->admin_header_callback    = $admin_header_callback;
diff --git a/wp-admin/includes/deprecated.php b/wp-admin/includes/deprecated.php
index 1a7eee4811..b3aaad1ad9 100644
--- a/wp-admin/includes/deprecated.php
+++ b/wp-admin/includes/deprecated.php
@@ -1427,13 +1427,15 @@ function _relocate_children( $old_ID, $new_ID ) {
  * @see add_menu_page()
  * @global int $_wp_last_object_menu
  *
- * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
- * @param string   $menu_title The text to be used for the menu.
- * @param string   $capability The capability required for this menu to be displayed to the user.
- * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
- * @param callable $callback   Optional. The function to be called to output the content for this page.
- * @param string   $icon_url   Optional. The URL to the icon to be used for this menu.
+ * @param string               $page_title The text to be displayed in the title tags of the page when the menu is selected.
+ * @param string               $menu_title The text to be used for the menu.
+ * @param string               $capability The capability required for this menu to be displayed to the user.
+ * @param string               $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
+ * @param callable|string|null $callback   Optional. The function to be called to output the content for this page.
+ * @param string               $icon_url   Optional. The URL to the icon to be used for this menu.
  * @return string The resulting page's hook_suffix.
+ *
+ * @phpstan-param ''|(callable(): mixed)|null $callback
  */
 function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '') {
 	_deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' );
@@ -1460,13 +1462,15 @@ function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $ca
  * @see add_menu_page()
  * @global int $_wp_last_utility_menu
  *
- * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
- * @param string   $menu_title The text to be used for the menu.
- * @param string   $capability The capability required for this menu to be displayed to the user.
- * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
- * @param callable $callback   Optional. The function to be called to output the content for this page.
- * @param string   $icon_url   Optional. The URL to the icon to be used for this menu.
+ * @param string               $page_title The text to be displayed in the title tags of the page when the menu is selected.
+ * @param string               $menu_title The text to be used for the menu.
+ * @param string               $capability The capability required for this menu to be displayed to the user.
+ * @param string               $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
+ * @param callable|string|null $callback   Optional. The function to be called to output the content for this page.
+ * @param string               $icon_url   Optional. The URL to the icon to be used for this menu.
  * @return string The resulting page's hook_suffix.
+ *
+ * @phpstan-param ''|(callable(): mixed)|null $callback
  */
 function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '') {
 	_deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' );
diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php
index 9fc438026c..2a68eae362 100644
--- a/wp-admin/includes/plugin.php
+++ b/wp-admin/includes/plugin.php
@@ -1384,25 +1384,26 @@ function uninstall_plugin( $plugin ) {
  * @global array $_registered_pages
  * @global array $_parent_pages
  *
- * @param string    $page_title The text to be displayed in the title tags of the page when the menu is selected.
- * @param string    $menu_title The text to be used for the menu.
- * @param string    $capability The capability required for this menu to be displayed to the user.
- * @param string    $menu_slug  The slug name to refer to this menu by. Should be unique for this menu page and only
- *                              include lowercase alphanumeric, dashes, and underscores characters to be compatible
- *                              with sanitize_key().
- * @param callable  $callback   Optional. The function to be called to output the content for this page.
- * @param string    $icon_url   Optional. The URL to the icon to be used for this menu.
- *                              * Pass a base64-encoded SVG using a data URI, which will be colored to match
- *                                the color scheme. This should begin with 'data:image/svg+xml;base64,'.
- *                              * Pass the name of a Dashicons helper class to use a font icon,
- *                                e.g. 'dashicons-chart-pie'.
- *                              * Pass the namespaced name of a registered icon to render it as an inline SVG,
- *                                e.g. 'core-admin/pin'.
- *                              * Pass 'none' to leave div.wp-menu-image empty so an icon can be added via CSS.
- * @param int|float $position   Optional. The position in the menu order this item should appear.
+ * @param string               $page_title The text to be displayed in the title tags of the page when the menu is selected.
+ * @param string               $menu_title The text to be used for the menu.
+ * @param string               $capability The capability required for this menu to be displayed to the user.
+ * @param string               $menu_slug  The slug name to refer to this menu by. Should be unique for this menu page and only
+ *                                         include lowercase alphanumeric, dashes, and underscores characters to be compatible
+ *                                         with sanitize_key().
+ * @param callable|string|null $callback   Optional. The function to be called to output the content for this page.
+ * @param string               $icon_url   Optional. The URL to the icon to be used for this menu.
+ *                                         * Pass a base64-encoded SVG using a data URI, which will be colored to match
+ *                                           the color scheme. This should begin with 'data:image/svg+xml;base64,'.
+ *                                         * Pass the name of a Dashicons helper class to use a font icon,
+ *                                           e.g. 'dashicons-chart-pie'.
+ *                                         * Pass the namespaced name of a registered icon to render it as an inline SVG,
+ *                                           e.g. 'core-admin/pin'.
+ *                                         * Pass 'none' to leave div.wp-menu-image empty so an icon can be added via CSS.
+ * @param int|float            $position   Optional. The position in the menu order this item should appear.
  * @return string The resulting page's hook_suffix.
  *
- * @phpstan-param non-falsy-string $menu_slug
+ * @phpstan-param non-falsy-string            $menu_slug
+ * @phpstan-param ''|(callable(): mixed)|null $callback
  */
 function add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '', $position = null ) {
 	global $menu, $admin_page_hooks, $_registered_pages, $_parent_pages;
@@ -1487,20 +1488,21 @@ function add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $call
  * @global array<string, true>                $_registered_pages
  * @global array                              $_parent_pages
  *
- * @param string    $parent_slug The slug name for the parent menu (or the file name of a standard
- *                               WordPress admin page).
- * @param string    $page_title  The text to be displayed in the title tags of the page when the menu
- *                               is selected.
- * @param string    $menu_title  The text to be used for the menu.
- * @param string    $capability  The capability required for this menu to be displayed to the user.
- * @param string    $menu_slug   The slug name to refer to this menu by. Should be unique for this menu
- *                               and only include lowercase alphanumeric, dashes, and underscores characters
- *                               to be compatible with sanitize_key().
- * @param callable  $callback    Optional. The function to be called to output the content for this page.
- * @param int|float $position    Optional. The position in the menu order this item should appear.
+ * @param string               $parent_slug The slug name for the parent menu (or the file name of a standard
+ *                                          WordPress admin page).
+ * @param string               $page_title  The text to be displayed in the title tags of the page when the menu
+ *                                          is selected.
+ * @param string               $menu_title  The text to be used for the menu.
+ * @param string               $capability  The capability required for this menu to be displayed to the user.
+ * @param string               $menu_slug   The slug name to refer to this menu by. Should be unique for this menu
+ *                                          and only include lowercase alphanumeric, dashes, and underscores characters
+ *                                          to be compatible with sanitize_key().
+ * @param callable|string|null $callback    Optional. The function to be called to output the content for this page.
+ * @param int|float            $position    Optional. The position in the menu order this item should appear.
  * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
  *
- * @phpstan-param non-falsy-string $menu_slug
+ * @phpstan-param non-falsy-string            $menu_slug
+ * @phpstan-param ''|(callable(): mixed)|null $callback
  */
 function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
 	global $submenu, $menu, $_wp_real_parent_file, $_wp_submenu_nopriv,
@@ -1608,15 +1610,16 @@ function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability,
  * @since 1.5.0
  * @since 5.3.0 Added the `$position` parameter.
  *
- * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
- * @param string   $menu_title The text to be used for the menu.
- * @param string   $capability The capability required for this menu to be displayed to the user.
- * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
- * @param callable $callback   Optional. The function to be called to output the content for this page.
- * @param int      $position   Optional. The position in the menu order this item should appear.
+ * @param string               $page_title The text to be displayed in the title tags of the page when the menu is selected.
+ * @param string               $menu_title The text to be used for the menu.
+ * @param string               $capability The capability required for this menu to be displayed to the user.
+ * @param string               $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
+ * @param callable|string|null $callback   Optional. The function to be called to output the content for this page.
+ * @param int                  $position   Optional. The position in the menu order this item should appear.
  * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
  *
- * @phpstan-param non-falsy-string $menu_slug
+ * @phpstan-param non-falsy-string            $menu_slug
+ * @phpstan-param ''|(callable(): mixed)|null $callback
  */
 function add_management_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
 	return add_submenu_page( 'tools.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
@@ -1634,15 +1637,16 @@ function add_management_page( $page_title, $menu_title, $capability, $menu_slug,
  * @since 1.5.0
  * @since 5.3.0 Added the `$position` parameter.
  *
- * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
- * @param string   $menu_title The text to be used for the menu.
- * @param string   $capability The capability required for this menu to be displayed to the user.
- * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
- * @param callable $callback   Optional. The function to be called to output the content for this page.
- * @param int      $position   Optional. The position in the menu order this item should appear.
+ * @param string               $page_title The text to be displayed in the title tags of the page when the menu is selected.
+ * @param string               $menu_title The text to be used for the menu.
+ * @param string               $capability The capability required for this menu to be displayed to the user.
+ * @param string               $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
+ * @param callable|string|null $callback   Optional. The function to be called to output the content for this page.
+ * @param int                  $position   Optional. The position in the menu order this item should appear.
  * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
  *
- * @phpstan-param non-falsy-string $menu_slug
+ * @phpstan-param non-falsy-string            $menu_slug
+ * @phpstan-param ''|(callable(): mixed)|null $callback
  */
 function add_options_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
 	return add_submenu_page( 'options-general.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
@@ -1660,15 +1664,16 @@ function add_options_page( $page_title, $menu_title, $capability, $menu_slug, $c
  * @since 2.0.0
  * @since 5.3.0 Added the `$position` parameter.
  *
- * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
- * @param string   $menu_title The text to be used for the menu.
- * @param string   $capability The capability required for this menu to be displayed to the user.
- * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
- * @param callable $callback   Optional. The function to be called to output the content for this page.
- * @param int      $position   Optional. The position in the menu order this item should appear.
+ * @param string               $page_title The text to be displayed in the title tags of the page when the menu is selected.
+ * @param string               $menu_title The text to be used for the menu.
+ * @param string               $capability The capability required for this menu to be displayed to the user.
+ * @param string               $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
+ * @param callable|string|null $callback   Optional. The function to be called to output the content for this page.
+ * @param int                  $position   Optional. The position in the menu order this item should appear.
  * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
  *
- * @phpstan-param non-falsy-string $menu_slug
+ * @phpstan-param non-falsy-string            $menu_slug
+ * @phpstan-param ''|(callable(): mixed)|null $callback
  */
 function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
 	return add_submenu_page( 'themes.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
@@ -1686,15 +1691,16 @@ function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $cal
  * @since 3.0.0
  * @since 5.3.0 Added the `$position` parameter.
  *
- * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
- * @param string   $menu_title The text to be used for the menu.
- * @param string   $capability The capability required for this menu to be displayed to the user.
- * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
- * @param callable $callback   Optional. The function to be called to output the content for this page.
- * @param int      $position   Optional. The position in the menu order this item should appear.
+ * @param string               $page_title The text to be displayed in the title tags of the page when the menu is selected.
+ * @param string               $menu_title The text to be used for the menu.
+ * @param string               $capability The capability required for this menu to be displayed to the user.
+ * @param string               $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
+ * @param callable|string|null $callback   Optional. The function to be called to output the content for this page.
+ * @param int                  $position   Optional. The position in the menu order this item should appear.
  * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
  *
- * @phpstan-param non-falsy-string $menu_slug
+ * @phpstan-param non-falsy-string            $menu_slug
+ * @phpstan-param ''|(callable(): mixed)|null $callback
  */
 function add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
 	return add_submenu_page( 'plugins.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
@@ -1712,15 +1718,16 @@ function add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $c
  * @since 2.1.3
  * @since 5.3.0 Added the `$position` parameter.
  *
- * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
- * @param string   $menu_title The text to be used for the menu.
- * @param string   $capability The capability required for this menu to be displayed to the user.
- * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
- * @param callable $callback   Optional. The function to be called to output the content for this page.
- * @param int      $position   Optional. The position in the menu order this item should appear.
+ * @param string               $page_title The text to be displayed in the title tags of the page when the menu is selected.
+ * @param string               $menu_title The text to be used for the menu.
+ * @param string               $capability The capability required for this menu to be displayed to the user.
+ * @param string               $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
+ * @param callable|string|null $callback   Optional. The function to be called to output the content for this page.
+ * @param int                  $position   Optional. The position in the menu order this item should appear.
  * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
  *
- * @phpstan-param non-falsy-string $menu_slug
+ * @phpstan-param non-falsy-string            $menu_slug
+ * @phpstan-param ''|(callable(): mixed)|null $callback
  */
 function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
 	if ( current_user_can( 'edit_users' ) ) {
@@ -1743,15 +1750,16 @@ function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $cal
  * @since 2.7.0
  * @since 5.3.0 Added the `$position` parameter.
  *
- * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
- * @param string   $menu_title The text to be used for the menu.
- * @param string   $capability The capability required for this menu to be displayed to the user.
- * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
- * @param callable $callback   Optional. The function to be called to output the content for this page.
- * @param int      $position   Optional. The position in the menu order this item should appear.
+ * @param string               $page_title The text to be displayed in the title tags of the page when the menu is selected.
+ * @param string               $menu_title The text to be used for the menu.
+ * @param string               $capability The capability required for this menu to be displayed to the user.
+ * @param string               $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
+ * @param callable|string|null $callback   Optional. The function to be called to output the content for this page.
+ * @param int                  $position   Optional. The position in the menu order this item should appear.
  * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
  *
- * @phpstan-param non-falsy-string $menu_slug
+ * @phpstan-param non-falsy-string            $menu_slug
+ * @phpstan-param ''|(callable(): mixed)|null $callback
  */
 function add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
 	return add_submenu_page( 'index.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
@@ -1769,15 +1777,16 @@ function add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug,
  * @since 2.7.0
  * @since 5.3.0 Added the `$position` parameter.
  *
- * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
- * @param string   $menu_title The text to be used for the menu.
- * @param string   $capability The capability required for this menu to be displayed to the user.
- * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
- * @param callable $callback   Optional. The function to be called to output the content for this page.
- * @param int      $position   Optional. The position in the menu order this item should appear.
+ * @param string               $page_title The text to be displayed in the title tags of the page when the menu is selected.
+ * @param string               $menu_title The text to be used for the menu.
+ * @param string               $capability The capability required for this menu to be displayed to the user.
+ * @param string               $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
+ * @param callable|string|null $callback   Optional. The function to be called to output the content for this page.
+ * @param int                  $position   Optional. The position in the menu order this item should appear.
  * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
  *
- * @phpstan-param non-falsy-string $menu_slug
+ * @phpstan-param non-falsy-string            $menu_slug
+ * @phpstan-param ''|(callable(): mixed)|null $callback
  */
 function add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
 	return add_submenu_page( 'edit.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
@@ -1795,15 +1804,16 @@ function add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $cal
  * @since 2.7.0
  * @since 5.3.0 Added the `$position` parameter.
  *
- * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
- * @param string   $menu_title The text to be used for the menu.
- * @param string   $capability The capability required for this menu to be displayed to the user.
- * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
- * @param callable $callback   Optional. The function to be called to output the content for this page.
- * @param int      $position   Optional. The position in the menu order this item should appear.
+ * @param string               $page_title The text to be displayed in the title tags of the page when the menu is selected.
+ * @param string               $menu_title The text to be used for the menu.
+ * @param string               $capability The capability required for this menu to be displayed to the user.
+ * @param string               $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
+ * @param callable|string|null $callback   Optional. The function to be called to output the content for this page.
+ * @param int                  $position   Optional. The position in the menu order this item should appear.
  * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
  *
- * @phpstan-param non-falsy-string $menu_slug
+ * @phpstan-param non-falsy-string            $menu_slug
+ * @phpstan-param ''|(callable(): mixed)|null $callback
  */
 function add_media_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
 	return add_submenu_page( 'upload.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
@@ -1821,15 +1831,16 @@ function add_media_page( $page_title, $menu_title, $capability, $menu_slug, $cal
  * @since 2.7.0
  * @since 5.3.0 Added the `$position` parameter.
  *
- * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
- * @param string   $menu_title The text to be used for the menu.
- * @param string   $capability The capability required for this menu to be displayed to the user.
- * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
- * @param callable $callback   Optional. The function to be called to output the content for this page.
- * @param int      $position   Optional. The position in the menu order this item should appear.
+ * @param string               $page_title The text to be displayed in the title tags of the page when the menu is selected.
+ * @param string               $menu_title The text to be used for the menu.
+ * @param string               $capability The capability required for this menu to be displayed to the user.
+ * @param string               $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
+ * @param callable|string|null $callback   Optional. The function to be called to output the content for this page.
+ * @param int                  $position   Optional. The position in the menu order this item should appear.
  * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
  *
- * @phpstan-param non-falsy-string $menu_slug
+ * @phpstan-param non-falsy-string            $menu_slug
+ * @phpstan-param ''|(callable(): mixed)|null $callback
  */
 function add_links_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
 	return add_submenu_page( 'link-manager.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
@@ -1847,15 +1858,16 @@ function add_links_page( $page_title, $menu_title, $capability, $menu_slug, $cal
  * @since 2.7.0
  * @since 5.3.0 Added the `$position` parameter.
  *
- * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
- * @param string   $menu_title The text to be used for the menu.
- * @param string   $capability The capability required for this menu to be displayed to the user.
- * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
- * @param callable $callback   Optional. The function to be called to output the content for this page.
- * @param int      $position   Optional. The position in the menu order this item should appear.
+ * @param string               $page_title The text to be displayed in the title tags of the page when the menu is selected.
+ * @param string               $menu_title The text to be used for the menu.
+ * @param string               $capability The capability required for this menu to be displayed to the user.
+ * @param string               $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
+ * @param callable|string|null $callback   Optional. The function to be called to output the content for this page.
+ * @param int                  $position   Optional. The position in the menu order this item should appear.
  * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
  *
- * @phpstan-param non-falsy-string $menu_slug
+ * @phpstan-param non-falsy-string            $menu_slug
+ * @phpstan-param ''|(callable(): mixed)|null $callback
  */
 function add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
 	return add_submenu_page( 'edit.php?post_type=page', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
@@ -1873,15 +1885,16 @@ function add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $cal
  * @since 2.7.0
  * @since 5.3.0 Added the `$position` parameter.
  *
- * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
- * @param string   $menu_title The text to be used for the menu.
- * @param string   $capability The capability required for this menu to be displayed to the user.
- * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
- * @param callable $callback   Optional. The function to be called to output the content for this page.
- * @param int      $position   Optional. The position in the menu order this item should appear.
+ * @param string               $page_title The text to be displayed in the title tags of the page when the menu is selected.
+ * @param string               $menu_title The text to be used for the menu.
+ * @param string               $capability The capability required for this menu to be displayed to the user.
+ * @param string               $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
+ * @param callable|string|null $callback   Optional. The function to be called to output the content for this page.
+ * @param int                  $position   Optional. The position in the menu order this item should appear.
  * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
  *
- * @phpstan-param non-falsy-string $menu_slug
+ * @phpstan-param non-falsy-string            $menu_slug
+ * @phpstan-param ''|(callable(): mixed)|null $callback
  */
 function add_comments_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
 	return add_submenu_page( 'edit-comments.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
diff --git a/wp-includes/option.php b/wp-includes/option.php
index 1d6962a546..efe5709c63 100644
--- a/wp-includes/option.php
+++ b/wp-includes/option.php
@@ -3182,9 +3182,11 @@ function register_setting( $option_group, $option_name, $args = array() ) {
  * @global array $new_allowed_options
  * @global array $wp_registered_settings
  *
- * @param string   $option_group The settings group name used during registration.
- * @param string   $option_name  The name of the option to unregister.
- * @param callable $deprecated   Optional. Deprecated.
+ * @param string $option_group The settings group name used during registration.
+ * @param string $option_name  The name of the option to unregister.
+ * @param string $deprecated   Optional. Deprecated.
+ *
+ * @phpstan-param '' $deprecated
  */
 function unregister_setting( $option_group, $option_name, $deprecated = '' ) {
 	global $new_allowed_options, $wp_registered_settings;
diff --git a/wp-includes/plugin.php b/wp-includes/plugin.php
index f09f6c264d..38c5884c8b 100644
--- a/wp-includes/plugin.php
+++ b/wp-includes/plugin.php
@@ -896,6 +896,8 @@ function plugin_dir_url( $file ) {
  *
  * @param string   $file     The filename of the plugin including the path.
  * @param callable $callback The function hooked to the 'activate_PLUGIN' action.
+ *
+ * @phpstan-param callable(bool): mixed $callback
  */
 function register_activation_hook( $file, $callback ) {
 	$file = plugin_basename( $file );
@@ -919,6 +921,8 @@ function register_activation_hook( $file, $callback ) {
  *
  * @param string   $file     The filename of the plugin including the path.
  * @param callable $callback The function hooked to the 'deactivate_PLUGIN' action.
+ *
+ * @phpstan-param callable(bool): mixed $callback
  */
 function register_deactivation_hook( $file, $callback ) {
 	$file = plugin_basename( $file );
@@ -950,6 +954,8 @@ function register_deactivation_hook( $file, $callback ) {
  * @param string   $file     Plugin file.
  * @param callable $callback The callback to run when the hook is called. Must be
  *                           a static method or function.
+ *
+ * @phpstan-param (callable-string|array{class-string, non-empty-string})&(callable(): mixed) $callback
  */
 function register_uninstall_hook( $file, $callback ) {
 	if ( is_array( $callback ) && is_object( $callback[0] ) ) {
diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php
index 93e2b23b50..485e77921c 100644
--- a/wp-includes/rewrite.php
+++ b/wp-includes/rewrite.php
@@ -248,6 +248,8 @@ function remove_permastruct( $name ) {
  * @param callable $callback Callback to run on feed display.
  * @return string Feed action name.
  *
+ * @phpstan-param non-empty-string                        $feedname
+ * @phpstan-param callable(bool, non-empty-string): mixed $callback
  * @phpstan-return non-falsy-string
  */
 function add_feed( $feedname, $callback ) {
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 780b165f4c..d7007ae602 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-beta1-64792';
+$wp_version = '7.2-beta1-64793';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.