Skip to content

Commit

Permalink
Simplify 0|int<1, max> to int<0, max>
Browse files Browse the repository at this point in the history
  • Loading branch information
IanDelMar committed Oct 11, 2024
1 parent 28ea27d commit 0d3c748
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions functionMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
'validate_file' => ["(\$file is '' ? 0 : (\$allowed_files is empty ? 0|1|2 : 0|1|2|3))"],
'wp_die' => ['($args is array{exit: false}&array ? void : never)'],
'wp_dropdown_languages' => ["(\$args is array{id: null|''}&array ? void : (\$args is array{name: null|''}&array ? void : string))"],
'wp_clear_scheduled_hook' => ['(0|int<1, max>|($wp_error is false ? false : \WP_Error))', 'args' => $cronArgsType],
'wp_clear_scheduled_hook' => ['(int<0, max>|($wp_error is false ? false : \WP_Error))', 'args' => $cronArgsType],
'wp_generate_tag_cloud' => ["(\$args is array{format: 'array'}&array ? array<int, string> : string)"],
'wp_get_schedule' => [null, 'args' => $cronArgsType],
'wp_get_scheduled_event' => [null, 'args' => $cronArgsType],
Expand Down Expand Up @@ -147,12 +147,12 @@
'term_exists' => ["(\$term is 0 ? 0 : (\$term is '' ? null : (\$taxonomy is '' ? string|null : array{term_id: string, term_taxonomy_id: string}|null)))"],
'is_term' => ["(\$term is 0 ? 0 : (\$term is '' ? null : (\$taxonomy is '' ? string|null : array{term_id: string, term_taxonomy_id: string}|null)))"],
'tag_exists' => ["(\$tag_name is 0 ? 0 : (\$tag_name is '' ? null : array{term_id: string, term_taxonomy_id: string}|null))"],
'wp_insert_link' => ['($wp_error is false ? 0|int<1, max> : int<1, max>|\WP_Error)'],
'wp_insert_category' => ['($wp_error is false ? 0|int<1, max> : int<1, max>|\WP_Error)'],
'wp_insert_post' => ['($wp_error is false ? 0|int<1, max> : int<1, max>|\WP_Error)'],
'wp_insert_attachment' => ['($wp_error is false ? 0|int<1, max> : int<1, max>|\WP_Error)'],
'wp_update_post' => ['($wp_error is false ? 0|int<1, max> : int<1, max>|\WP_Error)'],
'wp_unschedule_hook' => ['($wp_error is false ? 0|int<1, max>|false : 0|int<1, max>|\WP_Error)'],
'wp_insert_link' => ['($wp_error is false ? int<0, max> : int<1, max>|\WP_Error)'],
'wp_insert_category' => ['($wp_error is false ? int<0, max> : int<1, max>|\WP_Error)'],
'wp_insert_post' => ['($wp_error is false ? int<0, max> : int<1, max>|\WP_Error)'],
'wp_insert_attachment' => ['($wp_error is false ? int<0, max> : int<1, max>|\WP_Error)'],
'wp_update_post' => ['($wp_error is false ? int<0, max> : int<1, max>|\WP_Error)'],
'wp_unschedule_hook' => ['($wp_error is false ? int<0, max>|false : int<0, max>|\WP_Error)'],
'wp_update_comment' => ['($wp_error is false ? 0|1|false : 0|1|\WP_Error)'],
'wp_set_comment_status' => ['($wp_error is false ? bool : true|\WP_Error)'],
'comment_class' => ['($display is true ? void : string)'],
Expand All @@ -179,7 +179,7 @@
'WP_Filesystem_SSH2::dirlist' => [$filesystemDirlistReturnType],
'WP_Filesystem_ftpsockets::dirlist' => [$filesystemDirlistReturnType],
'wpdb::prepare' => [null, 'query' => 'literal-string'],
'wpdb::get_row' => ["null|void|(\$output is 'ARRAY_A' ? array<array-key, mixed> : (\$output is 'ARRAY_N' ? list<mixed> : \stdClass))", 'output' => "'OBJECT'|'ARRAY_A'|'ARRAY_N'", 'y' => '0|int<1, max>'],
'wpdb::get_row' => ["null|void|(\$output is 'ARRAY_A' ? array<array-key, mixed> : (\$output is 'ARRAY_N' ? list<mixed> : \stdClass))", 'output' => "'OBJECT'|'ARRAY_A'|'ARRAY_N'", 'y' => 'int<0, max>'],
'wpdb::get_results' => ["null|(\$output is 'ARRAY_A' ? list<array<array-key, mixed>> : (\$output is 'ARRAY_N' ? list<array<int, mixed>> : (\$output is 'OBJECT_K' ? array<array-key, \stdClass> : list<\stdClass>)))", 'output' => "'OBJECT'|'OBJECT_K'|'ARRAY_A'|'ARRAY_N'"],
'get_bookmark' => ["null|(\$output is 'ARRAY_A' ? array<string, mixed> : (\$output is 'ARRAY_N' ? array<int, mixed> : \stdClass))", 'output' => "'OBJECT'|'ARRAY_A'|'ARRAY_N'"],
'get_categories' => ["(\$args is array{fields: 'count'}&array ? list<numeric-string> : (\$args is array{fields: 'names'|'slugs'}&array ? list<string> : (\$args is array{fields: 'id=>name'|'id=>slug'}&array ? array<int, string> : (\$args is array{fields: 'id=>parent'}&array ? array<int, int> : (\$args is array{fields: 'ids'|'tt_ids'}&array ? list<int> : array<int, \WP_Term>)))))"],
Expand Down
16 changes: 8 additions & 8 deletions wordpress-stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -57879,7 +57879,7 @@ public function get_var($query = \null, $x = 0, $y = 0)
* @param int $y Optional. Row to return. Indexed from 0. Default 0.
* @return array|object|null|void Database query result in format specified by $output or null on failure.
* @phpstan-param 'OBJECT'|'ARRAY_A'|'ARRAY_N' $output
* @phpstan-param 0|int<1, max> $y
* @phpstan-param int<0, max> $y
* @phpstan-return null|void|($output is 'ARRAY_A' ? array<array-key, mixed> : ($output is 'ARRAY_N' ? list<mixed> : \stdClass))
*/
public function get_row($query = \null, $output = \OBJECT, $y = 0)
Expand Down Expand Up @@ -79481,7 +79481,7 @@ function get_link_to_edit($link)
* link_rss?: string,
* link_category?: int,
* } $linkdata
* @phpstan-return ($wp_error is false ? 0|int<1, max> : int<1, max>|\WP_Error)
* @phpstan-return ($wp_error is false ? int<0, max> : int<1, max>|\WP_Error)
*/
function wp_insert_link($linkdata, $wp_error = \false)
{
Expand Down Expand Up @@ -86498,7 +86498,7 @@ function wp_create_categories($categories, $post_id = '')
* category_nicename?: string,
* category_parent?: int|string,
* } $catarr
* @phpstan-return ($wp_error is false ? 0|int<1, max> : int<1, max>|\WP_Error)
* @phpstan-return ($wp_error is false ? int<0, max> : int<1, max>|\WP_Error)
*/
function wp_insert_category($catarr, $wp_error = \false)
{
Expand Down Expand Up @@ -100276,7 +100276,7 @@ function wp_unschedule_event($timestamp, $hook, $args = array(), $wp_error = \fa
* events were registered with the hook and arguments combination), false or WP_Error
* if unscheduling one or more events fail.
* @phpstan-param list<mixed> $args
* @phpstan-return (0|int<1, max>|($wp_error is false ? false : \WP_Error))
* @phpstan-return (int<0, max>|($wp_error is false ? false : \WP_Error))
*/
function wp_clear_scheduled_hook($hook, $args = array(), $wp_error = \false)
{
Expand All @@ -100299,7 +100299,7 @@ function wp_clear_scheduled_hook($hook, $args = array(), $wp_error = \false)
* @param bool $wp_error Optional. Whether to return a WP_Error on failure. Default false.
* @return int|false|WP_Error On success an integer indicating number of events unscheduled (0 indicates no
* events were registered on the hook), false or WP_Error if unscheduling fails.
* @phpstan-return ($wp_error is false ? 0|int<1, max>|false : 0|int<1, max>|\WP_Error)
* @phpstan-return ($wp_error is false ? int<0, max>|false : int<0, max>|\WP_Error)
*/
function wp_unschedule_hook($hook, $wp_error = \false)
{
Expand Down Expand Up @@ -128991,7 +128991,7 @@ function wp_get_recent_posts($args = array(), $output = \ARRAY_A)
* meta_input?: array,
* page_template?: string,
* } $postarr
* @phpstan-return ($wp_error is false ? 0|int<1, max> : int<1, max>|\WP_Error)
* @phpstan-return ($wp_error is false ? int<0, max> : int<1, max>|\WP_Error)
*/
function wp_insert_post($postarr, $wp_error = \false, $fire_after_hooks = \true)
{
Expand Down Expand Up @@ -129040,7 +129040,7 @@ function wp_insert_post($postarr, $wp_error = \false, $fire_after_hooks = \true)
* meta_input?: array,
* page_template?: string,
* } $postarr See wp_insert_post()
* @phpstan-return ($wp_error is false ? 0|int<1, max> : int<1, max>|\WP_Error)
* @phpstan-return ($wp_error is false ? int<0, max> : int<1, max>|\WP_Error)
*/
function wp_update_post($postarr = array(), $wp_error = \false, $fire_after_hooks = \true)
{
Expand Down Expand Up @@ -129506,7 +129506,7 @@ function is_local_attachment($url)
* @param bool $wp_error Optional. Whether to return a WP_Error on failure. Default false.
* @param bool $fire_after_hooks Optional. Whether to fire the after insert hooks. Default true.
* @return int|WP_Error The attachment ID on success. The value 0 or WP_Error on failure.
* @phpstan-return ($wp_error is false ? 0|int<1, max> : int<1, max>|\WP_Error)
* @phpstan-return ($wp_error is false ? int<0, max> : int<1, max>|\WP_Error)
*/
function wp_insert_attachment($args, $file = \false, $parent_post_id = 0, $wp_error = \false, $fire_after_hooks = \true)
{
Expand Down

0 comments on commit 0d3c748

Please sign in to comment.