Simplify else-branches after continue/break
When the if branch continues the loop, than the next branch does not need to be an else branch Change-Id: Ia158709b7fd2ea811f1049cf8f53ed12c89719e3
This commit is contained in:
parent
4d8c21e2fb
commit
244ea7c0b5
9 changed files with 31 additions and 26 deletions
|
|
@ -1859,7 +1859,8 @@ class HTMLForm extends ContextSource {
|
|||
$request = $this->getRequest();
|
||||
if ( $field->skipLoadData( $request ) ) {
|
||||
continue;
|
||||
} elseif ( !empty( $field->mParams['disabled'] ) ) {
|
||||
}
|
||||
if ( !empty( $field->mParams['disabled'] ) ) {
|
||||
$fieldData[$fieldname] = $field->getDefault();
|
||||
} else {
|
||||
$fieldData[$fieldname] = $field->loadDataFromRequest( $request );
|
||||
|
|
|
|||
|
|
@ -170,7 +170,8 @@ class HTMLFormFieldCloner extends HTMLFormField {
|
|||
foreach ( $fields as $fieldname => $field ) {
|
||||
if ( $field->skipLoadData( $subrequest ) ) {
|
||||
continue;
|
||||
} elseif ( !empty( $field->mParams['disabled'] ) ) {
|
||||
}
|
||||
if ( !empty( $field->mParams['disabled'] ) ) {
|
||||
$row[$fieldname] = $field->getDefault();
|
||||
} else {
|
||||
$row[$fieldname] = $field->loadDataFromRequest( $subrequest );
|
||||
|
|
@ -186,9 +187,8 @@ class HTMLFormFieldCloner extends HTMLFormField {
|
|||
foreach ( $fields as $fieldname => $field ) {
|
||||
if ( !empty( $field->mParams['nodata'] ) ) {
|
||||
continue;
|
||||
} else {
|
||||
$row[$fieldname] = $field->getDefault();
|
||||
}
|
||||
$row[$fieldname] = $field->getDefault();
|
||||
}
|
||||
$ret[] = $row;
|
||||
}
|
||||
|
|
@ -206,9 +206,8 @@ class HTMLFormFieldCloner extends HTMLFormField {
|
|||
foreach ( $fields as $fieldname => $field ) {
|
||||
if ( !empty( $field->mParams['nodata'] ) ) {
|
||||
continue;
|
||||
} else {
|
||||
$row[$fieldname] = $field->getDefault();
|
||||
}
|
||||
$row[$fieldname] = $field->getDefault();
|
||||
}
|
||||
$ret = [ $row ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -706,7 +706,8 @@ abstract class MediaHandler {
|
|||
if ( $v === false ) {
|
||||
// Use default formatting
|
||||
continue;
|
||||
} elseif ( $v === null ) {
|
||||
}
|
||||
if ( $v === null ) {
|
||||
// Remove this tag, don't format it for display
|
||||
unset( $metadataArray[$tag] );
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -503,7 +503,8 @@ class BlockLevelPass {
|
|||
# We're nested in language converter markup, but there
|
||||
# are no close tags left. Abort!
|
||||
break 2;
|
||||
} elseif ( $m[0][0] === '-{' ) {
|
||||
}
|
||||
if ( $m[0][0] === '-{' ) {
|
||||
$i = $m[0][1] + 1;
|
||||
$lcLevel++;
|
||||
} elseif ( $m[0][0] === '}-' ) {
|
||||
|
|
|
|||
|
|
@ -287,7 +287,8 @@ class DefaultPreferencesFactory implements PreferencesFactory {
|
|||
if ( isset( $info['default'] ) ) {
|
||||
// Already set, no problem
|
||||
continue;
|
||||
} elseif ( $prefFromUser !== null && // Make sure we're not just pulling nothing
|
||||
}
|
||||
if ( $prefFromUser !== null && // Make sure we're not just pulling nothing
|
||||
$field->validate( $prefFromUser, $this->userOptionsManager->getOptions( $user ) ) === true ) {
|
||||
$info['default'] = $prefFromUser;
|
||||
} elseif ( $field->validate( $globalDefault, $this->userOptionsManager->getOptions( $user ) ) === true ) {
|
||||
|
|
|
|||
|
|
@ -598,7 +598,8 @@ class ResourceLoader implements LoggerAwareInterface {
|
|||
// avoid duplicate write request slams (T124649)
|
||||
// the lock must be specific to the current wiki (T247028)
|
||||
continue;
|
||||
} elseif ( $update === null ) {
|
||||
}
|
||||
if ( $update === null ) {
|
||||
$entitiesUnreg[] = $entity;
|
||||
} elseif ( $update === '*' ) {
|
||||
$entitiesRenew[] = $entity;
|
||||
|
|
|
|||
|
|
@ -97,21 +97,20 @@ class Licenses extends HTMLFormField {
|
|||
foreach ( $lines as $line ) {
|
||||
if ( strpos( $line, '*' ) !== 0 ) {
|
||||
continue;
|
||||
} else {
|
||||
list( $level, $line ) = $this->trimStars( $line );
|
||||
}
|
||||
list( $level, $line ) = $this->trimStars( $line );
|
||||
|
||||
if ( strpos( $line, '|' ) !== false ) {
|
||||
$obj = $this->buildLine( $line );
|
||||
$this->stackItem( $this->lines, $levels, $obj );
|
||||
} else {
|
||||
if ( $level < count( $levels ) ) {
|
||||
$levels = array_slice( $levels, 0, $level );
|
||||
}
|
||||
if ( $level == count( $levels ) ) {
|
||||
$levels[$level - 1] = $line;
|
||||
} elseif ( $level > count( $levels ) ) {
|
||||
$levels[] = $line;
|
||||
}
|
||||
if ( strpos( $line, '|' ) !== false ) {
|
||||
$obj = $this->buildLine( $line );
|
||||
$this->stackItem( $this->lines, $levels, $obj );
|
||||
} else {
|
||||
if ( $level < count( $levels ) ) {
|
||||
$levels = array_slice( $levels, 0, $level );
|
||||
}
|
||||
if ( $level == count( $levels ) ) {
|
||||
$levels[$level - 1] = $line;
|
||||
} elseif ( $level > count( $levels ) ) {
|
||||
$levels[] = $line;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -554,7 +554,8 @@ class Xml {
|
|||
$value = trim( $option );
|
||||
if ( $value == '' ) {
|
||||
continue;
|
||||
} elseif ( substr( $value, 0, 1 ) == '*' && substr( $value, 1, 1 ) != '*' ) {
|
||||
}
|
||||
if ( substr( $value, 0, 1 ) == '*' && substr( $value, 1, 1 ) != '*' ) {
|
||||
# A new group is starting...
|
||||
$value = trim( substr( $value, 1 ) );
|
||||
if ( $value !== '' &&
|
||||
|
|
|
|||
|
|
@ -230,7 +230,8 @@ class RecompressTracked {
|
|||
foreach ( self::$cmdLineOptionMap as $cmdOption => $classOption ) {
|
||||
if ( $cmdOption == 'child-id' ) {
|
||||
continue;
|
||||
} elseif ( in_array( $cmdOption, self::$optionsWithArgs ) && isset( $this->$classOption ) ) {
|
||||
}
|
||||
if ( in_array( $cmdOption, self::$optionsWithArgs ) && isset( $this->$classOption ) ) {
|
||||
$cmd .= " --$cmdOption " . Shell::escape( $this->$classOption );
|
||||
} elseif ( $this->$classOption ) {
|
||||
$cmd .= " --$cmdOption";
|
||||
|
|
|
|||
Loading…
Reference in a new issue