diff --git a/includes/ActorMigration.php b/includes/ActorMigration.php index 0c33eb9bfcf..597b8e76e79 100644 --- a/includes/ActorMigration.php +++ b/includes/ActorMigration.php @@ -136,11 +136,7 @@ class ActorMigration { * @return string[] [ $text, $actor ] */ private static function getFieldNames( $key ) { - if ( isset( self::$specialFields[$key] ) ) { - return self::$specialFields[$key]; - } - - return [ $key . '_text', substr( $key, 0, -5 ) . '_actor' ]; + return self::$specialFields[$key] ?? [ $key . '_text', substr( $key, 0, -5 ) . '_actor' ]; } /** diff --git a/includes/MagicWordArray.php b/includes/MagicWordArray.php index fde32ce4fd6..707c644a8d0 100644 --- a/includes/MagicWordArray.php +++ b/includes/MagicWordArray.php @@ -268,10 +268,7 @@ class MagicWordArray { return $hash[1][$text]; } $lc = $this->factory->getContentLanguage()->lc( $text ); - if ( isset( $hash[0][$lc] ) ) { - return $hash[0][$lc]; - } - return false; + return $hash[0][$lc] ?? false; } /** diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php index e03352554b8..bff9fd00956 100644 --- a/includes/api/ApiFormatBase.php +++ b/includes/api/ApiFormatBase.php @@ -158,11 +158,9 @@ abstract class ApiFormatBase extends ApiBase { if ( !is_array( $paramSettings ) ) { return $paramSettings; - } elseif ( isset( $paramSettings[self::PARAM_DFLT] ) ) { - return $paramSettings[self::PARAM_DFLT]; - } else { - return null; } + + return $paramSettings[self::PARAM_DFLT] ?? null; } /** diff --git a/includes/config/ConfigRepository.php b/includes/config/ConfigRepository.php index 96dc51c118d..2874c334f4c 100644 --- a/includes/config/ConfigRepository.php +++ b/includes/config/ConfigRepository.php @@ -71,10 +71,8 @@ class ConfigRepository implements SalvageableService { if ( !$this->has( $name, true ) ) { throw new \ConfigException( 'The configuration option ' . $name . ' does not exist.' ); } - if ( isset( $this->configItems['public'][$name] ) ) { - return $this->configItems['public'][$name]; - } - return $this->configItems['private'][$name]; + + return $this->configItems['public'][$name] ?? $this->configItems['private'][$name]; } /** diff --git a/includes/filerepo/file/ForeignAPIFile.php b/includes/filerepo/file/ForeignAPIFile.php index c49810cfeb3..3a75720cdf3 100644 --- a/includes/filerepo/file/ForeignAPIFile.php +++ b/includes/filerepo/file/ForeignAPIFile.php @@ -184,11 +184,7 @@ class ForeignAPIFile extends File { * null on error */ public function getExtendedMetadata() { - if ( isset( $this->mInfo['extmetadata'] ) ) { - return $this->mInfo['extmetadata']; - } - - return null; + return $this->mInfo['extmetadata'] ?? null; } /** diff --git a/includes/media/MediaHandlerFactory.php b/includes/media/MediaHandlerFactory.php index 543dc80dfd7..82e8d1ffc2f 100644 --- a/includes/media/MediaHandlerFactory.php +++ b/includes/media/MediaHandlerFactory.php @@ -66,11 +66,7 @@ class MediaHandlerFactory { } protected function getHandlerClass( $type ) { - if ( isset( $this->registry[$type] ) ) { - return $this->registry[$type]; - } else { - return false; - } + return $this->registry[$type] ?? false; } /** diff --git a/tests/parser/ParserTestRunner.php b/tests/parser/ParserTestRunner.php index 699de951b60..1c93261a86f 100644 --- a/tests/parser/ParserTestRunner.php +++ b/tests/parser/ParserTestRunner.php @@ -938,12 +938,7 @@ class ParserTestRunner { */ private static function getOptionValue( $key, $opts, $default ) { $key = strtolower( $key ); - - if ( isset( $opts[$key] ) ) { - return $opts[$key]; - } else { - return $default; - } + return $opts[$key] ?? $default; } /**