From cf154052649f9b35a48fd9590a6a06333eda95fd Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Thu, 20 Apr 2023 01:18:32 +0200 Subject: [PATCH] Remove the need to maintain these args shapes. --- functionMap.php | 6 ++---- functionMap62.php | 6 ++---- wordpress-stubs.php | 4 ++-- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/functionMap.php b/functionMap.php index 115bdda7..cc66081a 100644 --- a/functionMap.php +++ b/functionMap.php @@ -2,8 +2,6 @@ $httpReturnType = 'array{headers: \Requests_Utility_CaseInsensitiveDictionary, body: string, response: array{code: int,message: string}, cookies: array, filename: string|null, http_response: \WP_HTTP_Requests_Response}|\WP_Error'; $cronArgsType = 'list'; -$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}'; @@ -43,7 +41,7 @@ '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_Post_Type::__construct' => ['void', 'args'=>'array'], 'WP_Query::have_posts' => ['bool', '@phpstan-impure'=>''], 'wp_remote_get' => [$httpReturnType], 'wp_remote_head' => [$httpReturnType], @@ -57,7 +55,7 @@ '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_Taxonomy::__construct' => ['void', 'args'=>'array'], '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], diff --git a/functionMap62.php b/functionMap62.php index 23937afe..39e28548 100644 --- a/functionMap62.php +++ b/functionMap62.php @@ -2,8 +2,6 @@ $httpReturnType = 'array{headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary, body: string, response: array{code: int,message: string}, cookies: array, filename: string|null, http_response: \WP_HTTP_Requests_Response}|\WP_Error'; $cronArgsType = 'list'; -$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}'; @@ -43,7 +41,7 @@ '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_Post_Type::__construct' => ['void', 'args'=>'array'], 'WP_Query::have_posts' => ['bool', '@phpstan-impure'=>''], 'wp_remote_get' => [$httpReturnType], 'wp_remote_head' => [$httpReturnType], @@ -57,7 +55,7 @@ '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_Taxonomy::__construct' => ['void', 'args'=>'array'], '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], diff --git a/wordpress-stubs.php b/wordpress-stubs.php index a7df1547..e974a613 100644 --- a/wordpress-stubs.php +++ b/wordpress-stubs.php @@ -43736,7 +43736,7 @@ 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-param array $args * @phpstan-return void */ public function __construct($post_type, $args = array()) @@ -49155,7 +49155,7 @@ 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-param array $args * @phpstan-return void */ public function __construct($taxonomy, $object_type, $args = array())