diff --git a/functionMap.php b/functionMap.php index 12045d1e..ed334ae9 100644 --- a/functionMap.php +++ b/functionMap.php @@ -212,4 +212,10 @@ 'Custom_Image_Header::set_header_image' => [null, 'choice' => 'string|array{attachment_id: int<1, max>, url: string, width: int<0, max>, height: int<0, max>}'], 'get_user' => ['($user_id is int ? false : \WP_User|false)'], 'get_user_by' => ["(\$field is 'id'|'ID' ? (\$value is int ? false : \WP_User|false) : \WP_User|false)"], + 'check_admin_referer' => ['1|2|false', 'action' => '-1|string'], + 'check_ajax_referer' => ['1|2|false', 'action' => '-1|string'], + 'wp_verify_nonce' => ['1|2|false', 'action' => '-1|string'], + 'wp_create_nonce' => [null, 'action' => '-1|string'], + 'wp_nonce_url' => [null, 'action' => '-1|string'], + 'wp_nonce_field' => [null, 'action' => '-1|string'], ]; diff --git a/wordpress-stubs.php b/wordpress-stubs.php index 23ed71ea..e688ad31 100644 --- a/wordpress-stubs.php +++ b/wordpress-stubs.php @@ -111018,6 +111018,7 @@ function is_blog_installed() * @param int|string $action Optional. Nonce action name. Default -1. * @param string $name Optional. Nonce name. Default '_wpnonce'. * @return string Escaped URL with nonce action added. + * @phpstan-param -1|string $action */ function wp_nonce_url($actionurl, $action = -1, $name = '_wpnonce') { @@ -111047,6 +111048,7 @@ function wp_nonce_url($actionurl, $action = -1, $name = '_wpnonce') * @param bool $referer Optional. Whether to set the referer field for validation. Default true. * @param bool $display Optional. Whether to display or return hidden form field. Default true. * @return string Nonce field HTML markup. + * @phpstan-param -1|string $action */ function wp_nonce_field($action = -1, $name = '_wpnonce', $referer = \true, $display = \true) { @@ -127986,6 +127988,8 @@ function auth_redirect() * @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-param -1|string $action + * @phpstan-return 1|2|false */ function check_admin_referer($action = -1, $query_arg = '_wpnonce') { @@ -128004,6 +128008,8 @@ function check_admin_referer($action = -1, $query_arg = '_wpnonce') * @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-param -1|string $action + * @phpstan-return 1|2|false */ function check_ajax_referer($action = -1, $query_arg = \false, $stop = \true) { @@ -128202,6 +128208,8 @@ function wp_nonce_tick($action = -1) * @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-param -1|string $action + * @phpstan-return 1|2|false */ function wp_verify_nonce($nonce, $action = -1) { @@ -128215,6 +128223,7 @@ function wp_verify_nonce($nonce, $action = -1) * * @param string|int $action Scalar value to add context to the nonce. * @return string The token. + * @phpstan-param -1|string $action */ function wp_create_nonce($action = -1) {