Skip to content

Commit

Permalink
Fix $callback type for add_submenu_page (#161)
Browse files Browse the repository at this point in the history
The default type for $callback is ''. Since there are parameters after $callback, we must support the default as well.
  • Loading branch information
lipemat authored Feb 13, 2024
1 parent 618eed0 commit 7945595
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions functionMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/
return [
'addslashes_gpc' => ['T', '@phpstan-template' => 'T', 'gpc' => 'T'],
'add_submenu_page' => [null, 'callback' => "''|callable"],
'have_posts' => [null, '@phpstan-impure' => ''],
'rawurlencode_deep' => ['T', '@phpstan-template' => 'T', 'value' => 'T'],
'sanitize_category' => ['T', '@phpstan-template' => 'T of array|object', 'category' => 'T'],
Expand Down
1 change: 1 addition & 0 deletions wordpress-stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -84252,6 +84252,7 @@ function add_menu_page($page_title, $menu_title, $capability, $menu_slug, $callb
* @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.
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
* @phpstan-param ''|callable $callback
*/
function add_submenu_page($parent_slug, $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null)
{
Expand Down

0 comments on commit 7945595

Please sign in to comment.