Skip to content

Commit be80802

Browse files
committed
Privacy: Correct type of WP_User_Request::$user_id from int to string/numeric-string.
Also adds `numeric-string` as richer PHPStan type to `WP_Post::$post_author` and `WP_Post::$comment_count`. Developed in WordPress#12018. Follow-up to r25086, r43011. Props masteradhoc, desrosj, garrett-eclipse, johnbillion, westonruter, apermo, SergeyBiryukov, TZ-Media, andizer, javorszky. See #22324, #25092, #43443, #43985, #64898. Fixes #44723. git-svn-id: https://develop.svn.wordpress.org/trunk@62437 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 137eb30 commit be80802

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/wp-includes/class-wp-post.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ final class WP_Post {
3636
*
3737
* @since 3.5.0
3838
* @var string
39+
* @phpstan-var numeric-string
3940
*/
4041
public $post_author = '0';
4142

@@ -206,6 +207,7 @@ final class WP_Post {
206207
*
207208
* @since 3.5.0
208209
* @var string
210+
* @phpstan-var numeric-string
209211
*/
210212
public $comment_count = '0';
211213

src/wp-includes/class-wp-user-request.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ final class WP_User_Request {
2020
* User ID.
2121
*
2222
* @since 4.9.6
23-
* @var int
23+
* @var string
24+
* @phpstan-var numeric-string
2425
*/
25-
public $user_id = 0;
26+
public $user_id = '0';
2627

2728
/**
2829
* User email.

0 commit comments

Comments
 (0)