Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update integer ranges #255

Merged
merged 2 commits into from
Oct 11, 2024
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
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
10 changes: 5 additions & 5 deletions tests/Faker.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
* @method static true true()
* @method static false false()
* @method static int int()
* @method static positive-int positiveInt()
* @method static negative-int negativeInt()
* @method static non-positive-int nonPositiveInt()
* @method static non-negative-int nonNegativeInt()
* @method static non-zero-int nonZeroInt()
* @method static int<1, max> positiveInt()
* @method static int<min, -1> negativeInt()
* @method static int<min, 0> nonPositiveInt()
* @method static int<0, max> nonNegativeInt()
* @method static int<min, -1>|int<1, max> nonZeroInt()
* @method static float float()
* @method static string string()
* @method static non-empty-string nonEmptyString()
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