Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ includes:
- tests/phpstan/baselines/offsetAccess.nonOffsetAccessible.neon
- tests/phpstan/baselines/offsetAccess.notFound.neon
- tests/phpstan/baselines/offsetAssign.valueType.neon
- tests/phpstan/baselines/parameter.defaultValue.neon
- tests/phpstan/baselines/parameter.notFound.neon
- tests/phpstan/baselines/parameterByRef.type.neon
- tests/phpstan/baselines/parameterByRef.unusedType.neon
Expand Down
19 changes: 13 additions & 6 deletions src/wp-admin/includes/class-custom-background.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@ 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;

/**
* Callback for header div.
*
* @since 3.0.0
* @var callable
* @var callable|string|null
*
* @phpstan-var ''|(callable(): mixed)|null
*/
public $admin_image_div_callback;

Expand All @@ -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.

@westonruter westonruter Oct 7, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ I understand that string is needed here to account for the empty string case. Otherwise, callable|null would be sufficient since that includes callable-string.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Comment by Claude Opus 5.5

Nit: Custom_Image_Header's constructor descriptions now say "Empty string or null for none.", but these still only say "Default empty string." even though the type permits null. Aligning the wording would make the shared Optional_Callback contract read the same in both sibling classes.

* 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;
Expand Down
18 changes: 13 additions & 5 deletions src/wp-admin/includes/class-custom-image-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@ 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;

/**
* Callback for header div.
*
* @since 3.0.0
* @var callable
* @var callable|string|null
*
* @phpstan-var ''|(callable(): mixed)|null
*/
public $admin_image_div_callback;

Expand All @@ -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;
Expand Down
28 changes: 16 additions & 12 deletions src/wp-admin/includes/deprecated.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()' );
Expand All @@ -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()' );
Expand Down
Loading
Loading