diff --git a/functionMap.php b/functionMap.php index 870eb7b..ec1c906 100644 --- a/functionMap.php +++ b/functionMap.php @@ -215,6 +215,7 @@ 'wp_unschedule_event' => ['($wp_error is false ? bool : true|\WP_Error)', 'args' => $cronArgsType], 'wp_unschedule_hook' => ['($wp_error is false ? int<0, max>|false : int<0, max>|\WP_Error)'], 'wp_unslash' => ['T', '@phpstan-template' => 'T', 'value' => 'T'], + 'wp_update_category' => ['int<0, max>|false'], 'wp_update_comment' => ['($wp_error is false ? 0|1|false : 0|1|\WP_Error)'], 'wp_update_link' => ['int<0, max>|\WP_Error'], 'wp_update_post' => ['($wp_error is false ? int<0, max> : int<1, max>|\WP_Error)'], diff --git a/tests/TypeInferenceTest.php b/tests/TypeInferenceTest.php index d7b8339..1240bf0 100644 --- a/tests/TypeInferenceTest.php +++ b/tests/TypeInferenceTest.php @@ -112,6 +112,7 @@ public function dataFileAsserts(): iterable yield from $this->gatherAssertTypes(__DIR__ . '/data/wp_theme.php'); yield from $this->gatherAssertTypes(__DIR__ . '/data/wp_translations.php'); yield from $this->gatherAssertTypes(__DIR__ . '/data/wp_unique_id.php'); + yield from $this->gatherAssertTypes(__DIR__ . '/data/wp_update_category.php'); yield from $this->gatherAssertTypes(__DIR__ . '/data/wp_update_link.php'); yield from $this->gatherAssertTypes(__DIR__ . '/data/wp_widget_factory.php'); yield from $this->gatherAssertTypes(__DIR__ . '/data/wp_widget_rss.php'); diff --git a/tests/data/wp_update_category.php b/tests/data/wp_update_category.php new file mode 100644 index 0000000..a2fc542 --- /dev/null +++ b/tests/data/wp_update_category.php @@ -0,0 +1,12 @@ +|false', wp_update_category([])); +assertType('int<0, max>|false', wp_update_category(['cat_ID' => 123])); +assertType('int<0, max>|false', wp_update_category(Faker::array())); diff --git a/wordpress-stubs.php b/wordpress-stubs.php index b5b4a47..2aa963f 100644 --- a/wordpress-stubs.php +++ b/wordpress-stubs.php @@ -89582,6 +89582,7 @@ function wp_insert_category($catarr, $wp_error = \false) * * @param array $catarr The 'cat_ID' value is required. All other keys are optional. * @return int|false The ID number of the new or updated Category on success. Zero or FALSE on failure. + * @phpstan-return int<0, max>|false */ function wp_update_category($catarr) {