Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#24992 closed defect (bug) (fixed)

phpDoc patch for wp-admin/includes/user.php

Reported by: tivnet's profile tivnet Owned by: sergeybiryukov's profile 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)

user.php.patch (396 bytes) - added by tivnet 11 years ago.
24992.patch (582 bytes) - added by SergeyBiryukov 11 years ago.
24992.2.patch (1.9 KB) - added by SergeyBiryukov 11 years ago.

Download all attachments as: .zip

Change History (13)

@tivnet
11 years ago

#1 follow-up: @DrewAPicture
11 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

It's core style to delineate the return type as object, and use the description to specify the kind of object.

#2 in reply to: ↑ 1 ; follow-up: @tivnet
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!

#3 @markoheijnen
11 years ago

  • Milestone set to 3.7

The patch seems totally fine with me.

#4 in reply to: ↑ 2 @DrewAPicture
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: @SergeyBiryukov
11 years ago

get_userdata() can also return false, we should probably take that into account: 24992.patch.

#6 in reply to: ↑ 5 @tivnet
11 years ago

Replying to SergeyBiryukov:
Maybe WP_User|bool ? Generally, it returns WP_User. Bool is an exception.

#7 @SergeyBiryukov
11 years ago

24992.2.patch brings some consistency.

#8 @SergeyBiryukov
11 years ago

  • Keywords commit added

#10 @SergeyBiryukov
11 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from reopened to closed

In 25204:

Update phpdoc for get_user_to_edit(), get_userdata(), and get_user_by(). props tivnet. fixes #24992.

Note: See TracTickets for help on using tickets.