Skip to content

Commit 95be71f

Browse files
authored
Empty string is the default value of callable (#289)
1 parent 92e4448 commit 95be71f

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

functionMap.php

+12
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,19 @@
3939
'_get_list_table' => ["(\$class_name is 'WP_Posts_List_Table'|'WP_Media_List_Table'|'WP_Terms_List_Table'|'WP_Users_List_Table'|'WP_Comments_List_Table'|'WP_Post_Comments_List_Table'|'WP_Links_List_Table'|'WP_Plugin_Install_List_Table'|'WP_Themes_List_Table'|'WP_Theme_Install_List_Table'|'WP_Plugins_List_Table'|'WP_Application_Passwords_List_Table'|'WP_MS_Sites_List_Table'|'WP_MS_Users_List_Table'|'WP_MS_Themes_List_Table'|'WP_Privacy_Data_Export_Requests_List_Table'|'WP_Privacy_Data_Removal_Requests_List_Table' ? new<T> : false)", '@phpstan-template T' => 'of string', 'class_name' => 'T', 'args' => 'array{screen?: string}'],
4040
'absint' => ['($maybeint is T&int<0, max> ? T : ($maybeint is int<min, -1> ? int<1, max> : ($maybeint is empty ? 0 : ($maybeint is numeric-string ? int<0, max> : ($maybeint is string ? 0 : ($maybeint is true|non-empty-array ? 1 : ($maybeint is bool ? 0|1 : int<0, max>)))))))', '@phpstan-template T' => 'of int', 'maybeint' => 'T|scalar|array|resource|null'],
4141
'addslashes_gpc' => ['T', '@phpstan-template' => 'T', 'gpc' => 'T'],
42+
'add_menu_page' => [null, 'callback' => "''|callable"],
43+
'add_links_page' => [null, 'callback' => "''|callable"],
44+
'add_media_page' => [null, 'callback' => "''|callable"],
45+
'add_pages_page' => [null, 'callback' => "''|callable"],
46+
'add_posts_page' => [null, 'callback' => "''|callable"],
47+
'add_theme_page' => [null, 'callback' => "''|callable"],
48+
'add_users_page' => [null, 'callback' => "''|callable"],
49+
'add_options_page' => [null, 'callback' => "''|callable"],
50+
'add_plugins_page' => [null, 'callback' => "''|callable"],
4251
'add_submenu_page' => [null, 'callback' => "''|callable"],
52+
'add_comments_page' => [null, 'callback' => "''|callable"],
53+
'add_dashboard_page' => [null, 'callback' => "''|callable"],
54+
'add_management_page' => [null, 'callback' => "''|callable"],
4355
'bool_from_yn' => ["(\$yn is 'y' ? true : false)"],
4456
'have_posts' => [null, '@phpstan-impure' => ''],
4557
'is_new_day' => ['0|1'],

wordpress-stubs.php

+12
Original file line numberDiff line numberDiff line change
@@ -87838,6 +87838,7 @@ function uninstall_plugin($plugin)
8783887838
* * Pass 'none' to leave div.wp-menu-image empty so an icon can be added via CSS.
8783987839
* @param int|float $position Optional. The position in the menu order this item should appear.
8784087840
* @return string The resulting page's hook_suffix.
87841+
* @phpstan-param ''|callable $callback
8784187842
*/
8784287843
function add_menu_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '', $position = \null)
8784387844
{
@@ -87897,6 +87898,7 @@ function add_submenu_page($parent_slug, $page_title, $menu_title, $capability, $
8789787898
* @param callable $callback Optional. The function to be called to output the content for this page.
8789887899
* @param int $position Optional. The position in the menu order this item should appear.
8789987900
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
87901+
* @phpstan-param ''|callable $callback
8790087902
*/
8790187903
function add_management_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null)
8790287904
{
@@ -87920,6 +87922,7 @@ function add_management_page($page_title, $menu_title, $capability, $menu_slug,
8792087922
* @param callable $callback Optional. The function to be called to output the content for this page.
8792187923
* @param int $position Optional. The position in the menu order this item should appear.
8792287924
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
87925+
* @phpstan-param ''|callable $callback
8792387926
*/
8792487927
function add_options_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null)
8792587928
{
@@ -87943,6 +87946,7 @@ function add_options_page($page_title, $menu_title, $capability, $menu_slug, $ca
8794387946
* @param callable $callback Optional. The function to be called to output the content for this page.
8794487947
* @param int $position Optional. The position in the menu order this item should appear.
8794587948
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
87949+
* @phpstan-param ''|callable $callback
8794687950
*/
8794787951
function add_theme_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null)
8794887952
{
@@ -87966,6 +87970,7 @@ function add_theme_page($page_title, $menu_title, $capability, $menu_slug, $call
8796687970
* @param callable $callback Optional. The function to be called to output the content for this page.
8796787971
* @param int $position Optional. The position in the menu order this item should appear.
8796887972
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
87973+
* @phpstan-param ''|callable $callback
8796987974
*/
8797087975
function add_plugins_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null)
8797187976
{
@@ -87989,6 +87994,7 @@ function add_plugins_page($page_title, $menu_title, $capability, $menu_slug, $ca
8798987994
* @param callable $callback Optional. The function to be called to output the content for this page.
8799087995
* @param int $position Optional. The position in the menu order this item should appear.
8799187996
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
87997+
* @phpstan-param ''|callable $callback
8799287998
*/
8799387999
function add_users_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null)
8799488000
{
@@ -88012,6 +88018,7 @@ function add_users_page($page_title, $menu_title, $capability, $menu_slug, $call
8801288018
* @param callable $callback Optional. The function to be called to output the content for this page.
8801388019
* @param int $position Optional. The position in the menu order this item should appear.
8801488020
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
88021+
* @phpstan-param ''|callable $callback
8801588022
*/
8801688023
function add_dashboard_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null)
8801788024
{
@@ -88035,6 +88042,7 @@ function add_dashboard_page($page_title, $menu_title, $capability, $menu_slug, $
8803588042
* @param callable $callback Optional. The function to be called to output the content for this page.
8803688043
* @param int $position Optional. The position in the menu order this item should appear.
8803788044
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
88045+
* @phpstan-param ''|callable $callback
8803888046
*/
8803988047
function add_posts_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null)
8804088048
{
@@ -88058,6 +88066,7 @@ function add_posts_page($page_title, $menu_title, $capability, $menu_slug, $call
8805888066
* @param callable $callback Optional. The function to be called to output the content for this page.
8805988067
* @param int $position Optional. The position in the menu order this item should appear.
8806088068
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
88069+
* @phpstan-param ''|callable $callback
8806188070
*/
8806288071
function add_media_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null)
8806388072
{
@@ -88081,6 +88090,7 @@ function add_media_page($page_title, $menu_title, $capability, $menu_slug, $call
8808188090
* @param callable $callback Optional. The function to be called to output the content for this page.
8808288091
* @param int $position Optional. The position in the menu order this item should appear.
8808388092
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
88093+
* @phpstan-param ''|callable $callback
8808488094
*/
8808588095
function add_links_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null)
8808688096
{
@@ -88104,6 +88114,7 @@ function add_links_page($page_title, $menu_title, $capability, $menu_slug, $call
8810488114
* @param callable $callback Optional. The function to be called to output the content for this page.
8810588115
* @param int $position Optional. The position in the menu order this item should appear.
8810688116
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
88117+
* @phpstan-param ''|callable $callback
8810788118
*/
8810888119
function add_pages_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null)
8810988120
{
@@ -88127,6 +88138,7 @@ function add_pages_page($page_title, $menu_title, $capability, $menu_slug, $call
8812788138
* @param callable $callback Optional. The function to be called to output the content for this page.
8812888139
* @param int $position Optional. The position in the menu order this item should appear.
8812988140
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
88141+
* @phpstan-param ''|callable $callback
8813088142
*/
8813188143
function add_comments_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null)
8813288144
{

0 commit comments

Comments
 (0)