Commit 78d56c2124 for wordpress.org
commit 78d56c21242cf2fe3ac94b1e2d78bc460afc5321
Author: swissspidy <swissspidy@git.wordpress.org>
Date: Wed Nov 25 11:00:58 2026 +0000
Code Quality: Add PHPStan integer ranges and literal types.
Narrow integer return and parameter types to ranges such as `non-negative-int` and `positive-int`, and string and integer types to the literal values a function can actually take or return, so that static analysis can catch more mistakes.
Developed in: https://github.com/WordPress/wordpress-develop/pull/13893
Props swissspidy, westonruter, marian1.
See #66739.
Built from https://develop.svn.wordpress.org/trunk@65776
git-svn-id: http://core.svn.wordpress.org/trunk@64805 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-admin/includes/bookmark.php b/wp-admin/includes/bookmark.php
index aae87b9abc..b7295237dd 100644
--- a/wp-admin/includes/bookmark.php
+++ b/wp-admin/includes/bookmark.php
@@ -12,6 +12,8 @@
* @since 2.0.0
*
* @return int The link ID on success. The value 0 on failure.
+ *
+ * @phpstan-return non-negative-int
*/
function add_link() {
return edit_link();
@@ -24,6 +26,8 @@ function add_link() {
*
* @param int $link_id Optional. ID of the link to edit. Default 0.
* @return int The link ID on success. The value 0 on failure.
+ *
+ * @phpstan-return non-negative-int
*/
function edit_link( $link_id = 0 ) {
if ( ! current_user_can( 'manage_links' ) ) {
@@ -174,7 +178,7 @@ function get_link_to_edit( $link ) {
* @param bool $wp_error Optional. Whether to return a WP_Error object on failure. Default false.
* @return int|WP_Error The link ID on success. The value 0 or WP_Error on failure.
*
- * @phpstan-return ( $wp_error is false ? int : int|WP_Error )
+ * @phpstan-return ( $wp_error is false ? non-negative-int : non-negative-int|WP_Error )
*/
function wp_insert_link( $linkdata, $wp_error = false ) {
global $wpdb;
@@ -189,10 +193,14 @@ function wp_insert_link( $linkdata, $wp_error = false ) {
$parsed_args = wp_parse_args( $linkdata, $defaults );
$parsed_args = wp_unslash( sanitize_bookmark( $parsed_args, 'db' ) );
- $link_id = $parsed_args['link_id'];
+ $link_id = (int) $parsed_args['link_id'];
$link_name = $parsed_args['link_name'];
$link_url = $parsed_args['link_url'];
+ if ( $link_id < 0 ) {
+ return 0;
+ }
+
$update = false;
if ( ! empty( $link_id ) ) {
$update = true;
@@ -301,6 +309,8 @@ function wp_set_link_cats( $link_id = 0, $link_categories = array() ) {
*
* @param array $linkdata Link data to update. See wp_insert_link() for accepted arguments.
* @return int The updated link ID on success. The value 0 on failure.
+ *
+ * @phpstan-return non-negative-int
*/
function wp_update_link( $linkdata ) {
$link_id = (int) $linkdata['link_id'];
diff --git a/wp-admin/includes/class-custom-image-header.php b/wp-admin/includes/class-custom-image-header.php
index 147f44cc10..9166bca3cd 100644
--- a/wp-admin/includes/class-custom-image-header.php
+++ b/wp-admin/includes/class-custom-image-header.php
@@ -318,6 +318,8 @@ class Custom_Image_Header {
*
* @param string $type The header type. One of 'default' (for the Uploaded Images control)
* or 'uploaded' (for the Uploaded Images control).
+ *
+ * @phpstan-param 'default'|'uploaded' $type
*/
public function show_header_selector( $type = 'default' ) {
if ( 'default' === $type ) {
diff --git a/wp-admin/includes/class-wp-importer.php b/wp-admin/includes/class-wp-importer.php
index a1b76e388f..5205393458 100644
--- a/wp-admin/includes/class-wp-importer.php
+++ b/wp-admin/includes/class-wp-importer.php
@@ -280,8 +280,8 @@ class WP_Importer {
*
* @since 3.0.0
*
- * @global wpdb $wpdb WordPress database abstraction object.
- * @global int[] $wp_actions Stores the number of times each action was triggered.
+ * @global wpdb $wpdb WordPress database abstraction object.
+ * @global array<string, positive-int> $wp_actions Stores the number of times each action was triggered.
*/
public function stop_the_insanity() {
global $wpdb, $wp_actions;
diff --git a/wp-admin/includes/taxonomy.php b/wp-admin/includes/taxonomy.php
index dbdab1af4f..73677c9d76 100644
--- a/wp-admin/includes/taxonomy.php
+++ b/wp-admin/includes/taxonomy.php
@@ -119,7 +119,7 @@ function wp_create_categories( $categories, $post_id = 0 ) {
* depending on param `$wp_error`.
*
* @phpstan-return (
- * $wp_error is false ? int : int|WP_Error
+ * $wp_error is false ? non-negative-int : non-negative-int|WP_Error
* )
*/
function wp_insert_category( $catarr, $wp_error = false ) {
@@ -188,6 +188,8 @@ 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 non-negative-int|false
*/
function wp_update_category( $catarr ) {
$cat_id = (int) $catarr['cat_ID'];
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index c4496dea3d..b9c2779c08 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -1290,6 +1290,8 @@ function _get_plugin_from_callback( $callback ) {
* Often this is the object that's the focus of the current screen,
* for example a `WP_Post` or `WP_Comment` object.
* @return int Number of meta_boxes.
+ *
+ * @phpstan-return non-negative-int
*/
function do_meta_boxes( $screen, $context, $data_object ) {
global $wp_meta_boxes;
diff --git a/wp-includes/bookmark.php b/wp-includes/bookmark.php
index e1c8a6e522..f8314af645 100644
--- a/wp-includes/bookmark.php
+++ b/wp-includes/bookmark.php
@@ -80,16 +80,15 @@ function get_bookmark( $bookmark, $output = OBJECT, $filter = 'raw' ) {
* @param string $field The name of the data field to return.
* @param int $bookmark The bookmark ID to get field.
* @param string $context Optional. The context of how the field will be used. Default 'display'.
- * @return string|WP_Error
+ * @return mixed The sanitized field value, or an empty string if the bookmark or field does not exist.
+ *
+ * @phpstan-param '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' $field
+ * @phpstan-return ( $field is 'link_category' ? array<int, non-negative-int>|'' : ( $field is 'link_id'|'link_rating' ? int|'' : mixed ) )
*/
function get_bookmark_field( $field, $bookmark, $context = 'display' ) {
$bookmark = (int) $bookmark;
$bookmark = get_bookmark( $bookmark );
- if ( is_wp_error( $bookmark ) ) {
- return $bookmark;
- }
-
if ( ! is_object( $bookmark ) ) {
return '';
}
@@ -403,6 +402,9 @@ function sanitize_bookmark( $bookmark, $context = 'display' ) {
* @param string $context How to filter the field value. Accepts 'raw', 'edit', 'db',
* 'display', 'attribute', or 'js'. Default 'display'.
* @return mixed The filtered value.
+ *
+ * @phpstan-param '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' $field
+ * @phpstan-return ($field is 'link_category' ? array<int, non-negative-int> : ($field is 'link_id'|'link_rating' ? int : mixed))
*/
function sanitize_bookmark_field( $field, $value, $bookmark_id, $context ) {
$int_fields = array( 'link_id', 'link_rating' );
diff --git a/wp-includes/class-wp-locale.php b/wp-includes/class-wp-locale.php
index cd022fdaf9..7de22f0d24 100644
--- a/wp-includes/class-wp-locale.php
+++ b/wp-includes/class-wp-locale.php
@@ -119,6 +119,8 @@ class WP_Locale {
*
* @since 6.2.0
* @var string|null
+ *
+ * @phpstan-var 'characters_excluding_spaces'|'characters_including_spaces'|'words'|null
*/
public $word_count_type;
diff --git a/wp-includes/class-wpdb.php b/wp-includes/class-wpdb.php
index 5f5c05bd15..39958db99f 100644
--- a/wp-includes/class-wpdb.php
+++ b/wp-includes/class-wpdb.php
@@ -125,6 +125,7 @@ class wpdb {
* @since 0.71
*
* @var int
+ * @phpstan-var non-negative-int
*/
public $insert_id = 0;
@@ -3121,6 +3122,8 @@ class wpdb {
* )
* : null
* )
+ *
+ * @phpstan-param non-negative-int $y
*/
public function get_row( $query = null, $output = OBJECT, $y = 0 ) {
$this->func_call = "\$db->get_row(\"$query\",$output,$y)";
diff --git a/wp-includes/comment.php b/wp-includes/comment.php
index 6a1641cbae..8a48108eff 100644
--- a/wp-includes/comment.php
+++ b/wp-includes/comment.php
@@ -1993,6 +1993,8 @@ function wp_unspam_comment( $comment_id ) {
*
* @param int|WP_Comment $comment_id Comment ID or WP_Comment object
* @return string|false Status might be 'trash', 'approved', 'unapproved', 'spam'. False on failure.
+ *
+ * @phpstan-return 'approved'|'spam'|'trash'|'unapproved'|false
*/
function wp_get_comment_status( $comment_id ) {
$comment = get_comment( $comment_id );
diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
index ad12579fda..14836be11d 100644
--- a/wp-includes/formatting.php
+++ b/wp-includes/formatting.php
@@ -2835,6 +2835,7 @@ function format_to_edit( $content, $rich_text = false ) {
* @param int $threshold Digit places number needs to be to not have zeros added.
* @return string Adds leading zeros to number if needed.
*
+ * @phpstan-param non-negative-int $threshold
* @phpstan-return (
* $threshold is 0
* ? lowercase-string&non-empty-string&numeric-string
@@ -3006,6 +3007,8 @@ function urldecode_deep( $value ) {
* @param string $email_address Email address.
* @param int $hex_encoding Optional. Set to 1 to enable hex encoding.
* @return string Converted email address.
+ *
+ * @phpstan-param 0|1 $hex_encoding
*/
function antispambot( $email_address, $hex_encoding = 0 ) {
$obfuscated = '';
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index 59d91815d1..693ba8c388 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -1041,6 +1041,8 @@ function wp_get_http_headers( $url, $deprecated = false ) {
* @global string $previousday The day of the previous post in the loop.
*
* @return int 1 when new day, 0 if not a new day.
+ *
+ * @phpstan-return 0|1
*/
function is_new_day() {
global $currentday, $previousday;
@@ -4525,6 +4527,7 @@ function _wp_die_process_input( $message, $title = '', $args = array() ) {
* greater than 0. Default 512.
* @return string|false The JSON encoded string, or false if it cannot be encoded.
*
+ * @phpstan-param positive-int $depth
* @phpstan-return non-empty-string|false
*/
function wp_json_encode( $value, $flags = 0, $depth = 512 ) {
@@ -6303,6 +6306,8 @@ function _doing_it_wrong( $function_name, $message, $version ) {
* before passing to this function to avoid being stripped {@see wp_kses()}.
* @param int $error_level Optional. The designated error type for this error.
* Only works with E_USER family of constants. Default E_USER_NOTICE.
+ *
+ * @phpstan-param E_USER_ERROR|E_USER_WARNING|E_USER_NOTICE|E_USER_DEPRECATED $error_level
*/
function wp_trigger_error( $function_name, $message, $error_level = E_USER_NOTICE ) {
/**
@@ -6739,6 +6744,8 @@ function is_main_network( $network_id = null ) {
* @since 4.3.0
*
* @return int The ID of the main network.
+ *
+ * @phpstan-return non-negative-int
*/
function get_main_network_id() {
if ( ! is_multisite() ) {
@@ -6768,6 +6775,8 @@ function get_main_network_id() {
* @since 4.3.0
*
* @param int $main_network_id The ID of the main network.
+ *
+ * @phpstan-param non-negative-int $main_network_id
*/
return (int) apply_filters( 'get_main_network_id', $main_network_id );
}
@@ -7250,6 +7259,8 @@ function __return_false() { // phpcs:ignore WordPress.NamingConventions.ValidFun
* @since 3.0.0
*
* @return int 0.
+ *
+ * @phpstan-return 0
*/
function __return_zero() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
return 0;
@@ -7263,6 +7274,8 @@ function __return_zero() { // phpcs:ignore WordPress.NamingConventions.ValidFunc
* @since 3.0.0
*
* @return array Empty array.
+ *
+ * @phpstan-return array{}
*/
function __return_empty_array() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
return array();
@@ -7291,6 +7304,8 @@ function __return_null() { // phpcs:ignore WordPress.NamingConventions.ValidFunc
* @see __return_null()
*
* @return string Empty string.
+ *
+ * @phpstan-return ''
*/
function __return_empty_string() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
return '';
diff --git a/wp-includes/load.php b/wp-includes/load.php
index 909a4ed98f..b9086e733c 100644
--- a/wp-includes/load.php
+++ b/wp-includes/load.php
@@ -11,6 +11,8 @@
* @since 4.4.0
*
* @return string The HTTP protocol. Default: HTTP/1.0.
+ *
+ * @phpstan-return 'HTTP/1.0'|'HTTP/1.1'|'HTTP/2'|'HTTP/2.0'|'HTTP/3'
*/
function wp_get_server_protocol() {
$protocol = $_SERVER['SERVER_PROTOCOL'] ?? '';
@@ -1517,6 +1519,8 @@ function absint( $maybeint ): int {
* @global int $blog_id
*
* @return int Site ID.
+ *
+ * @phpstan-return non-negative-int
*/
function get_current_blog_id() {
global $blog_id;
@@ -1530,6 +1534,8 @@ function get_current_blog_id() {
* @since 4.6.0
*
* @return int The ID of the current network.
+ *
+ * @phpstan-return non-negative-int
*/
function get_current_network_id() {
if ( ! is_multisite() ) {
diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php
index 8e8f885f87..30fa4b9814 100644
--- a/wp-includes/pluggable.php
+++ b/wp-includes/pluggable.php
@@ -1375,7 +1375,7 @@ if ( ! function_exists( 'check_admin_referer' ) ) :
* 2 if the nonce is valid and generated between 12-24 hours ago.
* False if the nonce is invalid. Only possible when `$action` is -1,
* as the function otherwise exits rather than returning false.
- * @phpstan-return ( $action is -1 ? int|false : int )
+ * @phpstan-return ( $action is -1 ? 1|2|false : 1|2 )
*/
function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) {
if ( -1 === $action ) {
@@ -1422,7 +1422,7 @@ if ( ! function_exists( 'check_ajax_referer' ) ) :
* 2 if the nonce is valid and generated between 12-24 hours ago.
* False if the nonce is invalid. Only possible when `$stop` is false,
* as the function otherwise exits rather than returning false.
- * @phpstan-return ( $stop is true ? int : int|false )
+ * @phpstan-return ( $stop is true ? 1|2 : 1|2|false )
*/
function check_ajax_referer( $action = -1, $query_arg = false, $stop = true ) {
if ( -1 === $action ) {
@@ -2506,6 +2506,8 @@ if ( ! function_exists( 'wp_verify_nonce' ) ) :
* @return int|false 1 if the nonce is valid and generated between 0-12 hours ago,
* 2 if the nonce is valid and generated between 12-24 hours ago.
* False if the nonce is invalid.
+ *
+ * @phpstan-return 1|2|false
*/
function wp_verify_nonce( $nonce, $action = -1 ) {
$nonce = (string) $nonce;
diff --git a/wp-includes/plugin.php b/wp-includes/plugin.php
index b35f7a9944..9bef5f03e8 100644
--- a/wp-includes/plugin.php
+++ b/wp-includes/plugin.php
@@ -28,10 +28,10 @@ require __DIR__ . '/class-wp-filter-sentinel.php';
/** @var WP_Hook[] $wp_filter */
global $wp_filter;
-/** @var int[] $wp_actions */
+/** @var array<string, positive-int> $wp_actions */
global $wp_actions;
-/** @var int[] $wp_filters */
+/** @var array<string, positive-int> $wp_filters */
global $wp_filters;
/** @var string[] $wp_current_filter */
@@ -156,9 +156,9 @@ function add_filter( $hook_name, $callback, $priority = 10, $accepted_args = 1 )
* @since 6.0.0 Formalized the existing and already documented `...$args` parameter
* by adding it to the function signature.
*
- * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
- * @global int[] $wp_filters Stores the number of times each filter was triggered.
- * @global string[] $wp_current_filter Stores the list of current filters with the current one last.
+ * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
+ * @global array<string, positive-int> $wp_filters Stores the number of times each filter was triggered.
+ * @global string[] $wp_current_filter Stores the list of current filters with the current one last.
*
* @param string $hook_name The name of the filter hook.
* @param mixed $value The value to filter.
@@ -213,9 +213,9 @@ function apply_filters( $hook_name, $value, ...$args ) {
* @see apply_filters() This function is identical, but the arguments passed to the
* functions hooked to `$hook_name` are supplied using an array.
*
- * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
- * @global int[] $wp_filters Stores the number of times each filter was triggered.
- * @global string[] $wp_current_filter Stores the list of current filters with the current one last.
+ * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
+ * @global array<string, positive-int> $wp_filters Stores the number of times each filter was triggered.
+ * @global string[] $wp_current_filter Stores the list of current filters with the current one last.
*
* @param string $hook_name The name of the filter hook.
* @param non-empty-list<mixed> $args The arguments supplied to the functions hooked to `$hook_name`.
@@ -413,10 +413,12 @@ function doing_filter( $hook_name = null ) {
*
* @since 6.1.0
*
- * @global int[] $wp_filters Stores the number of times each filter was triggered.
+ * @global array<string, positive-int> $wp_filters Stores the number of times each filter was triggered.
*
* @param string $hook_name The name of the filter hook.
* @return int The number of times the filter hook has been applied.
+ *
+ * @phpstan-return non-negative-int
*/
function did_filter( $hook_name ) {
global $wp_filters;
@@ -481,9 +483,9 @@ function add_action( $hook_name, $callback, $priority = 10, $accepted_args = 1 )
* @since 5.3.0 Formalized the existing and already documented `...$arg` parameter
* by adding it to the function signature.
*
- * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
- * @global int[] $wp_actions Stores the number of times each action was triggered.
- * @global string[] $wp_current_filter Stores the list of current filters with the current one last.
+ * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
+ * @global array<string, positive-int> $wp_actions Stores the number of times each action was triggered.
+ * @global string[] $wp_current_filter Stores the list of current filters with the current one last.
*
* @param string $hook_name The name of the action to be executed.
* @param mixed ...$arg Optional. Additional arguments which are passed on to the
@@ -538,9 +540,9 @@ function do_action( $hook_name, ...$arg ) {
* @see do_action() This function is identical, but the arguments passed to the
* functions hooked to `$hook_name` are supplied using an array.
*
- * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
- * @global int[] $wp_actions Stores the number of times each action was triggered.
- * @global string[] $wp_current_filter Stores the list of current filters with the current one last.
+ * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
+ * @global array<string, positive-int> $wp_actions Stores the number of times each action was triggered.
+ * @global string[] $wp_current_filter Stores the list of current filters with the current one last.
*
* @param string $hook_name The name of the action to be executed.
* @param list<mixed> $args The arguments supplied to the functions hooked to `$hook_name`.
@@ -692,10 +694,12 @@ function doing_action( $hook_name = null ) {
*
* @since 2.1.0
*
- * @global int[] $wp_actions Stores the number of times each action was triggered.
+ * @global array<string, positive-int> $wp_actions Stores the number of times each action was triggered.
*
* @param string $hook_name The name of the action hook.
* @return int The number of times the action hook has been fired.
+ *
+ * @phpstan-return non-negative-int
*/
function did_action( $hook_name ) {
global $wp_actions;
diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php
index 4aa7f83ce8..b609ee725f 100644
--- a/wp-includes/post-template.php
+++ b/wp-includes/post-template.php
@@ -2052,6 +2052,8 @@ function wp_post_revision_title_expanded( $revision, $link = true ) {
*
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
* @param string $type 'all' (default), 'revision' or 'autosave'
+ *
+ * @phpstan-param 'all'|'revision'|'autosave' $type
*/
function wp_list_post_revisions( $post = 0, $type = 'all' ) {
$post = get_post( $post );
diff --git a/wp-includes/rest-api.php b/wp-includes/rest-api.php
index d61bb4fe31..4438594bae 100644
--- a/wp-includes/rest-api.php
+++ b/wp-includes/rest-api.php
@@ -1554,6 +1554,8 @@ function rest_get_date_with_gmt( $date, $is_utc = false ) {
* @since 4.7.0
*
* @return int 401 if the user is not logged in, 403 if the user is logged in.
+ *
+ * @phpstan-return 401|403
*/
function rest_authorization_required_code() {
return is_user_logged_in() ? 403 : 401;
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index ef81a42106..b37f2d5717 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -678,8 +678,11 @@ function wp_default_packages( $scripts ) {
*
* @param string $type The type of suffix to retrieve.
* @return string The script suffix.
+ *
+ * @phpstan-return ''|'.min'
*/
function wp_scripts_get_suffix( $type = '' ) {
+ /** @var array{ suffix: ''|'.min', dev_suffix: ''|'.min' }|null $suffixes */
static $suffixes;
if ( null === $suffixes ) {
diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php
index 8a64e726d2..d888833ecf 100644
--- a/wp-includes/taxonomy.php
+++ b/wp-includes/taxonomy.php
@@ -2580,7 +2580,7 @@ function wp_get_object_terms( $object_ids, $taxonomies, $args = array() ) {
* ...
* } $args
* @phpstan-return array{
- * term_id: int,
+ * term_id: non-negative-int,
* term_taxonomy_id: int|decimal-int-string,
* }|WP_Error
*/
@@ -2807,6 +2807,8 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
* @param string $taxonomy Taxonomy name.
* @param array $args Arguments passed to wp_insert_term().
* @param int $tt_id term_taxonomy_id for the newly created term.
+ *
+ * @phpstan-param object{ term_id: non-negative-int, term_taxonomy_id: int|numeric-string }|null $duplicate_term
*/
$duplicate_term = apply_filters( 'wp_insert_term_duplicate_term_check', $duplicate_term, $term, $taxonomy, $args, $tt_id );
@@ -2869,6 +2871,8 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
* @param int $term_id Term ID.
* @param int $tt_id Term taxonomy ID.
* @param array $args Arguments passed to wp_insert_term().
+ *
+ * @phpstan-param non-negative-int $term_id
*/
$term_id = apply_filters( 'term_id_filter', $term_id, $tt_id, $args );
@@ -3392,7 +3396,7 @@ function wp_unique_term_slug( $slug, $term ) {
* ...
* } $args
* @phpstan-return array{
- * term_id: int,
+ * term_id: non-negative-int,
* term_taxonomy_id: int,
* }|WP_Error
*/
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 4abb03cdca..a73939508a 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.3-alpha-65775';
+$wp_version = '7.3-alpha-65776';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.