$this->limit = 1;
}
}
- if ( isset( $params['section'] ) ) {
- $this->section = $params['section'];
- } else {
- $this->section = false;
- }
+ $this->section = $params['section'] ?? false;
}
$userMax = $this->parseContent ? 1 : ( $smallLimit ? ApiBase::LIMIT_SML1 : ApiBase::LIMIT_BIG1 );
$this->dieStatus( $this->errorArrayToStatus( $retval, $user ) );
}
- $watch = 'preferences';
- if ( isset( $params['watchlist'] ) ) {
- $watch = $params['watchlist'];
- }
+ $watch = $params['watchlist'] ?? 'preferences';
// Watch pages
$this->setWatch( $watch, $titleObj, 'watchrollback' );
}
public function getDomain() {
- if ( isset( $this->domain ) ) {
- return $this->domain;
- } else {
- return 'invaliddomain';
- }
+ return $this->domain ?? 'invaliddomain';
}
public function validDomain( $domain ) {
function __construct( $conf = [] ) {
global $wgCacheDirectory;
- if ( isset( $conf['directory'] ) ) {
- $this->directory = $conf['directory'];
- } else {
- $this->directory = $wgCacheDirectory;
- }
+ $this->directory = $conf['directory'] ?? $wgCacheDirectory;
}
public function get( $code, $key ) {
public function __construct( $conf = [] ) {
global $wgCacheDirectory;
- if ( isset( $conf['directory'] ) ) {
- $this->directory = $conf['directory'];
- } else {
- $this->directory = $wgCacheDirectory;
- }
+ $this->directory = $conf['directory'] ?? $wgCacheDirectory;
}
public function startWrite( $code ) {
$this->showHide = $filterDefinition['showHide'];
}
- if ( isset( $filterDefinition['isReplacedInStructuredUi'] ) ) {
- $this->isReplacedInStructuredUi = $filterDefinition['isReplacedInStructuredUi'];
- } else {
- $this->isReplacedInStructuredUi = false;
- }
+ $this->isReplacedInStructuredUi = $filterDefinition['isReplacedInStructuredUi'] ?? false;
if ( isset( $filterDefinition['default'] ) ) {
$this->setDefault( $filterDefinition['default'] );
$this->queryCallable = $filterDefinition['queryCallable'];
}
- if ( isset( $filterDefinition['activeValue'] ) ) {
- $this->activeValue = $filterDefinition['activeValue'];
- } else {
- $this->activeValue = true;
- }
+ $this->activeValue = $filterDefinition['activeValue'] ?? true;
}
/**
}
$this->type = $groupDefinition['type'];
- if ( isset( $groupDefinition['priority'] ) ) {
- $this->priority = $groupDefinition['priority'];
- } else {
- $this->priority = self::DEFAULT_PRIORITY;
- }
+ $this->priority = $groupDefinition['priority'] ?? self::DEFAULT_PRIORITY;
$this->isFullCoverage = $groupDefinition['isFullCoverage'];
* @param array $records List of records to append
*/
protected function addMessages( $channel, array $records ) {
- if ( isset( $this->options['alias'][$channel] ) ) {
- $topic = $this->options['alias'][$channel];
- } else {
- $topic = "monolog_$channel";
- }
+ $topic = $this->options['alias'][$channel] ?? "monolog_$channel";
$partition = $this->getRandomPartition( $topic );
if ( $partition !== null ) {
$this->produce->setMessages( $topic, $partition, $records );
}
public function getDefault() {
- if ( isset( $this->mDefault ) ) {
- return $this->mDefault;
- } else {
- return [];
- }
+ return $this->mDefault ?? [];
}
public function filterDataForSubmit( $data ) {
$this->url = wfExpandUrl( $url, PROTO_HTTP );
$this->parsedUrl = wfParseUrl( $this->url );
- if ( isset( $options['logger'] ) ) {
- $this->logger = $options['logger'];
- } else {
- $this->logger = new NullLogger();
- }
+ $this->logger = $options['logger'] ?? new NullLogger();
if ( !$this->parsedUrl || !Http::isValidURI( $this->url ) ) {
$this->status = StatusValue::newFatal( 'http-invalid-url', $url );
$revision->setText( $text );
}
- if ( isset( $revisionInfo['timestamp'] ) ) {
- $revision->setTimestamp( $revisionInfo['timestamp'] );
- } else {
- $revision->setTimestamp( wfTimestampNow() );
- }
+ $revision->setTimestamp( $revisionInfo['timestamp'] ?? wfTimestampNow() );
if ( isset( $revisionInfo['comment'] ) ) {
$revision->setComment( $revisionInfo['comment'] );
// This will automatically add "AutoloadClasses" to $wgAutoloadClasses
$data = $registry->readFromQueue( $queue );
- $hooks = [];
- if ( isset( $data['globals']['wgHooks']['LoadExtensionSchemaUpdates'] ) ) {
- $hooks = $data['globals']['wgHooks']['LoadExtensionSchemaUpdates'];
- }
+ $hooks = $data['globals']['wgHooks']['LoadExtensionSchemaUpdates'] ?? [];
if ( $vars && isset( $vars['wgHooks']['LoadExtensionSchemaUpdates'] ) ) {
$hooks = array_merge_recursive( $hooks, $vars['wgHooks']['LoadExtensionSchemaUpdates'] );
}
* @return mixed
*/
public function getVar( $name, $default = null ) {
- if ( !isset( $this->settings[$name] ) ) {
- return $default;
- } else {
- return $this->settings[$name];
- }
+ return $this->settings[$name] ?? $default;
}
/**
$data = $registry->readFromQueue( $queue );
$wgAutoloadClasses += $data['autoload'];
- $hooksWeWant = isset( $wgHooks['LoadExtensionSchemaUpdates'] ) ?
- /** @suppress PhanUndeclaredVariable $wgHooks is set by DefaultSettings */
- $wgHooks['LoadExtensionSchemaUpdates'] : [];
+ /** @suppress PhanUndeclaredVariable $wgHooks is set by DefaultSettings */
+ $hooksWeWant = $wgHooks['LoadExtensionSchemaUpdates'] ?? [];
if ( isset( $data['globals']['wgHooks']['LoadExtensionSchemaUpdates'] ) ) {
$hooksWeWant = array_merge_recursive(
$existingSchema = false;
$this->parent->showMessage( 'config-unknown-collation' );
}
- if ( isset( $row->Engine ) ) {
- $existingEngine = $row->Engine;
- } else {
- $existingEngine = $row->Type;
- }
+ $existingEngine = $row->Engine ?? $row->Type;
}
} else {
$existingSchema = false;
return $this->session;
}
- if ( isset( $session['happyPages'] ) ) {
- $this->happyPages = $session['happyPages'];
- } else {
- $this->happyPages = [];
- }
+ $this->happyPages = $session['happyPages'] ?? [];
- if ( isset( $session['skippedPages'] ) ) {
- $this->skippedPages = $session['skippedPages'];
- } else {
- $this->skippedPages = [];
- }
+ $this->skippedPages = $session['skippedPages'] ?? [];
$lowestUnhappy = $this->getLowestUnhappy();
* @return array
*/
public function getSession( $name, $default = null ) {
- if ( !isset( $this->session[$name] ) ) {
- return $default;
- } else {
- return $this->session[$name];
- }
+ return $this->session[$name] ?? $default;
}
/**
if ( !isset( $params['labelAttribs'] ) ) {
$params['labelAttribs'] = [];
}
- if ( isset( $params['rawtext'] ) ) {
- $labelText = $params['rawtext'];
- } else {
- $labelText = $this->parse( wfMessage( $params['label'] )->text() );
- }
+ $labelText = $params['rawtext'] ?? $this->parse( wfMessage( $params['label'] )->text() );
return "<div class=\"config-input-check\">\n" .
$params['help'] .
public function getRadioSet( $params ) {
$items = $this->getRadioElements( $params );
- if ( !isset( $params['label'] ) ) {
- $label = '';
- } else {
- $label = $params['label'];
- }
+ $label = $params['label'] ?? '';
if ( !isset( $params['controlName'] ) ) {
$params['controlName'] = 'config_' . $params['var'];
return $status;
}
- if ( isset( $vars['wgDBadminuser'] ) ) {
- $this->setVar( '_InstallUser', $vars['wgDBadminuser'] );
- } else {
- $this->setVar( '_InstallUser', $vars['wgDBuser'] );
- }
- if ( isset( $vars['wgDBadminpassword'] ) ) {
- $this->setVar( '_InstallPassword', $vars['wgDBadminpassword'] );
- } else {
- $this->setVar( '_InstallPassword', $vars['wgDBpassword'] );
- }
+ $this->setVar( '_InstallUser', $vars['wgDBadminuser'] ?? $vars['wgDBuser'] );
+ $this->setVar( '_InstallPassword', $vars['wgDBadminpassword'] ?? $vars['wgDBpassword'] );
// Test the database connection
$status = $installer->getConnection();
// config-license-cc-0, config-license-pd, config-license-gfdl, config-license-none,
// config-license-cc-choose
$entry = $this->parent->licenses[$code];
- if ( isset( $entry['text'] ) ) {
- $this->setVar( 'wgRightsText', $entry['text'] );
- } else {
- $this->setVar( 'wgRightsText', wfMessage( 'config-license-' . $code )->text() );
- }
+ $this->setVar( 'wgRightsText',
+ $entry['text'] ?? wfMessage( 'config-license-' . $code )->text() );
$this->setVar( 'wgRightsUrl', $entry['url'] );
$this->setVar( 'wgRightsIcon', $entry['icon'] );
} else {
global $wgJobTypeConf;
$conf = [ 'wiki' => $this->wiki, 'type' => $type ];
- if ( isset( $wgJobTypeConf[$type] ) ) {
- $conf = $conf + $wgJobTypeConf[$type];
- } else {
- $conf = $conf + $wgJobTypeConf['default'];
- }
+ $conf += $wgJobTypeConf[$type] ?? $wgJobTypeConf['default'];
$conf['aggregator'] = JobQueueAggregator::singleton();
if ( !isset( $conf['readOnlyReason'] ) ) {
$conf['readOnlyReason'] = $this->readOnlyReason;
public static function getMimeType( $file ) {
// Infer the MIME-type from the file extension
$ext = strtolower( pathinfo( $file, PATHINFO_EXTENSION ) );
- if ( isset( self::$mimeTypes[$ext] ) ) {
- return self::$mimeTypes[$ext];
- }
-
- return mime_content_type( realpath( $file ) );
+ return self::$mimeTypes[$ext] ?? mime_content_type( realpath( $file ) );
}
/**
$this->expires = strtotime( $attr['expires'] );
}
- if ( isset( $attr['path'] ) ) {
- $this->path = $attr['path'];
- } else {
- $this->path = '/';
- }
+ $this->path = $attr['path'] ?? '/';
if ( isset( $attr['domain'] ) ) {
if ( self::validateCookieDomain( $attr['domain'] ) ) {
$xml = new XmlTypeCheck( $file );
if ( $xml->wellFormed ) {
$xmlTypes = $this->xmlTypes;
- if ( isset( $xmlTypes[$xml->getRootElement()] ) ) {
- return $xmlTypes[$xml->getRootElement()];
- } else {
- return 'application/xml';
- }
+ return $xmlTypes[$xml->getRootElement()] ?? 'application/xml';
}
/**
* @param array $params
*/
public function __construct( array $params = [] ) {
- if ( isset( $params['logger'] ) ) {
- $this->setLogger( $params['logger'] );
- } else {
- $this->setLogger( new NullLogger() );
- }
+ $this->setLogger( $params['logger'] ?? new NullLogger() );
if ( isset( $params['keyspace'] ) ) {
$this->keyspace = $params['keyspace'];
$this->serverTagMap[is_int( $key ) ? $server : $key] = $server;
}
- if ( isset( $params['automaticFailover'] ) ) {
- $this->automaticFailover = $params['automaticFailover'];
- } else {
- $this->automaticFailover = true;
- }
+ $this->automaticFailover = $params['automaticFailover'] ?? true;
$this->attrMap[self::ATTR_SYNCWRITES] = self::QOS_SYNCWRITES_NONE;
}
*/
public function getServerVersion() {
$server_info = sqlsrv_server_info( $this->conn );
- $version = 'Error';
- if ( isset( $server_info['SQLServerVersion'] ) ) {
- $version = $server_info['SQLServerVersion'];
- }
+ $version = $server_info['SQLServerVersion'] ?? 'Error';
return $version;
}
return $this->lastSection;
}
list( $dbName, ) = $this->getDBNameAndPrefix( $domain );
- if ( isset( $this->sectionsByDB[$dbName] ) ) {
- $section = $this->sectionsByDB[$dbName];
- } else {
- $section = 'DEFAULT';
- }
+ $section = $this->sectionsByDB[$dbName] ?? 'DEFAULT';
$this->lastSection = $section;
$this->lastDomain = $domain;
public function newMainLB( $domain = false ) {
list( $dbName, ) = $this->getDBNameAndPrefix( $domain );
$section = $this->getSectionForDomain( $domain );
- if ( isset( $this->groupLoadsByDB[$dbName] ) ) {
- $groupLoads = $this->groupLoadsByDB[$dbName];
- } else {
- $groupLoads = [];
- }
+ $groupLoads = $this->groupLoadsByDB[$dbName] ?? [];
if ( isset( $this->groupLoadsBySection[$section] ) ) {
$groupLoads = array_merge_recursive(
if ( isset( $groupLoadsByServer[$serverName] ) ) {
$serverInfo['groupLoads'] = $groupLoadsByServer[$serverName];
}
- if ( isset( $this->hostsByName[$serverName] ) ) {
- $serverInfo['host'] = $this->hostsByName[$serverName];
- } else {
- $serverInfo['host'] = $serverName;
- }
+ $serverInfo['host'] = $this->hostsByName[$serverName] ?? $serverName;
$serverInfo['hostName'] = $serverName;
$serverInfo['load'] = $load;
$serverInfo += [ 'flags' => IDatabase::DBO_DEFAULT ];
$this->maxLag = $params['maxLag'];
}
- if ( isset( $params['loadMonitor'] ) ) {
- $this->loadMonitorConfig = $params['loadMonitor'];
- } else {
- $this->loadMonitorConfig = [ 'class' => 'LoadMonitorNull' ];
- }
+ $this->loadMonitorConfig = $params['loadMonitor'] ?? [ 'class' => 'LoadMonitorNull' ];
$this->loadMonitorConfig += [ 'lagWarnThreshold' => $this->maxLag ];
foreach ( $params['servers'] as $i => $server ) {
}
}
- if ( isset( $params['srvCache'] ) ) {
- $this->srvCache = $params['srvCache'];
- } else {
- $this->srvCache = new EmptyBagOStuff();
- }
- if ( isset( $params['wanCache'] ) ) {
- $this->wanCache = $params['wanCache'];
- } else {
- $this->wanCache = WANObjectCache::newEmpty();
- }
+ $this->srvCache = $params['srvCache'] ?? new EmptyBagOStuff();
+ $this->wanCache = $params['wanCache'] ?? WANObjectCache::newEmpty();
$this->profiler = $params['profiler'] ?? null;
- if ( isset( $params['trxProfiler'] ) ) {
- $this->trxProfiler = $params['trxProfiler'];
- } else {
- $this->trxProfiler = new TransactionProfiler();
- }
+ $this->trxProfiler = $params['trxProfiler'] ?? new TransactionProfiler();
$this->errorLogger = $params['errorLogger'] ?? function ( Exception $e ) {
trigger_error( get_class( $e ) . ': ' . $e->getMessage(), E_USER_WARNING );
}
public function getServerName( $i ) {
- if ( isset( $this->servers[$i]['hostName'] ) ) {
- $name = $this->servers[$i]['hostName'];
- } elseif ( isset( $this->servers[$i]['host'] ) ) {
- $name = $this->servers[$i]['host'];
- } else {
- $name = '';
- }
+ $name = $this->servers[$i]['hostName'] ?? $this->servers[$i]['host'] ?? '';
return ( $name != '' ) ? $name : 'localhost';
}
public function getServerInfo( $i ) {
- if ( isset( $this->servers[$i] ) ) {
- return $this->servers[$i];
- } else {
- return false;
- }
+ return $this->servers[$i] ?? false;
}
public function getServerType( $i ) {
global $wgLogActionsHandlers;
$fulltype = $entry->getFullType();
$wildcard = $entry->getType() . '/*';
- $handler = '';
-
- if ( isset( $wgLogActionsHandlers[$fulltype] ) ) {
- $handler = $wgLogActionsHandlers[$fulltype];
- } elseif ( isset( $wgLogActionsHandlers[$wildcard] ) ) {
- $handler = $wgLogActionsHandlers[$wildcard];
- }
+ $handler = $wgLogActionsHandlers[$fulltype] ?? $wgLogActionsHandlers[$wildcard] ?? '';
if ( $handler !== '' && is_string( $handler ) && class_exists( $handler ) ) {
return new $handler( $entry );
global $wgLogNames;
// BC
- if ( isset( $wgLogNames[$this->type] ) ) {
- $key = $wgLogNames[$this->type];
- } else {
- $key = 'log-name-' . $this->type;
- }
+ $key = $wgLogNames[$this->type] ?? 'log-name-' . $this->type;
return wfMessage( $key );
}
public function getDescription() {
global $wgLogHeaders;
// BC
- if ( isset( $wgLogHeaders[$this->type] ) ) {
- $key = $wgLogHeaders[$this->type];
- } else {
- $key = 'log-description-' . $this->type;
- }
+ $key = $wgLogHeaders[$this->type] ?? 'log-description-' . $this->type;
return wfMessage( $key );
}
*/
public function getRestriction() {
global $wgLogRestrictions;
- if ( isset( $wgLogRestrictions[$this->type] ) ) {
- $restriction = $wgLogRestrictions[$this->type];
- } else {
- // '' always returns true with $user->isAllowed()
- $restriction = '';
- }
-
- return $restriction;
+ // '' always returns true with $user->isAllowed()
+ return $wgLogRestrictions[$this->type] ?? '';
}
/**
case '2#055':
// Date created (not date digitized).
// Maps to exif DateTimeOriginal
- if ( isset( $parsed['2#060'] ) ) {
- $time = $parsed['2#060'];
- } else {
- $time = [];
- }
+ $time = $parsed['2#060'] ?? [];
$timestamp = self::timeHelper( $val, $time, $c );
if ( $timestamp ) {
$data['DateTimeOriginal'] = $timestamp;
case '2#062':
// Date converted to digital representation.
// Maps to exif DateTimeDigitized
- if ( isset( $parsed['2#063'] ) ) {
- $time = $parsed['2#063'];
- } else {
- $time = [];
- }
+ $time = $parsed['2#063'] ?? [];
$timestamp = self::timeHelper( $val, $time, $c );
if ( $timestamp ) {
$data['DateTimeDigitized'] = $timestamp;
case '2#030':
// Date released.
- if ( isset( $parsed['2#035'] ) ) {
- $time = $parsed['2#035'];
- } else {
- $time = [];
- }
+ $time = $parsed['2#035'] ?? [];
$timestamp = self::timeHelper( $val, $time, $c );
if ( $timestamp ) {
$data['DateTimeReleased'] = $timestamp;
case '2#037':
// Date expires.
- if ( isset( $parsed['2#038'] ) ) {
- $time = $parsed['2#038'];
- } else {
- $time = [];
- }
+ $time = $parsed['2#038'] ?? [];
$timestamp = self::timeHelper( $val, $time, $c );
if ( $timestamp ) {
$data['DateTimeExpires'] = $timestamp;
* @throws InvalidArgumentException
*/
public static function newFromParams( $params ) {
- if ( isset( $params['loggroup'] ) ) {
- $params['logger'] = LoggerFactory::getInstance( $params['loggroup'] );
- } else {
- $params['logger'] = LoggerFactory::getInstance( 'objectcache' );
- }
+ $params['logger'] = LoggerFactory::getInstance( $params['loggroup'] ?? 'objectcache' );
if ( !isset( $params['keyspace'] ) ) {
$params['keyspace'] = self::getDefaultKeyspace();
}
}
}
$params['cache'] = self::newFromParams( $params['store'] );
- if ( isset( $params['loggroup'] ) ) {
- $params['logger'] = LoggerFactory::getInstance( $params['loggroup'] );
- } else {
- $params['logger'] = LoggerFactory::getInstance( 'objectcache' );
- }
+ $params['logger'] = LoggerFactory::getInstance( $params['loggroup'] ?? 'objectcache' );
if ( !$wgCommandLineMode ) {
// Send the statsd data post-send on HTTP requests; avoid in CLI mode (T181385)
$params['stats'] = $services->getStatsdDataFactory();
*/
private function replace( $matches ) {
# Extract information from $matches
- $linked = true;
- if ( isset( $this->mLinked ) ) {
- $linked = $this->mLinked;
- }
+ $linked = $this->mLinked ?? true;
$bits = [];
$key = $this->keys[$this->mSource];
* or null if no value was set for this key.
*/
public function getExtensionData( $key ) {
- if ( isset( $this->mExtensionData[$key] ) ) {
- return $this->mExtensionData[$key];
- }
-
- return null;
+ return $this->mExtensionData[$key] ?? null;
}
private static function getTimes( $clock = null ) {
* @return string|bool
*/
public function getArgument( $index ) {
- if ( !isset( $this->args[$index] ) ) {
- return false;
- }
- return $this->args[$index];
+ return $this->args[$index] ?? false;
}
public function getArguments() {
* @return string|bool
*/
public function getArgument( $index ) {
- if ( !isset( $this->args[$index] ) ) {
- return false;
- }
- return $this->args[$index];
+ return $this->args[$index] ?? false;
}
public function getArguments() {
continue;
}
- if ( isset( $userGroupMemberships[$ueg] ) ) {
- $groupStringOrObject = $userGroupMemberships[$ueg];
- } else {
- $groupStringOrObject = $ueg;
- }
+ $groupStringOrObject = $userGroupMemberships[$ueg] ?? $ueg;
$userG = UserGroupMembership::getLink( $groupStringOrObject, $context, 'html' );
$userM = UserGroupMembership::getLink( $groupStringOrObject, $context, 'html',
* @param string $dir
*/
protected function extractConfig2( array $info, $dir ) {
- if ( isset( $info['config_prefix'] ) ) {
- $prefix = $info['config_prefix'];
- } else {
- $prefix = 'wg';
- }
+ $prefix = $info['config_prefix'] ?? 'wg';
if ( isset( $info['config'] ) ) {
foreach ( $info['config'] as $key => $data ) {
$value = $data['value'];
$object->setConfig( $this->getConfig() );
$object->setLogger( $this->logger );
} else {
- if ( !isset( $info['class'] ) ) {
- $class = ResourceLoaderFileModule::class;
- } else {
- $class = $info['class'];
- }
+ $class = $info['class'] ?? ResourceLoaderFileModule::class;
/** @var ResourceLoaderModule $object */
$object = new $class( $info );
$object->setConfig( $this->getConfig() );
* @return mixed the feature value or null if unset
*/
public function getFeatureData( $feature ) {
- if ( isset( $this->features[$feature] ) ) {
- return $this->features[$feature];
- }
- return null;
+ return $this->features[$feature] ?? null;
}
/**
// Give site config file a chance to run the script in a wrapper.
// The caller may likely want to call wfBasename() on $script.
Hooks::run( 'wfShellWikiCmd', [ &$script, &$parameters, &$options ] );
- $cmd = isset( $options['php'] ) ? [ $options['php'] ] : [ $wgPhpCli ];
+ $cmd = [ $options['php'] ?? $wgPhpCli ];
if ( isset( $options['wrapper'] ) ) {
$cmd[] = $options['wrapper'];
}
* @return Site|null
*/
public function getSite( $globalId, $source = 'cache' ) {
- if ( isset( $this->sites[$globalId] ) ) {
- return $this->sites[$globalId];
- } else {
- return null;
- }
+ return $this->sites[$globalId] ?? null;
}
/**
* @return string
*/
function makeLink( $key, $item, $options = [] ) {
- if ( isset( $item['text'] ) ) {
- $text = $item['text'];
- } else {
- $text = wfMessage( $item['msg'] ?? $key )->text();
- }
+ $text = $item['text'] ?? wfMessage( $item['msg'] ?? $key )->text();
$html = htmlspecialchars( $text );
* @return Title
*/
public function getRelevantTitle() {
- if ( isset( $this->mRelevantTitle ) ) {
- return $this->mRelevantTitle;
- }
- return $this->getTitle();
+ return $this->mRelevantTitle ?? $this->getTitle();
}
/**
$caseFoldedAlias = $this->contLang->caseFold( $bits[0] );
$caseFoldedAlias = str_replace( ' ', '_', $caseFoldedAlias );
$aliases = $this->getAliasList();
- if ( isset( $aliases[$caseFoldedAlias] ) ) {
- $name = $aliases[$caseFoldedAlias];
- } else {
+ if ( !isset( $aliases[$caseFoldedAlias] ) ) {
return [ null, null ];
}
-
- if ( !isset( $bits[1] ) ) { // T4087
- $par = null;
- } else {
- $par = $bits[1];
- }
+ $name = $aliases[$caseFoldedAlias];
+ $par = $bits[1] ?? null; // T4087
return [ $name, $par ];
}
// @todo FIXME: Redirects broken due to this call
$bits = explode( '/', $title->getDBkey(), 2 );
$name = $bits[0];
- if ( !isset( $bits[1] ) ) { // T4087
- $par = null;
- } else {
- $par = $bits[1];
- }
+ $par = $bits[1] ?? null; // T4087
$page = $this->getPage( $name );
if ( !$page ) {
$label = Html::rawElement( 'label', [ 'for' => $id ], $this->mLabel );
if ( !empty( $this->mParams['radio'] ) ) {
- if ( isset( $this->mParams['radio-id'] ) ) {
- $radioId = $this->mParams['radio-id'];
- } else {
+ $radioId = $this->mParams['radio-id'] ??
// Old way. For the benefit of extensions that do not define
// the 'radio-id' key.
- $radioId = 'wpSourceType' . $this->mParams['upload-type'];
- }
+ 'wpSourceType' . $this->mParams['upload-type'];
$attribs = [
'name' => 'wpSourceType',
self::WINDOWS_NONASCII_FILENAME => 'windows-nonascii-filename',
self::FILENAME_TOO_LONG => 'filename-toolong',
];
- if ( isset( $code_to_status[$error] ) ) {
- return $code_to_status[$error];
- }
-
- return 'unknown-error';
+ return $code_to_status[$error] ?? 'unknown-error';
}
/**
*/
public static function getDefaultOption( $opt ) {
$defOpts = self::getDefaultOptions();
- if ( isset( $defOpts[$opt] ) ) {
- return $defOpts[$opt];
- } else {
- return null;
- }
+ return $defOpts[$opt] ?? null;
}
/**
# NOTE: $gis[2] contains a code for the image type. This is no longer used.
$info['width'] = $gis[0];
$info['height'] = $gis[1];
- if ( isset( $gis['bits'] ) ) {
- $info['bits'] = $gis['bits'];
- } else {
- $info['bits'] = 0;
- }
+ $info['bits'] = $gis['bits'] ?? 0;
return $info;
}
$interwiki = $this->iwLookup->fetch( $iwPrefix );
$parsed = wfParseUrl( wfExpandUrl( $interwiki ? $interwiki->getURL() : '/' ) );
- if ( isset( $this->customCaptions[$iwPrefix] ) ) {
- $caption = $this->customCaptions[$iwPrefix];
- } else {
- $caption = $this->specialSearch->msg( 'search-interwiki-default', $parsed['host'] )->escaped();
- }
+ $caption = $this->customCaptions[$iwPrefix] ??
+ $this->specialSearch->msg( 'search-interwiki-default', $parsed['host'] )->escaped();
$searchLink = Html::rawElement( 'em', null,
Html::rawElement( 'a', [ 'href' => $href, 'target' => '_blank' ], $caption )