$options = [ $options ];
}
- $fh = null;
- if ( isset( $options['fileHandle'] ) ) {
- $fh = $options['fileHandle'];
- }
+ $fh = $options['fileHandle'] ?? null;
$options = $this->makeInsertOptions( $options );
if ( isset( $a[0] ) && is_array( $a[0] ) ) {
case 'N':
// process N flag: output current variant name
$ruleVar = trim( $rules );
- if ( isset( $this->mConverter->mVariantNames[$ruleVar] ) ) {
- $this->mRuleDisplay = $this->mConverter->mVariantNames[$ruleVar];
- } else {
- $this->mRuleDisplay = '';
- }
+ $this->mRuleDisplay = $this->mConverter->mVariantNames[$ruleVar] ?? '';
break;
case 'D':
// process D flag: output rules description
$this->doMagicHook();
}
- if ( isset( $this->mMagicExtensions[$mw->mId] ) ) {
- $rawEntry = $this->mMagicExtensions[$mw->mId];
- } else {
- $rawEntry = self::$dataCache->getSubitem(
- $this->mCode, 'magicWords', $mw->mId );
- }
+ $rawEntry = $this->mMagicExtensions[$mw->mId] ??
+ self::$dataCache->getSubitem( $this->mCode, 'magicWords', $mw->mId );
if ( !is_array( $rawEntry ) ) {
wfWarn( "\"$rawEntry\" is not a valid magic word for \"$mw->mId\"" );
public function getPluralRuleType( $number ) {
$index = $this->getPluralRuleIndexNumber( $number );
$pluralRuleTypes = $this->getPluralRuleTypes();
- if ( isset( $pluralRuleTypes[$index] ) ) {
- return $pluralRuleTypes[$index];
- } else {
- return 'other';
- }
+ return $pluralRuleTypes[$index] ?? 'other';
}
}
* @since 1.30
*/
public static function replaceDeprecatedCodes( $code ) {
- if ( isset( self::$deprecatedLanguageCodeMapping[$code] ) ) {
- return self::$deprecatedLanguageCodeMapping[$code];
- }
- return $code;
+ return self::$deprecatedLanguageCodeMapping[$code] ?? $code;
}
/**
* main code if there is no fallback
*/
public function getVariantFallbacks( $variant ) {
- if ( isset( $this->mVariantFallbacks[$variant] ) ) {
- return $this->mVariantFallbacks[$variant];
- }
- return $this->mMainLanguageCode;
+ return $this->mVariantFallbacks[$variant] ?? $this->mMainLanguageCode;
}
/**
if ( $weight !== $prevWeight ) {
$this->groups[$prevWeight] = $group;
$prevWeight = $weight;
- if ( isset( $this->groups[$weight] ) ) {
- $group = $this->groups[$weight];
- } else {
- $group = [];
- }
+ $group = $this->groups[$weight] ?? [];
}
$group[] = $cp;
}
$cs = new CheckStorage;
$fix = isset( $options['fix'] );
- if ( isset( $args[0] ) ) {
- $xml = $args[0];
- } else {
- $xml = false;
- }
+ $xml = $args[0] ?? false;
$cs->check( $fix, $xml );
}
function findTextIdInPage( $pageId, $textId ) {
$ids = $this->getRevTextMap( $pageId );
- if ( !isset( $ids[$textId] ) ) {
- return null;
- } else {
- return $ids[$textId];
- }
+ return $ids[$textId] ?? null;
}
function getRevTextMap( $pageId ) {
$cluster = $args[0];
$dbw = wfGetDB( DB_MASTER );
- if ( isset( $options['e'] ) ) {
- $maxID = $options['e'];
- } else {
- $maxID = $dbw->selectField( 'text', 'MAX(old_id)', '', $fname );
- }
+ $maxID = $options['e'] ?? $dbw->selectField( 'text', 'MAX(old_id)', '', $fname );
$minID = $options['s'] ?? 1;
moveToExternal( $cluster, $maxID, $minID );
if ( $raw !== '' ) {
$raw .= ', ';
}
- if ( !isset( $this->sizeHistogram[$i] ) ) {
- $val = 0;
- } else {
- $val = $this->sizeHistogram[$i];
- }
+ $val = $this->sizeHistogram[$i] ?? 0;
for ( $coarseIndex = 0; $coarseIndex < $numBins - 1; $coarseIndex++ ) {
if ( $coarseBoundaries[$coarseIndex] > $i ) {
$coarseHistogram[$coarseIndex] += $val;
$scale = 60 / $maxBinVal;
$prevBoundary = 0;
for ( $coarseIndex = 0; $coarseIndex < $numBins; $coarseIndex++ ) {
- if ( !isset( $coarseHistogram[$coarseIndex] ) ) {
- $val = 0;
- } else {
- $val = $coarseHistogram[$coarseIndex];
- }
+ $val = $coarseHistogram[$coarseIndex] ?? 0;
$boundary = $coarseBoundaries[$coarseIndex];
$this->output( sprintf( "%-10s %-10d |%s\n",
$prevBoundary . '-' . ( $boundary - 1 ) . ': ',
[ 'ORDER BY' => 'pf_name ASC' ]
);
-if ( isset( $_REQUEST['filter'] ) ) {
- $filter = $_REQUEST['filter'];
-} else {
- $filter = '';
-}
+$filter = $_REQUEST['filter'] ?? '';
?>
<form method="get" action="profileinfo.php">
'PHPUnit_Framework_Error' => 'PHPUnit\Framework\Error\Error',
];
- if ( isset( $map[$class] ) ) {
- $newForm = $map[$class];
- } else {
- $newForm = str_replace( '_', '\\', $class );
- }
+ $newForm = $map[$class] ?? str_replace( '_', '\\', $class );
if ( class_exists( $newForm ) || interface_exists( $newForm ) ) {
// If the new class name exists, alias
&& $argv['action'] === 'flush' && $in === null
) {
// Clear the buffer, we probably don't need to
- if ( isset( $parser->static_tag_buf ) ) {
- $tmp = $parser->static_tag_buf;
- } else {
- $tmp = '';
- }
+ $tmp = $parser->static_tag_buf ?? '';
$parser->static_tag_buf = null;
return $tmp;
} else { // wtf?