From 813c41cef857dce60e77e390308aef84ab1436e3 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Thu, 29 Apr 2021 14:53:40 +0200 Subject: [PATCH] Use null coalescing operator wherever possible These changes were not done manually but by using IDE actions. --- .../lib/acp/form/AbstractAcpForm.class.php | 6 +----- .../lib/data/bbcode/BBCodeCache.class.php | 6 +----- .../label/group/ViewableLabelGroup.class.php | 6 +----- .../files/lib/data/menu/MenuCache.class.php | 12 ++---------- .../data/object/type/ObjectTypeCache.class.php | 18 +++--------------- .../lib/data/package/PackageCache.class.php | 12 ++---------- .../files/lib/data/page/PageCache.class.php | 6 +----- .../reaction/type/ReactionTypeCache.class.php | 6 +----- .../lib/data/smiley/SmileyCache.class.php | 6 +----- .../lib/data/trophy/TrophyCache.class.php | 6 +----- .../category/TrophyCategoryCache.class.php | 6 +----- .../lib/data/user/group/UserGroup.class.php | 6 +----- .../install/files/lib/system/WCF.class.php | 12 ++---------- .../files/lib/system/acl/ACLHandler.class.php | 6 +----- .../AbstractAttachmentObjectType.class.php | 6 +----- .../files/lib/system/box/BoxHandler.class.php | 18 +++--------------- .../system/captcha/CaptchaHandler.class.php | 6 +----- .../category/AbstractCategoryType.class.php | 6 +----- .../system/category/CategoryHandler.class.php | 12 ++---------- .../clipboard/ClipboardHandler.class.php | 12 ++---------- .../system/comment/CommentHandler.class.php | 12 ++---------- .../lib/system/label/LabelHandler.class.php | 6 +----- .../system/language/LanguageFactory.class.php | 6 +----- .../message/quote/QuotedMessage.class.php | 6 +----- .../system/package/PackageArchive.class.php | 18 +++--------------- .../PackageValidationManager.class.php | 6 +----- .../system/reaction/ReactionHandler.class.php | 6 +----- .../system/registry/RegistryHandler.class.php | 6 +----- .../lib/system/search/ArticleSearch.class.php | 6 +----- .../lib/system/search/PageSearch.class.php | 6 +----- .../lib/system/search/SearchEngine.class.php | 6 +----- .../event/UserActivityEventHandler.class.php | 12 ++---------- .../point/UserActivityPointHandler.class.php | 6 +----- .../UserCollapsibleContentHandler.class.php | 6 +----- .../UserNotificationHandler.class.php | 6 +----- 35 files changed, 48 insertions(+), 240 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/form/AbstractAcpForm.class.php b/wcfsetup/install/files/lib/acp/form/AbstractAcpForm.class.php index 6339abc972..70293f0006 100644 --- a/wcfsetup/install/files/lib/acp/form/AbstractAcpForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/AbstractAcpForm.class.php @@ -60,11 +60,7 @@ abstract class AbstractAcpForm extends AbstractForm */ public function getI18nValue($fieldName) { - if (isset($this->i18nValues[$fieldName])) { - return $this->i18nValues[$fieldName]; - } - - return null; + return $this->i18nValues[$fieldName] ?? null; } /** diff --git a/wcfsetup/install/files/lib/data/bbcode/BBCodeCache.class.php b/wcfsetup/install/files/lib/data/bbcode/BBCodeCache.class.php index 8c0912ad84..d9e6c38c52 100644 --- a/wcfsetup/install/files/lib/data/bbcode/BBCodeCache.class.php +++ b/wcfsetup/install/files/lib/data/bbcode/BBCodeCache.class.php @@ -56,11 +56,7 @@ class BBCodeCache extends SingletonFactory */ public function getBBCodeByTag($tag) { - if (isset($this->cachedBBCodes[$tag])) { - return $this->cachedBBCodes[$tag]; - } - - return null; + return $this->cachedBBCodes[$tag] ?? null; } /** diff --git a/wcfsetup/install/files/lib/data/label/group/ViewableLabelGroup.class.php b/wcfsetup/install/files/lib/data/label/group/ViewableLabelGroup.class.php index e0119da00d..136796f8f9 100644 --- a/wcfsetup/install/files/lib/data/label/group/ViewableLabelGroup.class.php +++ b/wcfsetup/install/files/lib/data/label/group/ViewableLabelGroup.class.php @@ -165,11 +165,7 @@ class ViewableLabelGroup extends DatabaseObjectDecorator implements \Countable, */ public function getLabel($labelID) { - if (isset($this->labels[$labelID])) { - return $this->labels[$labelID]; - } - - return null; + return $this->labels[$labelID] ?? null; } /** diff --git a/wcfsetup/install/files/lib/data/menu/MenuCache.class.php b/wcfsetup/install/files/lib/data/menu/MenuCache.class.php index d462d21017..822ec3d980 100644 --- a/wcfsetup/install/files/lib/data/menu/MenuCache.class.php +++ b/wcfsetup/install/files/lib/data/menu/MenuCache.class.php @@ -44,11 +44,7 @@ class MenuCache extends SingletonFactory */ public function getMenuByID($menuID) { - if (isset($this->cachedMenus[$menuID])) { - return $this->cachedMenus[$menuID]; - } - - return null; + return $this->cachedMenus[$menuID] ?? null; } /** @@ -59,11 +55,7 @@ class MenuCache extends SingletonFactory */ public function getMenuItemsByMenuID($menuID) { - if (isset($this->cachedMenuItems[$menuID])) { - return $this->cachedMenuItems[$menuID]; - } - - return null; + return $this->cachedMenuItems[$menuID] ?? null; } /** diff --git a/wcfsetup/install/files/lib/data/object/type/ObjectTypeCache.class.php b/wcfsetup/install/files/lib/data/object/type/ObjectTypeCache.class.php index 45afbfcf14..550f009da0 100644 --- a/wcfsetup/install/files/lib/data/object/type/ObjectTypeCache.class.php +++ b/wcfsetup/install/files/lib/data/object/type/ObjectTypeCache.class.php @@ -72,11 +72,7 @@ class ObjectTypeCache extends SingletonFactory */ public function getDefinition($definitionID) { - if (isset($this->definitions[$definitionID])) { - return $this->definitions[$definitionID]; - } - - return null; + return $this->definitions[$definitionID] ?? null; } /** @@ -88,11 +84,7 @@ class ObjectTypeCache extends SingletonFactory */ public function getDefinitionByName($definitionName) { - if (isset($this->definitionsByName[$definitionName])) { - return $this->definitionsByName[$definitionName]; - } - - return null; + return $this->definitionsByName[$definitionName] ?? null; } /** @@ -125,11 +117,7 @@ class ObjectTypeCache extends SingletonFactory */ public function getObjectType($objectTypeID) { - if (isset($this->objectTypes[$objectTypeID])) { - return $this->objectTypes[$objectTypeID]; - } - - return null; + return $this->objectTypes[$objectTypeID] ?? null; } /** diff --git a/wcfsetup/install/files/lib/data/package/PackageCache.class.php b/wcfsetup/install/files/lib/data/package/PackageCache.class.php index 9532be69d9..b2652c877b 100644 --- a/wcfsetup/install/files/lib/data/package/PackageCache.class.php +++ b/wcfsetup/install/files/lib/data/package/PackageCache.class.php @@ -37,11 +37,7 @@ class PackageCache extends SingletonFactory */ public function getPackage($packageID) { - if (isset($this->packages['packages'][$packageID])) { - return $this->packages['packages'][$packageID]; - } - - return null; + return $this->packages['packages'][$packageID] ?? null; } /** @@ -52,11 +48,7 @@ class PackageCache extends SingletonFactory */ public function getPackageID($package) { - if (isset($this->packages['packageIDs'][$package])) { - return $this->packages['packageIDs'][$package]; - } - - return null; + return $this->packages['packageIDs'][$package] ?? null; } /** diff --git a/wcfsetup/install/files/lib/data/page/PageCache.class.php b/wcfsetup/install/files/lib/data/page/PageCache.class.php index 74cab579c6..104ddf487a 100644 --- a/wcfsetup/install/files/lib/data/page/PageCache.class.php +++ b/wcfsetup/install/files/lib/data/page/PageCache.class.php @@ -49,11 +49,7 @@ class PageCache extends SingletonFactory */ public function getPage($pageID) { - if (isset($this->cache['pages'][$pageID])) { - return $this->cache['pages'][$pageID]; - } - - return null; + return $this->cache['pages'][$pageID] ?? null; } /** diff --git a/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeCache.class.php b/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeCache.class.php index cd2143e147..35060ddf06 100644 --- a/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeCache.class.php +++ b/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeCache.class.php @@ -38,11 +38,7 @@ class ReactionTypeCache extends SingletonFactory */ public function getReactionTypeByID($reactionTypeID) { - if (isset($this->reactionTypes[$reactionTypeID])) { - return $this->reactionTypes[$reactionTypeID]; - } - - return null; + return $this->reactionTypes[$reactionTypeID] ?? null; } /** diff --git a/wcfsetup/install/files/lib/data/smiley/SmileyCache.class.php b/wcfsetup/install/files/lib/data/smiley/SmileyCache.class.php index dc7a144c5b..e8349fc08b 100644 --- a/wcfsetup/install/files/lib/data/smiley/SmileyCache.class.php +++ b/wcfsetup/install/files/lib/data/smiley/SmileyCache.class.php @@ -85,11 +85,7 @@ class SmileyCache extends SingletonFactory */ public function getSmileyByCode($code) { - if (isset($this->cachedSmileyByCode[$code])) { - return $this->cachedSmileyByCode[$code]; - } - - return null; + return $this->cachedSmileyByCode[$code] ?? null; } /** diff --git a/wcfsetup/install/files/lib/data/trophy/TrophyCache.class.php b/wcfsetup/install/files/lib/data/trophy/TrophyCache.class.php index 3036386ba2..cde741f5e8 100644 --- a/wcfsetup/install/files/lib/data/trophy/TrophyCache.class.php +++ b/wcfsetup/install/files/lib/data/trophy/TrophyCache.class.php @@ -51,11 +51,7 @@ class TrophyCache extends SingletonFactory */ public function getTrophyByID($trophyID) { - if (isset($this->trophies[$trophyID])) { - return $this->trophies[$trophyID]; - } - - return null; + return $this->trophies[$trophyID] ?? null; } /** diff --git a/wcfsetup/install/files/lib/data/trophy/category/TrophyCategoryCache.class.php b/wcfsetup/install/files/lib/data/trophy/category/TrophyCategoryCache.class.php index 087b451309..222d081b60 100644 --- a/wcfsetup/install/files/lib/data/trophy/category/TrophyCategoryCache.class.php +++ b/wcfsetup/install/files/lib/data/trophy/category/TrophyCategoryCache.class.php @@ -55,11 +55,7 @@ class TrophyCategoryCache extends SingletonFactory */ public function getCategoryByID($categoryID) { - if (isset($this->categories[$categoryID])) { - return $this->categories[$categoryID]; - } - - return null; + return $this->categories[$categoryID] ?? null; } /** diff --git a/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php b/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php index 83a0280fcd..a8220855eb 100644 --- a/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php +++ b/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php @@ -182,11 +182,7 @@ class UserGroup extends DatabaseObject implements ITitledObject { self::getCache(); - if (isset(self::$cache['groups'][$groupID])) { - return self::$cache['groups'][$groupID]; - } - - return null; + return self::$cache['groups'][$groupID] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index 653a33fc24..c8bbf4a9c6 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -747,11 +747,7 @@ class WCF */ public static function getApplicationObject(Application $application) { - if (isset(self::$applicationObjects[$application->packageID])) { - return self::$applicationObjects[$application->packageID]; - } - - return null; + return self::$applicationObjects[$application->packageID] ?? null; } /** @@ -955,11 +951,7 @@ class WCF */ final protected static function getCoreObject($className) { - if (isset(self::$coreObjectCache[$className])) { - return self::$coreObjectCache[$className]; - } - - return null; + return self::$coreObjectCache[$className] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/acl/ACLHandler.class.php b/wcfsetup/install/files/lib/system/acl/ACLHandler.class.php index 88ba131053..07b5a4df9f 100644 --- a/wcfsetup/install/files/lib/system/acl/ACLHandler.class.php +++ b/wcfsetup/install/files/lib/system/acl/ACLHandler.class.php @@ -218,11 +218,7 @@ class ACLHandler extends SingletonFactory */ public function getCategory($objectTypeID, $categoryName) { - if (isset($this->categories[$objectTypeID][$categoryName])) { - return $this->categories[$objectTypeID][$categoryName]; - } - - return null; + return $this->categories[$objectTypeID][$categoryName] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/attachment/AbstractAttachmentObjectType.class.php b/wcfsetup/install/files/lib/system/attachment/AbstractAttachmentObjectType.class.php index dc60d79afe..3b359f93e8 100644 --- a/wcfsetup/install/files/lib/system/attachment/AbstractAttachmentObjectType.class.php +++ b/wcfsetup/install/files/lib/system/attachment/AbstractAttachmentObjectType.class.php @@ -59,11 +59,7 @@ abstract class AbstractAttachmentObjectType implements IAttachmentObjectType */ public function getObject($objectID) { - if (isset($this->cachedObjects[$objectID])) { - return $this->cachedObjects[$objectID]; - } - - return null; + return $this->cachedObjects[$objectID] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/box/BoxHandler.class.php b/wcfsetup/install/files/lib/system/box/BoxHandler.class.php index feb742c27e..410b71deb5 100644 --- a/wcfsetup/install/files/lib/system/box/BoxHandler.class.php +++ b/wcfsetup/install/files/lib/system/box/BoxHandler.class.php @@ -117,11 +117,7 @@ class BoxHandler extends SingletonFactory */ public function getBox($boxID) { - if (isset($this->boxes[$boxID])) { - return $this->boxes[$boxID]; - } - - return null; + return $this->boxes[$boxID] ?? null; } /** @@ -132,11 +128,7 @@ class BoxHandler extends SingletonFactory */ public function getBoxes($position) { - if (isset($this->boxesByPosition[$position])) { - return $this->boxesByPosition[$position]; - } - - return []; + return $this->boxesByPosition[$position] ?? []; } /** @@ -147,11 +139,7 @@ class BoxHandler extends SingletonFactory */ public function getBoxByIdentifier($identifier) { - if (isset($this->boxesByIdentifier[$identifier])) { - return $this->boxesByIdentifier[$identifier]; - } - - return null; + return $this->boxesByIdentifier[$identifier] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/captcha/CaptchaHandler.class.php b/wcfsetup/install/files/lib/system/captcha/CaptchaHandler.class.php index 7bbd381236..66ccf8dbcc 100644 --- a/wcfsetup/install/files/lib/system/captcha/CaptchaHandler.class.php +++ b/wcfsetup/install/files/lib/system/captcha/CaptchaHandler.class.php @@ -49,11 +49,7 @@ class CaptchaHandler extends SingletonFactory */ public function getObjectType($objectTypeID) { - if (isset($this->objectTypes[$objectTypeID])) { - return $this->objectTypes[$objectTypeID]; - } - - return null; + return $this->objectTypes[$objectTypeID] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/category/AbstractCategoryType.class.php b/wcfsetup/install/files/lib/system/category/AbstractCategoryType.class.php index b530e13af7..9fa53b4cab 100644 --- a/wcfsetup/install/files/lib/system/category/AbstractCategoryType.class.php +++ b/wcfsetup/install/files/lib/system/category/AbstractCategoryType.class.php @@ -142,11 +142,7 @@ abstract class AbstractCategoryType extends SingletonFactory implements ICategor */ public function getObjectTypeName($definitionName) { - if (isset($this->objectTypes[$definitionName])) { - return $this->objectTypes[$definitionName]; - } - - return null; + return $this->objectTypes[$definitionName] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/category/CategoryHandler.class.php b/wcfsetup/install/files/lib/system/category/CategoryHandler.class.php index 82ac329d53..bf6f5dc616 100644 --- a/wcfsetup/install/files/lib/system/category/CategoryHandler.class.php +++ b/wcfsetup/install/files/lib/system/category/CategoryHandler.class.php @@ -74,11 +74,7 @@ class CategoryHandler extends SingletonFactory */ public function getCategory($categoryID) { - if (isset($this->categories[$categoryID])) { - return $this->categories[$categoryID]; - } - - return null; + return $this->categories[$categoryID] ?? null; } /** @@ -133,11 +129,7 @@ class CategoryHandler extends SingletonFactory */ public function getObjectTypeByName($objectType) { - if (isset($this->objectTypes[$objectType])) { - return $this->objectTypes[$objectType]; - } - - return null; + return $this->objectTypes[$objectType] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/clipboard/ClipboardHandler.class.php b/wcfsetup/install/files/lib/system/clipboard/ClipboardHandler.class.php index b29aa0e064..d6485d62e8 100644 --- a/wcfsetup/install/files/lib/system/clipboard/ClipboardHandler.class.php +++ b/wcfsetup/install/files/lib/system/clipboard/ClipboardHandler.class.php @@ -160,11 +160,7 @@ class ClipboardHandler extends SingletonFactory */ public function getObjectTypeID($typeName) { - if (isset($this->cache['objectTypeNames'][$typeName])) { - return $this->cache['objectTypeNames'][$typeName]; - } - - return null; + return $this->cache['objectTypeNames'][$typeName] ?? null; } /** @@ -176,11 +172,7 @@ class ClipboardHandler extends SingletonFactory */ public function getObjectType($objectTypeID) { - if (isset($this->cache['objectTypes'][$objectTypeID])) { - return $this->cache['objectTypes'][$objectTypeID]; - } - - return null; + return $this->cache['objectTypes'][$objectTypeID] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/comment/CommentHandler.class.php b/wcfsetup/install/files/lib/system/comment/CommentHandler.class.php index 8a88783b15..8d62ed74a2 100644 --- a/wcfsetup/install/files/lib/system/comment/CommentHandler.class.php +++ b/wcfsetup/install/files/lib/system/comment/CommentHandler.class.php @@ -65,11 +65,7 @@ class CommentHandler extends SingletonFactory */ public function getObjectTypeID($objectType) { - if (isset($this->cache['objectTypeIDs'][$objectType])) { - return $this->cache['objectTypeIDs'][$objectType]; - } - - return null; + return $this->cache['objectTypeIDs'][$objectType] ?? null; } /** @@ -81,11 +77,7 @@ class CommentHandler extends SingletonFactory */ public function getObjectType($objectTypeID) { - if (isset($this->cache['objectTypes'][$objectTypeID])) { - return $this->cache['objectTypes'][$objectTypeID]; - } - - return null; + return $this->cache['objectTypes'][$objectTypeID] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/label/LabelHandler.class.php b/wcfsetup/install/files/lib/system/label/LabelHandler.class.php index 43e5531b6e..7b25ba19f4 100644 --- a/wcfsetup/install/files/lib/system/label/LabelHandler.class.php +++ b/wcfsetup/install/files/lib/system/label/LabelHandler.class.php @@ -407,11 +407,7 @@ class LabelHandler extends SingletonFactory */ public function getLabelGroup($groupID) { - if (isset($this->labelGroups['groups'][$groupID])) { - return $this->labelGroups['groups'][$groupID]; - } - - return null; + return $this->labelGroups['groups'][$groupID] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/language/LanguageFactory.class.php b/wcfsetup/install/files/lib/system/language/LanguageFactory.class.php index d45046780b..e9613aaabf 100644 --- a/wcfsetup/install/files/lib/system/language/LanguageFactory.class.php +++ b/wcfsetup/install/files/lib/system/language/LanguageFactory.class.php @@ -131,11 +131,7 @@ class LanguageFactory extends SingletonFactory */ public function getCategory($categoryName) { - if (isset($this->cache['categories'][$categoryName])) { - return $this->cache['categories'][$categoryName]; - } - - return null; + return $this->cache['categories'][$categoryName] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/message/quote/QuotedMessage.class.php b/wcfsetup/install/files/lib/system/message/quote/QuotedMessage.class.php index 21e56477ce..94f3cf87ef 100644 --- a/wcfsetup/install/files/lib/system/message/quote/QuotedMessage.class.php +++ b/wcfsetup/install/files/lib/system/message/quote/QuotedMessage.class.php @@ -134,11 +134,7 @@ class QuotedMessage implements \Countable, \Iterator */ public function getFullQuote($quoteID) { - if (isset($this->fullQuotes[$quoteID])) { - return $this->fullQuotes[$quoteID]; - } - - return null; + return $this->fullQuotes[$quoteID] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/package/PackageArchive.class.php b/wcfsetup/install/files/lib/system/package/PackageArchive.class.php index 36c865c853..b5cfaa341a 100644 --- a/wcfsetup/install/files/lib/system/package/PackageArchive.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageArchive.class.php @@ -596,11 +596,7 @@ class PackageArchive */ public function getAuthorInfo($name) { - if (isset($this->authorInfo[$name])) { - return $this->authorInfo[$name]; - } - - return null; + return $this->authorInfo[$name] ?? null; } /** @@ -611,11 +607,7 @@ class PackageArchive */ public function getPackageInfo($name) { - if (isset($this->packageInfo[$name])) { - return $this->packageInfo[$name]; - } - - return null; + return $this->packageInfo[$name] ?? null; } /** @@ -987,11 +979,7 @@ class PackageArchive */ public function getInstructions($type) { - if (isset($this->instructions[$type])) { - return $this->instructions[$type]; - } - - return null; + return $this->instructions[$type] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/package/validation/PackageValidationManager.class.php b/wcfsetup/install/files/lib/system/package/validation/PackageValidationManager.class.php index 4321bdc0c6..8c56c8221e 100644 --- a/wcfsetup/install/files/lib/system/package/validation/PackageValidationManager.class.php +++ b/wcfsetup/install/files/lib/system/package/validation/PackageValidationManager.class.php @@ -130,11 +130,7 @@ class PackageValidationManager extends SingletonFactory */ public function getVirtualPackage($package) { - if (isset($this->virtualPackageList[$package])) { - return $this->virtualPackageList[$package]; - } - - return null; + return $this->virtualPackageList[$package] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/reaction/ReactionHandler.class.php b/wcfsetup/install/files/lib/system/reaction/ReactionHandler.class.php index 8154770f02..c0394173ea 100644 --- a/wcfsetup/install/files/lib/system/reaction/ReactionHandler.class.php +++ b/wcfsetup/install/files/lib/system/reaction/ReactionHandler.class.php @@ -215,11 +215,7 @@ class ReactionHandler extends SingletonFactory */ public function getObjectType($objectName) { - if (isset($this->cache[$objectName])) { - return $this->cache[$objectName]; - } - - return null; + return $this->cache[$objectName] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/registry/RegistryHandler.class.php b/wcfsetup/install/files/lib/system/registry/RegistryHandler.class.php index e2a041a704..e6f1921694 100644 --- a/wcfsetup/install/files/lib/system/registry/RegistryHandler.class.php +++ b/wcfsetup/install/files/lib/system/registry/RegistryHandler.class.php @@ -88,11 +88,7 @@ class RegistryHandler extends SingletonFactory $this->loadStorage([$package]); } - if (isset($this->cache[$packageID][$field])) { - return $this->cache[$packageID][$field]; - } - - return null; + return $this->cache[$packageID][$field] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/search/ArticleSearch.class.php b/wcfsetup/install/files/lib/system/search/ArticleSearch.class.php index 5788b29b94..9b9592ef11 100644 --- a/wcfsetup/install/files/lib/system/search/ArticleSearch.class.php +++ b/wcfsetup/install/files/lib/system/search/ArticleSearch.class.php @@ -56,11 +56,7 @@ class ArticleSearch extends AbstractSearchableObjectType */ public function getObject($objectID) { - if (isset($this->messageCache[$objectID])) { - return $this->messageCache[$objectID]; - } - - return null; + return $this->messageCache[$objectID] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/search/PageSearch.class.php b/wcfsetup/install/files/lib/system/search/PageSearch.class.php index 1dcd4b2fc2..d73adc8e7e 100644 --- a/wcfsetup/install/files/lib/system/search/PageSearch.class.php +++ b/wcfsetup/install/files/lib/system/search/PageSearch.class.php @@ -44,11 +44,7 @@ class PageSearch extends AbstractSearchableObjectType */ public function getObject($objectID) { - if (isset($this->messageCache[$objectID])) { - return $this->messageCache[$objectID]; - } - - return null; + return $this->messageCache[$objectID] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/search/SearchEngine.class.php b/wcfsetup/install/files/lib/system/search/SearchEngine.class.php index 85f990fcd0..7dcf1e4578 100644 --- a/wcfsetup/install/files/lib/system/search/SearchEngine.class.php +++ b/wcfsetup/install/files/lib/system/search/SearchEngine.class.php @@ -69,11 +69,7 @@ class SearchEngine extends SingletonFactory implements ISearchEngine */ public function getObjectType($objectTypeName) { - if (isset($this->availableObjectTypes[$objectTypeName])) { - return $this->availableObjectTypes[$objectTypeName]; - } - - return null; + return $this->availableObjectTypes[$objectTypeName] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/user/activity/event/UserActivityEventHandler.class.php b/wcfsetup/install/files/lib/system/user/activity/event/UserActivityEventHandler.class.php index 079592654e..6c33682436 100644 --- a/wcfsetup/install/files/lib/system/user/activity/event/UserActivityEventHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/activity/event/UserActivityEventHandler.class.php @@ -48,11 +48,7 @@ class UserActivityEventHandler extends SingletonFactory */ public function getObjectType($objectTypeID) { - if (isset($this->objectTypes['objects'][$objectTypeID])) { - return $this->objectTypes['objects'][$objectTypeID]; - } - - return null; + return $this->objectTypes['objects'][$objectTypeID] ?? null; } /** @@ -63,11 +59,7 @@ class UserActivityEventHandler extends SingletonFactory */ public function getObjectTypeID($objectType) { - if (isset($this->objectTypes['names'][$objectType])) { - return $this->objectTypes['names'][$objectType]; - } - - return null; + return $this->objectTypes['names'][$objectType] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/user/activity/point/UserActivityPointHandler.class.php b/wcfsetup/install/files/lib/system/user/activity/point/UserActivityPointHandler.class.php index 04c60b9f2a..e379c843a6 100644 --- a/wcfsetup/install/files/lib/system/user/activity/point/UserActivityPointHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/activity/point/UserActivityPointHandler.class.php @@ -271,11 +271,7 @@ class UserActivityPointHandler extends SingletonFactory */ public function getObjectTypeByName($objectType) { - if (isset($this->objectTypes[$objectType])) { - return $this->objectTypes[$objectType]; - } - - return null; + return $this->objectTypes[$objectType] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/user/collapsible/content/UserCollapsibleContentHandler.class.php b/wcfsetup/install/files/lib/system/user/collapsible/content/UserCollapsibleContentHandler.class.php index 051aac39c1..a980bb7ade 100644 --- a/wcfsetup/install/files/lib/system/user/collapsible/content/UserCollapsibleContentHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/collapsible/content/UserCollapsibleContentHandler.class.php @@ -75,11 +75,7 @@ class UserCollapsibleContentHandler extends SingletonFactory */ public function getObjectTypeID($objectType) { - if (isset($this->cache['objectTypeIDs'][$objectType])) { - return $this->cache['objectTypeIDs'][$objectType]; - } - - return null; + return $this->cache['objectTypeIDs'][$objectType] ?? null; } /** diff --git a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php index 9d36c6e0e5..4815467892 100644 --- a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php @@ -703,11 +703,7 @@ class UserNotificationHandler extends SingletonFactory */ public function getObjectTypeProcessor($objectType) { - if (isset($this->availableObjectTypes[$objectType])) { - return $this->availableObjectTypes[$objectType]; - } - - return null; + return $this->availableObjectTypes[$objectType] ?? null; } /** -- 2.20.1