[wp-trac] [WordPress Trac] #51278: Update return types to reflect the real return types. Remove mixed.

WordPress Trac noreply at wordpress.org
Wed Sep 9 16:35:31 UTC 2020


#51278: Update return types to reflect the real return types. Remove mixed.
-------------------------+-------------------------------------
 Reporter:  ReneHermi    |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:  docs, coding-standards
-------------------------+-------------------------------------
Changes (by johnbillion):

 * focuses:  accessibility, docs, coding-standards => docs, coding-standards
 * severity:  major => normal
 * version:  trunk =>


Comment:

 Thanks for the ticket and the PR @ReneHermi .

 There's been quite a bit of work done to remove `mixed` types in docs over
 recent releases. See #50768 and its predecessors, and related tickets such
 as #41756.

 I agree that continuing this work makes sense when listing the types
 ''really'' helps the developer. I don't think that `@return
 bool|string|array|object` for the `get_option()` function specifically is
 much more useful than `@return mixed`. In addition, the filter on its
 return value and the recent addition of a default value in #43941 means
 this function can return a value of any type, including integer, float,
 etc.

 That said, there's over 100 other instances and I'm sure many of those
 would benefit from more accurate types! So yes, let's replace `mixed` with
 proper types when it makes sense to do so.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51278#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list