Rewrite loop in ReferenceStack

Change-Id: I3bdf26fd14573abdcad989c7ebfea48e49ef42aa
This commit is contained in:
Adam Wight 2019-11-23 01:03:42 +01:00 committed by Thiemo Kreuz (WMDE)
parent f00b21943b
commit 249982e353

View file

@ -139,12 +139,13 @@ class ReferenceStack {
if ( $follow ) { if ( $follow ) {
$ref['follow'] = $follow; $ref['follow'] = $follow;
// insert broken follow at the end of any other broken follows. // This inserts the broken "follow" at the end of all other broken "follow"
$groupsCount = count( $this->refs[$group] ); $k = 0;
for ( $k = 0; $k < $groupsCount; $k++ ) { foreach ( $this->refs[$group] as $value ) {
if ( !isset( $this->refs[$group][$k]['follow'] ) ) { if ( !isset( $value['follow'] ) ) {
break; break;
} }
$k++;
} }
array_splice( $this->refs[$group], $k, 0, [ $ref ] ); array_splice( $this->refs[$group], $k, 0, [ $ref ] );
array_splice( $this->refCallStack, $k, 0, array_splice( $this->refCallStack, $k, 0,