Replace uses of each()
authorBrad Jorsch <bjorsch@wikimedia.org>
Tue, 19 Sep 2017 19:57:18 +0000 (15:57 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Wed, 20 Sep 2017 13:51:28 +0000 (09:51 -0400)
commit2c34fd6e0ecf33a77c947eeba98154c02554ee3a
tree6333a22b5e14de4c4bd9aae930a2fa90fae71a99
parentbdc10df7d0b1a3a6f0b37265f2f8b445cdace2d6
Replace uses of each()

It's deprecated in PHP 7.2, may as well replace it now.

I note that, contrary to claims at
https://wiki.php.net/rfc/deprecations_php_7_2#each, none of our uses
were trivially replaceable with foreach.

* wfArrayDiff2_cmp() is processing two arrays by value in parallel.
* MagicWordArray::parseMatch() is doing something funky with the data
  structure returned by preg_match().
* HashRing was using it like "nextKey()", replaced with calls to key()
  and next().
* FormatMetadata and IndexPager were both using it as a shorter way to
  get both key() and current() for the first element in the array. I
  suppose a foreach(){ break; } would do the same, but that's confusing.

Bug: T174354
Change-Id: I36169a04c764fdf1bfd6603395111c6fe0aae5eb
includes/GlobalFunctions.php
includes/MagicWordArray.php
includes/libs/HashRing.php
includes/media/FormatMetadata.php
includes/pager/IndexPager.php