Build/Test tools: Update the WP_PHPUnit_Util_Getopt class for PHP 7.2 compatibility.

This removes usage of `each()` which is deprecated in PHP 7.2.

See #40109, #41525

Merges [41636] to the 4.8 branch.


git-svn-id: https://develop.svn.wordpress.org/branches/4.8@41637 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn 2017-09-28 23:16:18 +00:00
parent 6d11642f5f
commit fa4df67fa7

View File

@ -132,7 +132,9 @@ class WP_PHPUnit_Util_Getopt extends PHPUnit_Util_Getopt {
function __construct( $argv ) {
array_shift( $argv );
$options = array();
while ( list( $i, $arg ) = each( $argv ) ) {
while ( current( $argv ) ) {
$arg = current( $argv );
next( $argv );
try {
if ( strlen( $arg ) > 1 && $arg[0] === '-' && $arg[1] === '-' ) {
PHPUnit_Util_Getopt::parseLongOption( substr( $arg, 2 ), $this->longOptions, $options, $argv );