}
$errors = [];
- while ( count( $checks ) > 0 &&
- !( $short && count( $errors ) > 0 ) ) {
- $method = array_shift( $checks );
+ foreach ( $checks as $method ) {
$errors = $this->$method( $action, $user, $errors, $rigor, $short );
+
+ if ( $short && $errors !== [] ) {
+ break;
+ }
}
return $errors;
if ( MWNamespace::hasSubpages( $this->mNamespace ) ) {
// Optional notice for page itself and any parent page
- $parts = explode( '/', $this->mDbkeyform );
$editnotice_base = $editnotice_ns;
- while ( count( $parts ) > 0 ) {
- $editnotice_base .= '-' . array_shift( $parts );
+ foreach ( explode( '/', $this->mDbkeyform ) as $part ) {
+ $editnotice_base .= '-' . $part;
$msg = wfMessage( $editnotice_base );
if ( $msg->exists() ) {
$html = $msg->parseAsBlock();
$value = null;
if ( is_null( $key ) ) {
- $itemKey = array_keys( array_slice( $this->cachedChunks, 0, 1 ) );
- $itemKey = array_shift( $itemKey );
+ reset( $this->cachedChunks );
+ $itemKey = key( $this->cachedChunks );
if ( !is_int( $itemKey ) ) {
wfWarn( "Attempted to get item with non-numeric key while " .
$setSection =& $loadedDescriptor;
if ( $section ) {
- $sectionParts = explode( '/', $section );
-
- while ( count( $sectionParts ) ) {
- $newName = array_shift( $sectionParts );
-
+ foreach ( explode( '/', $section ) as $newName ) {
if ( !isset( $setSection[$newName] ) ) {
$setSection[$newName] = [];
}
for ( $i = count( $thisKeys ) - 1; $i >= 0; $i-- ) {
$keys = array_merge( array_slice( $thisKeys, 0, $i ), $nameKeys );
$data = $alldata;
- while ( $keys ) {
- $key = array_shift( $keys );
+ foreach ( $keys as $key ) {
if ( !is_array( $data ) || !array_key_exists( $key, $data ) ) {
continue 2;
}