[wp-trac] [WordPress Trac] #41525: Remove usage of each() from WP_PHPUnit_Util_Getopt

WordPress Trac noreply at wordpress.org
Wed Aug 2 11:04:52 UTC 2017


#41525: Remove usage of each() from WP_PHPUnit_Util_Getopt
------------------------------+------------------
 Reporter:  johnbillion       |       Owner:
     Type:  task (blessed)    |      Status:  new
 Priority:  normal            |   Milestone:  4.9
Component:  Build/Test Tools  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:  needs-patch       |     Focuses:
------------------------------+------------------

Comment (by ayeshrajans):

 The `\WP_PHPUnit_Util_Getopt` class is hard to test because it modifies
 some static variables. However, I took a try to get rid of the each()
 call.

 The `$i` variable was not used. We still keep the `while()` pattern
 because it needs to be modified. However, instead of using `each()` to
 fetch and advance the array iterator, this patch proposes to do it in
 separate calls. The immediately following `next()` call advances the array
 pointer, making the `while()` loop finish.

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


More information about the wp-trac mailing list