Skip to content
Merged
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
9 changes: 9 additions & 0 deletions functionMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

$httpReturnType = 'array{headers: \Requests_Utility_CaseInsensitiveDictionary, body: string, response: array{code: int,message: string}, cookies: array<int, \WP_HTTP_Cookie>, filename: string|null, http_response: \WP_HTTP_Requests_Response}|\WP_Error';
$cronArgsType = 'list<mixed>';
$registerPostTypeArgsType = 'array{label?: string, labels?: string[], description?: string, public?: bool, hierarchical?: bool, exclude_from_search?: bool, publicly_queryable?: bool, show_ui?: bool, show_in_menu?: bool|string, show_in_nav_menus?: bool, show_in_admin_bar?: bool, show_in_rest?: bool, rest_base?: string, rest_namespace?: string, rest_controller_class?: string, menu_position?: int, menu_icon?: string, capability_type?: string|array, capabilities?: string[], map_meta_cap?: bool, supports?: array, register_meta_box_cb?: callable, taxonomies?: string[], has_archive?: bool|string, rewrite?: bool|array{slug?: string, with_front?: bool, feeds?: bool, pages?: bool, ep_mask?: int}, query_var?: string|bool, can_export?: bool, delete_with_user?: bool, template?: array, template_lock?: string|false, _builtin?: bool, _edit_link?: string}';
$registerTaxonomyArgsType = 'array{labels?: string[], description?: string, public?: bool, publicly_queryable?: bool, hierarchical?: bool, show_ui?: bool, show_in_menu?: bool, show_in_nav_menus?: bool, show_in_rest?: bool, rest_base?: string, rest_namespace?: string, rest_controller_class?: string, show_tagcloud?: bool, show_in_quick_edit?: bool, show_admin_column?: bool, meta_box_cb?: bool|callable, meta_box_sanitize_cb?: callable, capabilities?: array{manage_terms?: string, edit_terms?: string, delete_terms?: string, assign_terms?: string}, rewrite?: bool|array{slug?: string, with_front?: bool, hierarchical?: bool, ep_mask?: int}, query_var?: string|bool, update_count_callback?: callable, default_term?: string|array{name?: string, slug?: string, description?: string}, sort?: bool, args?: array, _builtin?: bool}';
$wpWidgetRssFormArgsType = 'array{number: int, error: bool, title?: string, url?: string, items?: int, show_summary?: int, show_author?: int, show_date?: int}';
$wpWidgetRssFormInputType = 'array{title?: bool, url?: bool, items?: bool, show_summary?: bool, show_author?: bool, show_date?: bool}';

