Opened 11 years ago
Closed 11 years ago
#24992 closed defect (bug) (fixed)
phpDoc patch for wp-admin/includes/user.php
Reported by: | tivnet | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 3.7 | Priority: | normal |
Severity: | trivial | Version: | 3.6 |
Component: | Inline Docs | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
@return
should start with WP_User
Attachments (3)
Change History (13)
#1
follow-up:
↓ 2
@
11 years ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
#2
in reply to:
↑ 1
;
follow-up:
↓ 4
@
11 years ago
- Resolution invalid deleted
- Status changed from closed to reopened
Replying to DrewAPicture:
It's core style to delineate the return type as
object
, and use the description to specify the kind of object.
First of all, if that's a "core style" then it's time to change this style, because modern IDE's use phpDoc to validate code and provide prompts. "Object" won't help.
Besides, take a look at get_post()
- what does it say there? Yes, WP_Post
.
wp_insert_post
does not say object
in @return.
get_page
returns WP_Post
Same for get_default_post_to_edit
get_current_screen
returns WP_Screen
If you are not convinced, can I ask for a second opinion?
Thank you!
#4
in reply to:
↑ 2
@
11 years ago
- Version set to 3.6
Replying to tivnet:
Replying to DrewAPicture:
It's core style to delineate the return type as
object
, and use the description to specify the kind of object.
First of all, if that's a "core style" then it's time to change this style, because modern IDE's use phpDoc to validate code and provide prompts. "Object" won't help.
I was mistaken, in terms of using named class objects in the phpdoc return tags. This section of the phpdoc standard for WordPress hasn't been written yet ;) I'll add it to my list.
+1 for user.php.patch
#5
follow-up:
↓ 6
@
11 years ago
get_userdata()
can also return false, we should probably take that into account: 24992.patch.
#6
in reply to:
↑ 5
@
11 years ago
Replying to SergeyBiryukov:
Maybe WP_User|bool
? Generally, it returns WP_User. Bool is an exception.
#7
@
11 years ago
24992.2.patch brings some consistency.
#9
@
11 years ago
24992.2.patch looks good to me.
It's core style to delineate the return type as
object
, and use the description to specify the kind of object.