[wp-trac] [WordPress Trac] #26874: timer_stop() returns a string, not a float

WordPress Trac noreply at wordpress.org
Mon Jan 20 22:37:52 UTC 2014


#26874: timer_stop() returns a string, not a float
----------------------------------------+------------------------------
 Reporter:  GregLone                    |       Owner:
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  Awaiting Review
Component:  Inline Docs                 |     Version:  trunk
 Severity:  minor                       |  Resolution:
 Keywords:  needs-patch good-first-bug  |
----------------------------------------+------------------------------

Comment (by nacin):

 I just want to clarify that there's an alternative to this ticket: That
 the docs are correct and the code is wrong. microtime( true ) will return
 a float. So why is it a string?

 First: This is an "OK" good-first-bug. It is both trivial and unclear as
 to the desired direction.  good-first-bugs should be self-contained, but
 if they take only 3 seconds, it's not a great first bug (and someone will
 just come along and fix it first). On the other hand, since this is
 particular to inline docs (more in a moment), then it could of course
 benefit from a lower barrier to entry.

 Back to the alternative reality: It would be prudent to ask if it should
 return a float or a string. In this case, it is clear that a string is
 desired due to the use of number_format(_i18n). Thus changing the docs do
 appear to be in order. This would benefit from an explanation in @return
 that the number is formatted for human consumption (versus profiling) — it
 is both localized and rounded.

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


More information about the wp-trac mailing list