/**
* This array is in the same format as the function map array in PHPStan:
Expand All @@ -17,6 +21,7 @@
return [
'add_meta_box' => ['void', 'context'=>'"normal"|"side"|"advanced"', 'priority'=>'"high"|"core"|"default"|"low"'],
'addslashes_gpc' => ['T', '@phpstan-template'=>'T', 'gpc'=>'T'],
'get_objects_in_term' => ['string[]|WP_Error', 'args'=>'array{order?: string}'],
'have_posts' => ['bool', '@phpstan-impure'=>''],
'rawurlencode_deep' => ['T', '@phpstan-template'=>'T', 'value'=>'T'],
'remove_meta_box' => ['void', 'context'=>'"normal"|"side"|"advanced"'],
Expand All @@ -36,7 +41,9 @@
'WP_List_Table::bulk_actions' => ['void', 'which'=>'"top"|"bottom"'],
'WP_List_Table::display_tablenav' => ['void', 'which'=>'"top"|"bottom"'],
'WP_List_Table::pagination' => ['void', 'which'=>'"top"|"bottom"'],
'WP_List_Table::set_pagination_args' => ['void', 'args'=>'array{total_items?: int, total_pages?: int, per_page?: int}'],
'wp_next_scheduled' => ['int|false', 'args'=>$cronArgsType],
'WP_Post_Type::__construct' => ['void', 'args'=>$registerPostTypeArgsType],
'WP_Query::have_posts' => ['bool', '@phpstan-impure'=>''],
'wp_remote_get' => [$httpReturnType],
'wp_remote_head' => [$httpReturnType],
Expand All @@ -50,8 +57,10 @@
'wp_schedule_event' => ['bool|WP_Error', 'args'=>$cronArgsType],
'wp_schedule_single_event' => ['bool|WP_Error', 'args'=>$cronArgsType],
'wp_slash' => ['T', '@phpstan-template'=>'T', 'value'=>'T'],
'WP_Taxonomy::__construct' => ['void', 'args'=>$registerTaxonomyArgsType],
'wp_unschedule_event' => ['bool|WP_Error', 'args'=>$cronArgsType],
'wp_unslash' => ['T', '@phpstan-template'=>'T', 'value'=>'T'],
'wp_widget_rss_form' => ['void', 'args'=>$wpWidgetRssFormArgsType, 'input'=>$wpWidgetRssFormInputType],
'WP_REST_Request' => [null, '@phpstan-template'=>'T of array', '@phpstan-implements'=>'ArrayAccess<key-of<T>, value-of<T>>'],
'WP_REST_Request::offsetExists' => ['bool', 'offset'=>'@param key-of<T>'],
'WP_REST_Request::offsetGet' => ['T[TOffset]', '@phpstan-template'=>'TOffset of key-of<T>', 'offset'=>'TOffset'],
Expand Down
9 changes: 9 additions & 0 deletions functionMap62.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

$httpReturnType = 'array{headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary, body: string, response: array{code: int,message: string}, cookies: array<int, \WP_HTTP_Cookie>, filename: string|null, http_response: \WP_HTTP_Requests_Response}|\WP_Error';
$cronArgsType = 'list<mixed>';
$registerPostTypeArgsType = 'array{label?: string, labels?: string[], description?: string, public?: bool, hierarchical?: bool, exclude_from_search?: bool, publicly_queryable?: bool, show_ui?: bool, show_in_menu?: bool|string, show_in_nav_menus?: bool, show_in_admin_bar?: bool, show_in_rest?: bool, rest_base?: string, rest_namespace?: string, rest_controller_class?: string, menu_position?: int, menu_icon?: string, capability_type?: string|array, capabilities?: string[], map_meta_cap?: bool, supports?: array, register_meta_box_cb?: callable, taxonomies?: string[], has_archive?: bool|string, rewrite?: bool|array{slug?: string, with_front?: bool, feeds?: bool, pages?: bool, ep_mask?: int}, query_var?: string|bool, can_export?: bool, delete_with_user?: bool, template?: array, template_lock?: string|false, _builtin?: bool, _edit_link?: string}';
$registerTaxonomyArgsType = 'array{labels?: string[], description?: string, public?: bool, publicly_queryable?: bool, hierarchical?: bool, show_ui?: bool, show_in_menu?: bool, show_in_nav_menus?: bool, show_in_rest?: bool, rest_base?: string, rest_namespace?: string, rest_controller_class?: string, show_tagcloud?: bool, show_in_quick_edit?: bool, show_admin_column?: bool, meta_box_cb?: bool|callable, meta_box_sanitize_cb?: callable, capabilities?: array{manage_terms?: string, edit_terms?: string, delete_terms?: string, assign_terms?: string}, rewrite?: bool|array{slug?: string, with_front?: bool, hierarchical?: bool, ep_mask?: int}, query_var?: string|bool, update_count_callback?: callable, default_term?: string|array{name?: string, slug?: string, description?: string}, sort?: bool, args?: array, _builtin?: bool}';
$wpWidgetRssFormArgsType = 'array{number: int, error: bool, title?: string, url?: string, items?: int, show_summary?: int, show_author?: int, show_date?: int}';
$wpWidgetRssFormInputType = 'array{title?: bool, url?: bool, items?: bool, show_summary?: bool, show_author?: bool, show_date?: bool}';

/**
* This array is in the same format as the function map array in PHPStan:
Expand All @@ -17,6 +21,7 @@
return [
'add_meta_box' => ['void', 'context'=>'"normal"|"side"|"advanced"', 'priority'=>'"high"|"core"|"default"|"low"'],
'addslashes_gpc' => ['T', '@phpstan-template'=>'T', 'gpc'=>'T'],
'get_objects_in_term' => ['string[]|WP_Error', 'args'=>'array{order?: string}'],
'have_posts' => ['bool', '@phpstan-impure'=>''],
'rawurlencode_deep' => ['T', '@phpstan-template'=>'T', 'value'=>'T'],
'remove_meta_box' => ['void', 'context'=>'"normal"|"side"|"advanced"'],
Expand All @@ -36,7 +41,9 @@
'WP_List_Table::bulk_actions' => ['void', 'which'=>'"top"|"bottom"'],
'WP_List_Table::display_tablenav' => ['void', 'which'=>'"top"|"bottom"'],
'WP_List_Table::pagination' => ['void', 'which'=>'"top"|"bottom"'],
'WP_List_Table::set_pagination_args' => ['void', 'args'=>'array{total_items?: int, total_pages?: int, per_page?: int}'],
'wp_next_scheduled' => ['int|false', 'args'=>$cronArgsType],
'WP_Post_Type::__construct' => ['void', 'args'=>$registerPostTypeArgsType],
'WP_Query::have_posts' => ['bool', '@phpstan-impure'=>''],
'wp_remote_get' => [$httpReturnType],
'wp_remote_head' => [$httpReturnType],
Expand All @@ -50,8 +57,10 @@
'wp_schedule_event' => ['bool|WP_Error', 'args'=>$cronArgsType],
'wp_schedule_single_event' => ['bool|WP_Error', 'args'=>$cronArgsType],
'wp_slash' => ['T', '@phpstan-template'=>'T', 'value'=>'T'],
'WP_Taxonomy::__construct' => ['void', 'args'=>$registerTaxonomyArgsType],
'wp_unschedule_event' => ['bool|WP_Error', 'args'=>$cronArgsType],
'wp_unslash' => ['T', '@phpstan-template'=>'T', 'value'=>'T'],
'wp_widget_rss_form' => ['void', 'args'=>$wpWidgetRssFormArgsType, 'input'=>$wpWidgetRssFormInputType],
'WP_REST_Request' => [null, '@phpstan-template'=>'T of array', '@phpstan-implements'=>'ArrayAccess<key-of<T>, value-of<T>>'],
'WP_REST_Request::offsetExists' => ['bool', 'offset'=>'@param key-of<T>'],
'WP_REST_Request::offsetGet' => ['T[TOffset]', '@phpstan-template'=>'TOffset of key-of<T>', 'offset'=>'TOffset'],
Expand Down
11 changes: 11 additions & 0 deletions wordpress-stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -4228,6 +4228,8 @@ public function prepare_items()
* @since 3.1.0
*
* @param array|string $args Array or string of arguments with information about the pagination.
* @phpstan-param array{total_items?: int, total_pages?: int, per_page?: int} $args
* @phpstan-return void
*/
protected function set_pagination_args($args)
{
Expand Down Expand Up @@ -43734,6 +43736,8 @@ final class WP_Post_Type
* @param string $post_type Post type key.
* @param array|string $args Optional. Array or string of arguments for registering a post type.
* Default empty array.
* @phpstan-param array{label?: string, labels?: string[], description?: string, public?: bool, hierarchical?: bool, exclude_from_search?: bool, publicly_queryable?: bool, show_ui?: bool, show_in_menu?: bool|string, show_in_nav_menus?: bool, show_in_admin_bar?: bool, show_in_rest?: bool, rest_base?: string, rest_namespace?: string, rest_controller_class?: string, menu_position?: int, menu_icon?: string, capability_type?: string|array, capabilities?: string[], map_meta_cap?: bool, supports?: array, register_meta_box_cb?: callable, taxonomies?: string[], has_archive?: bool|string, rewrite?: bool|array{slug?: string, with_front?: bool, feeds?: bool, pages?: bool, ep_mask?: int}, query_var?: string|bool, can_export?: bool, delete_with_user?: bool, template?: array, template_lock?: string|false, _builtin?: bool, _edit_link?: string} $args
* @phpstan-return void
*/
public function __construct($post_type, $args = array())
{
Expand Down Expand Up @@ -49151,6 +49155,8 @@ final class WP_Taxonomy
* @param array|string $object_type Name of the object type for the taxonomy object.
* @param array|string $args Optional. Array or query string of arguments for registering a taxonomy.
* Default empty array.
* @phpstan-param array{labels?: string[], description?: string, public?: bool, publicly_queryable?: bool, hierarchical?: bool, show_ui?: bool, show_in_menu?: bool, show_in_nav_menus?: bool, show_in_rest?: bool, rest_base?: string, rest_namespace?: string, rest_controller_class?: string, show_tagcloud?: bool, show_in_quick_edit?: bool, show_admin_column?: bool, meta_box_cb?: bool|callable, meta_box_sanitize_cb?: callable, capabilities?: array{manage_terms?: string, edit_terms?: string, delete_terms?: string, assign_terms?: string}, rewrite?: bool|array{slug?: string, with_front?: bool, hierarchical?: bool, ep_mask?: int}, query_var?: string|bool, update_count_callback?: callable, default_term?: string|array{name?: string, slug?: string, description?: string}, sort?: bool, args?: array, _builtin?: bool} $args
* @phpstan-return void
*/
public function __construct($taxonomy, $object_type, $args = array())
{
Expand Down Expand Up @@ -127159,6 +127165,8 @@ function unregister_taxonomy_for_object_type($taxonomy, $object_type)
* @param array|string $args Change the order of the object IDs, either ASC or DESC.
* @return string[]|WP_Error An array of object IDs as numeric strings on success,
* WP_Error if the taxonomy does not exist.
* @phpstan-param array{order?: string} $args
* @phpstan-return string[]|WP_Error
*/
function get_objects_in_term($term_ids, $taxonomies, $args = array())
{
Expand Down Expand Up @@ -132509,6 +132517,9 @@ function wp_widget_rss_output($rss, $args = array())
*
* @param array|string $args Values for input fields.
* @param array $inputs Override default display options.
* @phpstan-param array{number: int, error: bool, title?: string, url?: string, items?: int, show_summary?: int, show_author?: int, show_date?: int} $args
* @phpstan-param array{title?: bool, url?: bool, items?: bool, show_summary?: bool, show_author?: bool, show_date?: bool} $input
* @phpstan-return void
*/
function wp_widget_rss_form($args, $inputs = \null)
{
Expand Down