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
3 changes: 2 additions & 1 deletion functionMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
'add_pages_page' => [null, 'callback' => "''|callable"],
'add_plugins_page' => [null, 'callback' => "''|callable"],
'add_posts_page' => [null, 'callback' => "''|callable"],
'add_settings_field' => ['void', 'id' => 'string', 'title' => 'string', 'callback' => 'callable', 'page' => 'string', 'section' => 'string', 'args' => 'array{label_for?:string,class?:string,...}'],
'add_shortcode' => ['void', 'tag' => 'non-empty-string', 'callback' => 'callable(array<string>, string|null, string): string'],
'add_submenu_page' => [null, 'callback' => "''|callable"],
'add_theme_page' => [null, 'callback' => "''|callable"],
Expand Down Expand Up @@ -110,7 +111,7 @@
'get_bookmark_field' => ['array<int, int<1, max>>|int|string|\WP_Error', 'field' => "'link_id'|'link_url'|'link_name'|'link_image'|'link_target'|'link_description'|'link_visible'|'link_owner'|'link_rating'|'link_updated'|'link_rel'|'link_notes'|'link_rss'|'link_category'"],
'get_calendar' => ['($args is array{display: false, ...} ? string : void)'],
'get_category_parents' => [null, 'deprecated' => 'array{}'],
'get_categories' => ["(\$args is array{fields: 'count', ...} ? list<numeric-string> : (\$args is array{fields: 'names'|'slugs', ...} ? list<string> : (\$args is array{fields: 'id=>name'|'id=>slug', ...} ? array<int, string> : (\$args is array{fields: 'id=>parent', ...} ? array<int, int> : (\$args is array{fields: 'ids'|'tt_ids', ...} ? list<int> : array<int, \WP_Term>)))))"],
'get_categories' => ["(\$args is array{fields: 'count', ...} ? list<numeric-string> : (\$args is array{fields: 'names'|'slugs', ...} ? list<string> : (\$args is array{fields: 'id=>name'|'id=>slug', ...} ? array<int, string> : (\$args is array{fields: 'id=>parent', ...} ? array<int, int> : (\$args is array{fields: 'ids'|'tt_ids', ...} ? list<int> : array<int, \WP_Term>)))))", 'args' => 'string|array{taxonomy?:string,...}'],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

php-stubs/wordpress-stubs typically does not allow query strings.

// It's common for an args parameter to accept a query var string or array with `string|array`.
// Remove the accepted string type for these so we get the strongest typing we can manage.
$tagVariableType = str_replace(['|string', 'string|'], '', $tagVariableType);

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.

Thank you.
Do you thing about 8407351 ?

'get_category' => ["(\$category is object ? array<array-key, mixed>|\WP_Term : array<array-key, mixed>|\WP_Term|\WP_Error|null) & (\$output is 'ARRAY_A' ? array<string, mixed>|\WP_Error|null : (\$output is 'ARRAY_N' ? array<int, mixed>|\WP_Error|null : \WP_Term|\WP_Error|null))", 'output' => "'OBJECT'|'ARRAY_A'|'ARRAY_N'"],
'get_category_by_path' => ["(\$output is 'ARRAY_A' ? array<string, mixed>|\WP_Error|null : (\$output is 'ARRAY_N' ? array<int, mixed>|\WP_Error|null : \WP_Term|\WP_Error|null))", 'output' => "'OBJECT'|'ARRAY_A'|'ARRAY_N'"],
'get_comments_pagination_arrow' => ['non-falsy-string|null'],
Expand Down
8 changes: 8 additions & 0 deletions wordpress-stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -107595,6 +107595,13 @@ function add_settings_section($id, $title, $callback, $page, $args = array())
* label_for?: string,
* class?: string,
* } $args
* @phpstan-param string $id
* @phpstan-param string $title
* @phpstan-param callable $callback
* @phpstan-param string $page
* @phpstan-param string $section
* @phpstan-param array{label_for?:string,class?:string,...} $args
* @phpstan-return void
*/
function add_settings_field($id, $title, $callback, $page, $section = 'default', $args = array())
{
Expand Down Expand Up @@ -120852,6 +120859,7 @@ function has_term($term = '', $taxonomy = '', $post = \null)
* @phpstan-param array{
* taxonomy?: string,
* } $args
* @phpstan-param string|array{taxonomy?:string,...} $args
* @phpstan-return ($args is array{fields: 'count', ...} ? list<numeric-string> : ($args is array{fields: 'names'|'slugs', ...} ? list<string> : ($args is array{fields: 'id=>name'|'id=>slug', ...} ? array<int, string> : ($args is array{fields: 'id=>parent', ...} ? array<int, int> : ($args is array{fields: 'ids'|'tt_ids', ...} ? list<int> : array<int, \WP_Term>)))))
*/
function get_categories($args = '')
Expand Down
Loading