From: Matthias Schmidt Date: Sun, 2 Oct 2016 11:32:46 +0000 (+0200) Subject: Improve code for better code analysis by IDE X-Git-Tag: 3.0.0_Beta_2~20 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3b13d4ea809b64a0f0f73477fff286db54f135dd;p=GitHub%2FWoltLab%2FWCF.git Improve code for better code analysis by IDE --- diff --git a/wcfsetup/install/files/lib/acp/form/MenuItemEditForm.class.php b/wcfsetup/install/files/lib/acp/form/MenuItemEditForm.class.php index 3ee433fdbe..5cf00f6875 100644 --- a/wcfsetup/install/files/lib/acp/form/MenuItemEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/MenuItemEditForm.class.php @@ -27,10 +27,10 @@ class MenuItemEditForm extends MenuItemAddForm { public $itemID = 0; /** - * menu object - * @var Menu + * menu item object + * @var MenuItem */ - public $menuItem = null; + public $menuItem; /** * @inheritDoc diff --git a/wcfsetup/install/files/lib/action/AJAXInvokeAction.class.php b/wcfsetup/install/files/lib/action/AJAXInvokeAction.class.php index 8fe16e2880..ff1674a5d0 100644 --- a/wcfsetup/install/files/lib/action/AJAXInvokeAction.class.php +++ b/wcfsetup/install/files/lib/action/AJAXInvokeAction.class.php @@ -136,6 +136,7 @@ class AJAXInvokeAction extends AbstractSecureAction { // validate accessibility $className = $this->className; + /** @noinspection PhpUndefinedFieldInspection */ if (!property_exists($className, 'allowInvoke') || !in_array($this->actionName, $className::$allowInvoke)) { throw new PermissionDeniedException(); } diff --git a/wcfsetup/install/files/lib/data/IFile.class.php b/wcfsetup/install/files/lib/data/IFile.class.php index 3edaa128d0..02399e43e3 100644 --- a/wcfsetup/install/files/lib/data/IFile.class.php +++ b/wcfsetup/install/files/lib/data/IFile.class.php @@ -9,6 +9,11 @@ namespace wcf\data; * @license GNU Lesser General Public License * @package WoltLabSuite\Core\Data * @since 3.0 + * + * @property-read string $fileType type of the physical attachment file + * @property-read integer $isImage is `1` if the file is an image, otherwise `0` + * @property-read integer $width width of the file if `$isImage` is `1`, otherwise `0` + * @property-read integer $height height of the file if `$isImage` is `1`, otherwise `0` */ interface IFile extends IStorableObject { /** diff --git a/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php b/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php index 8e8b2c8ff0..5be8905821 100644 --- a/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php +++ b/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php @@ -143,6 +143,8 @@ class AttachmentAction extends AbstractDatabaseObjectAction implements ISortable /** @noinspection PhpUndefinedMethodInspection */ $this->parameters['__files']->saveFiles($saveStrategy); + + /** @var Attachment[] $attachments */ $attachments = $saveStrategy->getObjects(); // return result diff --git a/wcfsetup/install/files/lib/data/language/LanguageEditor.class.php b/wcfsetup/install/files/lib/data/language/LanguageEditor.class.php index 5250eccb1d..821536abcd 100644 --- a/wcfsetup/install/files/lib/data/language/LanguageEditor.class.php +++ b/wcfsetup/install/files/lib/data/language/LanguageEditor.class.php @@ -212,6 +212,7 @@ class LanguageEditor extends DatabaseObjectEditor implements IEditableCachedObje foreach ($usedCategories as $categoryName => $categoryID) { if ($categoryID) continue; + /** @var LanguageCategory $category */ $category = LanguageCategoryEditor::create([ 'languageCategory' => $categoryName ]); diff --git a/wcfsetup/install/files/lib/data/media/ViewableMedia.class.php b/wcfsetup/install/files/lib/data/media/ViewableMedia.class.php index 2284104177..38c4b5e11a 100644 --- a/wcfsetup/install/files/lib/data/media/ViewableMedia.class.php +++ b/wcfsetup/install/files/lib/data/media/ViewableMedia.class.php @@ -17,7 +17,7 @@ use wcf\util\StringUtil; * @method Media getDecoratedObject() * @mixin Media * @property-read string|null $title title of the media file in the active user's language or `null` if object has not been fetched via `ViewableMediaList` - * @property-read string|null $description description of the media file in the active user's language or `null` if object has not been fetched via `ViewableMediaList` + * @property-read string|null $caption caption of the media file in the active user's language or `null` if object has not been fetched via `ViewableMediaList` * @property-read string|null $altText alternative text of the media file in the active user's language or `null` if object has not been fetched via `ViewableMediaList` */ class ViewableMedia extends DatabaseObjectDecorator { diff --git a/wcfsetup/install/files/lib/data/moderation/queue/ViewableModerationQueue.class.php b/wcfsetup/install/files/lib/data/moderation/queue/ViewableModerationQueue.class.php index 41a18f097b..c50383898d 100644 --- a/wcfsetup/install/files/lib/data/moderation/queue/ViewableModerationQueue.class.php +++ b/wcfsetup/install/files/lib/data/moderation/queue/ViewableModerationQueue.class.php @@ -186,6 +186,7 @@ class ViewableModerationQueue extends DatabaseObjectDecorator implements ILinkab public function getLabel() { $definition = ObjectTypeCache::getInstance()->getDefinition(ObjectTypeCache::getInstance()->getObjectType($this->objectTypeID)->definitionID); + /** @noinspection PhpUndefinedFieldInspection */ if ($definition->definitionName == 'com.woltlab.wcf.moderation.activation' && $this->getAffectedObject()->enableTime) { return WCF::getLanguage()->get('wcf.moderation.type.com.woltlab.wcf.moderation.activation.delayed'); } diff --git a/wcfsetup/install/files/lib/data/tag/TagCloudTag.class.php b/wcfsetup/install/files/lib/data/tag/TagCloudTag.class.php index a91d461b97..66fbc371c2 100644 --- a/wcfsetup/install/files/lib/data/tag/TagCloudTag.class.php +++ b/wcfsetup/install/files/lib/data/tag/TagCloudTag.class.php @@ -12,6 +12,8 @@ use wcf\data\DatabaseObjectDecorator; * * @method Tag getDecoratedObject() * @mixin Tag + * + * @property-read integer|null $counter number of the times the tag has been used for a certain object type or `null` */ class TagCloudTag extends DatabaseObjectDecorator { /** diff --git a/wcfsetup/install/files/lib/data/user/group/option/UserGroupOption.class.php b/wcfsetup/install/files/lib/data/user/group/option/UserGroupOption.class.php index ad233c6d4f..90f6ab250e 100644 --- a/wcfsetup/install/files/lib/data/user/group/option/UserGroupOption.class.php +++ b/wcfsetup/install/files/lib/data/user/group/option/UserGroupOption.class.php @@ -9,7 +9,8 @@ use wcf\data\option\Option; * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package WoltLabSuite\Core\Data\User\Group\Option - * + * + * @property-read string $defaultValue default value of the user option * @property-read integer $usersOnly is `1` if the option only applies to user groups for registered users, otherwise `1` */ class UserGroupOption extends Option { diff --git a/wcfsetup/install/files/lib/data/user/option/UserOption.class.php b/wcfsetup/install/files/lib/data/user/option/UserOption.class.php index b67e16fb95..d25c708c09 100644 --- a/wcfsetup/install/files/lib/data/user/option/UserOption.class.php +++ b/wcfsetup/install/files/lib/data/user/option/UserOption.class.php @@ -12,6 +12,7 @@ use wcf\system\WCF; * @license GNU Lesser General Public License * @package WoltLabSuite\Core\Data\User\Option * + * @property-read string $defaultValue default value of the user option * @property-read integer $required is `1` if the user option has to be filled out, otherwise `0` * @property-read integer $askDuringRegistration is `1` if the user option will be shown during registration to be filled out, otherwise `0` * @property-read integer $editable setting for who can edit the user option, see `UserOption::EDITABILITY_*` constants diff --git a/wcfsetup/install/files/lib/form/SearchForm.class.php b/wcfsetup/install/files/lib/form/SearchForm.class.php index 8fcb1f7462..7cd697e34d 100644 --- a/wcfsetup/install/files/lib/form/SearchForm.class.php +++ b/wcfsetup/install/files/lib/form/SearchForm.class.php @@ -379,6 +379,7 @@ class SearchForm extends AbstractCaptchaForm { $application = 'wcf'; if (count($this->selectedObjectTypes) == 1) { $objectType = SearchEngine::getInstance()->getObjectType(reset($this->selectedObjectTypes)); + /** @noinspection PhpUndefinedFieldInspection */ if ($tmp = ApplicationHandler::getInstance()->getAbbreviation($objectType->packageID)) { $application = $tmp; } diff --git a/wcfsetup/install/files/lib/page/UserPage.class.php b/wcfsetup/install/files/lib/page/UserPage.class.php index 2812931c00..7b45b97844 100644 --- a/wcfsetup/install/files/lib/page/UserPage.class.php +++ b/wcfsetup/install/files/lib/page/UserPage.class.php @@ -176,6 +176,7 @@ class UserPage extends AbstractPage { $editor->updateCounters(['profileHits' => 1]); // save visitor + /** @noinspection PhpUndefinedFieldInspection */ if (PROFILE_ENABLE_VISITORS && WCF::getUser()->userID && !WCF::getUser()->canViewOnlineStatus) { if (($visitor = UserProfileVisitor::getObject($this->user->userID, WCF::getUser()->userID)) !== null) { $editor = new UserProfileVisitorEditor($visitor); diff --git a/wcfsetup/install/files/lib/system/cache/builder/CategoryCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/CategoryCacheBuilder.class.php index 784f191c9c..d7821fdef6 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/CategoryCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/CategoryCacheBuilder.class.php @@ -26,11 +26,14 @@ class CategoryCacheBuilder extends AbstractCacheBuilder { 'objectTypeCategoryIDs' => [] ]; foreach ($list as $category) { - if (!isset($data['objectTypeCategoryIDs'][$category->objectType])) { - $data['objectTypeCategoryIDs'][$category->objectType] = []; + /** @noinspection PhpUndefinedFieldInspection */ + $objectType = $category->objectType; + + if (!isset($data['objectTypeCategoryIDs'][$objectType])) { + $data['objectTypeCategoryIDs'][$objectType] = []; } - $data['objectTypeCategoryIDs'][$category->objectType][] = $category->categoryID; + $data['objectTypeCategoryIDs'][$objectType][] = $category->categoryID; } return $data; diff --git a/wcfsetup/install/files/lib/system/cache/builder/OptionCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/OptionCacheBuilder.class.php index cb3160fd71..d0323dfd9a 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/OptionCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/OptionCacheBuilder.class.php @@ -63,6 +63,8 @@ class OptionCacheBuilder extends AbstractCacheBuilder { ORDER BY showOrder"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(); + + /** @var Option $option */ while ($option = $statement->fetchObject($this->optionClassName)) { $data['options'][$option->optionName] = $option; if (!isset($data['optionToCategories'][$option->categoryName])) { diff --git a/wcfsetup/install/files/lib/system/clipboard/ClipboardHandler.class.php b/wcfsetup/install/files/lib/system/clipboard/ClipboardHandler.class.php index 2f9111e530..ea0390390a 100644 --- a/wcfsetup/install/files/lib/system/clipboard/ClipboardHandler.class.php +++ b/wcfsetup/install/files/lib/system/clipboard/ClipboardHandler.class.php @@ -226,12 +226,14 @@ class ClipboardHandler extends SingletonFactory { } if (!isset($data[$objectType->objectType])) { - if ($objectType->listclassname == '') { + /** @noinspection PhpUndefinedFieldInspection */ + $listClassName = $objectType->listclassname; + if ($listClassName == '') { throw new SystemException("Missing list class for object type '".$objectType->objectType."'"); } $data[$objectType->objectType] = [ - 'className' => $objectType->listclassname, + 'className' => $listClassName, 'objectIDs' => [] ]; } diff --git a/wcfsetup/install/files/lib/system/condition/AbstractTimestampCondition.class.php b/wcfsetup/install/files/lib/system/condition/AbstractTimestampCondition.class.php index 041007a210..d96e78b9ec 100644 --- a/wcfsetup/install/files/lib/system/condition/AbstractTimestampCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/AbstractTimestampCondition.class.php @@ -172,11 +172,16 @@ HTML; * @inheritDoc */ public function setData(Condition $condition) { - if ($condition->endTime) { - $this->endTime = $condition->endTime; + /** @noinspection PhpUndefinedFieldInspection */ + $endTime = $condition->endTime; + if ($endTime) { + $this->endTime = $endTime; } - if ($condition->startTime) { - $this->startTime = $condition->startTime; + + /** @noinspection PhpUndefinedFieldInspection */ + $startTime = $condition->startTime; + if ($startTime) { + $this->startTime = $startTime; } } diff --git a/wcfsetup/install/files/lib/system/condition/DaysOfWeekCondition.class.php b/wcfsetup/install/files/lib/system/condition/DaysOfWeekCondition.class.php index 409929001e..2f6a84ce7e 100644 --- a/wcfsetup/install/files/lib/system/condition/DaysOfWeekCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/DaysOfWeekCondition.class.php @@ -49,6 +49,7 @@ class DaysOfWeekCondition extends AbstractMultiSelectCondition implements IConte $date = DateUtil::getDateTimeByTimestamp(TIME_NOW); $date->setTimezone(WCF::getUser()->getTimeZone()); + /** @noinspection PhpUndefinedFieldInspection */ return in_array($date->format('w'), $condition->daysOfWeek); } } diff --git a/wcfsetup/install/files/lib/system/condition/TimeCondition.class.php b/wcfsetup/install/files/lib/system/condition/TimeCondition.class.php index ea7ecb23db..5cd2c33ebc 100644 --- a/wcfsetup/install/files/lib/system/condition/TimeCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/TimeCondition.class.php @@ -130,14 +130,22 @@ HTML; * @inheritDoc */ public function setData(Condition $condition) { - if ($condition->endTime) { - $this->endTime = $condition->endTime; + /** @noinspection PhpUndefinedFieldInspection */ + $endTime = $condition->endTime; + if ($endTime) { + $this->endTime = $endTime; } - if ($condition->startTime) { - $this->startTime = $condition->startTime; + + /** @noinspection PhpUndefinedFieldInspection */ + $startTime = $condition->startTime; + if ($startTime) { + $this->startTime = $startTime; } - if ($condition->timezone) { - $this->timezone = $condition->timezone; + + /** @noinspection PhpUndefinedFieldInspection */ + $timezone = $condition->timezone; + if ($timezone) { + $this->timezone = $timezone; } } @@ -188,19 +196,25 @@ HTML; */ public function showContent(Condition $condition) { $timezone = WCF::getUser()->getTimeZone(); - if ($condition->timezone) { - $timezone = new \DateTimeZone($condition->timezone); + /** @noinspection PhpUndefinedFieldInspection */ + $conditionTimezone = $condition->timezone; + if ($conditionTimezone) { + $timezone = new \DateTimeZone($conditionTimezone); } - if ($condition->startTime) { - $dateTime = \DateTime::createFromFormat('H:i', $condition->startTime, $timezone); + /** @noinspection PhpUndefinedFieldInspection */ + $startTime = $condition->startTime; + if ($startTime) { + $dateTime = \DateTime::createFromFormat('H:i', $startTime, $timezone); if ($dateTime->getTimestamp() > TIME_NOW) { return false; } } - if ($condition->endTime) { - $dateTime = \DateTime::createFromFormat('H:i', $condition->endTime, $timezone); + /** @noinspection PhpUndefinedFieldInspection */ + $endTime = $condition->endTime; + if ($endTime) { + $dateTime = \DateTime::createFromFormat('H:i', $endTime, $timezone); if ($dateTime->getTimestamp() < TIME_NOW) { return false; } diff --git a/wcfsetup/install/files/lib/system/condition/UserOptionsCondition.class.php b/wcfsetup/install/files/lib/system/condition/UserOptionsCondition.class.php index d9e99670b0..2206dfe3f3 100644 --- a/wcfsetup/install/files/lib/system/condition/UserOptionsCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/UserOptionsCondition.class.php @@ -60,6 +60,7 @@ class UserOptionsCondition extends AbstractMultipleFieldsCondition implements IC * @inheritDoc */ public function checkUser(Condition $condition, User $user) { + /** @noinspection PhpUndefinedFieldInspection */ $optionValues = $condition->optionValues; $checkSuccess = true; diff --git a/wcfsetup/install/files/lib/system/condition/UserRegistrationDateCondition.class.php b/wcfsetup/install/files/lib/system/condition/UserRegistrationDateCondition.class.php index 33f2c5478e..8626831e82 100644 --- a/wcfsetup/install/files/lib/system/condition/UserRegistrationDateCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/UserRegistrationDateCondition.class.php @@ -55,10 +55,15 @@ class UserRegistrationDateCondition extends AbstractSingleFieldCondition impleme * @inheritDoc */ public function checkUser(Condition $condition, User $user) { - if ($condition->registrationDateStart !== null && $user->registrationDate < strtotime($condition->registrationDateStart)) { + /** @noinspection PhpUndefinedFieldInspection */ + $registrationDateStart = $condition->registrationDateStart; + if ($registrationDateStart !== null && $user->registrationDate < strtotime($registrationDateStart)) { return false; } - if ($condition->registrationDateEnd !== null && $user->registrationDate >= strtotime($condition->registrationDateEnd) + 86400) { + + /** @noinspection PhpUndefinedFieldInspection */ + $registrationDateEnd = $condition->registrationDateEnd; + if ($registrationDateEnd !== null && $user->registrationDate >= strtotime($registrationDateEnd) + 86400) { return false; } @@ -118,11 +123,16 @@ HTML; * @inheritDoc */ public function setData(Condition $condition) { - if ($condition->registrationDateEnd) { - $this->registrationDateEnd = $condition->registrationDateEnd; + /** @noinspection PhpUndefinedFieldInspection */ + $registrationDateEnd = $condition->registrationDateEnd; + if ($registrationDateEnd) { + $this->registrationDateEnd = $registrationDateEnd; } - if ($condition->registrationDateStart) { - $this->registrationDateStart = $condition->registrationDateStart; + + /** @noinspection PhpUndefinedFieldInspection */ + $registrationDateStart = $condition->registrationDateStart; + if ($registrationDateStart) { + $this->registrationDateStart = $registrationDateStart; } } diff --git a/wcfsetup/install/files/lib/system/condition/UserRegistrationDateIntervalCondition.class.php b/wcfsetup/install/files/lib/system/condition/UserRegistrationDateIntervalCondition.class.php index 6bec80d331..e201a63adb 100644 --- a/wcfsetup/install/files/lib/system/condition/UserRegistrationDateIntervalCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/UserRegistrationDateIntervalCondition.class.php @@ -48,10 +48,15 @@ class UserRegistrationDateIntervalCondition extends AbstractIntegerCondition imp * @inheritDoc */ public function checkUser(Condition $condition, User $user) { - if ($condition->greaterThan !== null && $user->registrationDate >= TIME_NOW - $condition->greaterThan * 86400) { + /** @noinspection PhpUndefinedFieldInspection */ + $greaterThan = $condition->greaterThan; + if ($greaterThan !== null && $user->registrationDate >= TIME_NOW - $greaterThan * 86400) { return false; } - if ($condition->lessThan !== null && $user->registrationDate <= TIME_NOW - $condition->lessThan * 86400) { + + /** @noinspection PhpUndefinedFieldInspection */ + $lessThan = $condition->lessThan; + if ($lessThan !== null && $user->registrationDate <= TIME_NOW - $lessThan * 86400) { return false; } diff --git a/wcfsetup/install/files/lib/system/condition/UserStateCondition.class.php b/wcfsetup/install/files/lib/system/condition/UserStateCondition.class.php index b812caa99f..9fd4a29c87 100644 --- a/wcfsetup/install/files/lib/system/condition/UserStateCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/UserStateCondition.class.php @@ -73,15 +73,19 @@ class UserStateCondition extends AbstractSingleFieldCondition implements IConten * @inheritDoc */ public function checkUser(Condition $condition, User $user) { - if ($condition->userIsBanned !== null && $user->banned != $condition->userIsBanned) { + /** @noinspection PhpUndefinedFieldInspection */ + $userIsBanned = $condition->userIsBanned; + if ($userIsBanned !== null && $user->banned != $userIsBanned) { return false; } - if ($condition->userIsEnabled !== null) { - if ($condition->userIsEnabled && $user->activationCode) { + /** @noinspection PhpUndefinedFieldInspection */ + $userIsEnabled = $condition->userIsEnabled; + if ($userIsEnabled !== null) { + if ($userIsEnabled && $user->activationCode) { return false; } - else if (!$condition->userIsEnabled && !$user->activationCode) { + else if (!$userIsEnabled && !$user->activationCode) { return false; } } @@ -171,13 +175,18 @@ HTML; * @inheritDoc */ public function setData(Condition $condition) { + /** @noinspection PhpUndefinedFieldInspection */ + $userIsBanned = $condition->userIsBanned; if ($condition->userIsBanned !== null) { - $this->userIsBanned = $condition->userIsBanned; - $this->userIsNotBanned = !$condition->userIsBanned; + $this->userIsBanned = $userIsBanned; + $this->userIsNotBanned = !$userIsBanned; } + + /** @noinspection PhpUndefinedFieldInspection */ + $userIsEnabled = $condition->userIsEnabled; if ($condition->userIsEnabled !== null) { - $this->userIsEnabled = $condition->userIsEnabled; - $this->userIsDisabled = !$condition->userIsEnabled; + $this->userIsEnabled = $userIsEnabled; + $this->userIsDisabled = !$userIsEnabled; } } diff --git a/wcfsetup/install/files/lib/system/message/embedded/object/IMessageEmbeddedObjectHandler.class.php b/wcfsetup/install/files/lib/system/message/embedded/object/IMessageEmbeddedObjectHandler.class.php index e23b64c44f..f0bb165117 100644 --- a/wcfsetup/install/files/lib/system/message/embedded/object/IMessageEmbeddedObjectHandler.class.php +++ b/wcfsetup/install/files/lib/system/message/embedded/object/IMessageEmbeddedObjectHandler.class.php @@ -10,6 +10,8 @@ use wcf\system\html\input\HtmlInputProcessor; * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package WoltLabSuite\Core\System\Message\Embedded\Object + * + * @property-read integer $objectTypeID id of the embedded object type */ interface IMessageEmbeddedObjectHandler { /** diff --git a/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php b/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php index 5903fcf6dd..cd81f18d19 100644 --- a/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php +++ b/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php @@ -2,6 +2,7 @@ namespace wcf\system\option\user; use wcf\data\option\category\OptionCategory; use wcf\data\option\Option; +use wcf\data\user\option\category\UserOptionCategory; use wcf\data\user\option\UserOption; use wcf\data\user\option\ViewableUserOption; use wcf\data\user\User; @@ -19,6 +20,10 @@ use wcf\util\MessageUtil; * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package WoltLabSuite\Core\System\Option\User + * + * @property UserOptionCategory $cachedCategories + * @property UserOption[] $cachedOptions + * @property UserOption[] $options */ class UserOptionHandler extends OptionHandler { /** @@ -198,6 +203,8 @@ class UserOptionHandler extends OptionHandler { * @inheritDoc */ protected function validateOption(Option $option) { + /** @var UserOption $option */ + parent::validateOption($option); if ($option->required && $option->optionType != 'boolean' && empty($this->optionValues[$option->optionName])) { diff --git a/wcfsetup/install/files/lib/system/page/handler/TDecoratedCategoryLookupPageHandler.class.php b/wcfsetup/install/files/lib/system/page/handler/TDecoratedCategoryLookupPageHandler.class.php index e77d67a255..22f015f2ef 100644 --- a/wcfsetup/install/files/lib/system/page/handler/TDecoratedCategoryLookupPageHandler.class.php +++ b/wcfsetup/install/files/lib/system/page/handler/TDecoratedCategoryLookupPageHandler.class.php @@ -84,6 +84,7 @@ trait TDecoratedCategoryLookupPageHandler { } $conditionBuilder = new PreparedStatementConditionBuilder(); + /** @noinspection PhpUndefinedFieldInspection */ $conditionBuilder->add('category.objectTypeID = ?', [ObjectTypeCache::getInstance()->getObjectTypeIDByName('com.woltlab.wcf.category', $className::OBJECT_TYPE_NAME)]); $conditionBuilder->add('(category.title LIKE ? OR language_item.languageItemValue LIKE ?)', ['%' . $searchString . '%', '%' . $searchString . '%']); $sql = "SELECT DISTINCT categoryID diff --git a/wcfsetup/install/files/lib/system/tagging/TagEngine.class.php b/wcfsetup/install/files/lib/system/tagging/TagEngine.class.php index af07adab54..5b7e9ab6e1 100644 --- a/wcfsetup/install/files/lib/system/tagging/TagEngine.class.php +++ b/wcfsetup/install/files/lib/system/tagging/TagEngine.class.php @@ -174,10 +174,12 @@ class TagEngine extends SingletonFactory { $tags = []; while ($tag = $statement->fetchObject(Tag::class)) { - if (!isset($tags[$tag->objectID])) { - $tags[$tag->objectID] = []; + /** @noinspection PhpUndefinedFieldInspection */ + $objectID = $tag->objectID; + if (!isset($tags[$objectID])) { + $tags[$objectID] = []; } - $tags[$tag->objectID][$tag->tagID] = $tag; + $tags[$objectID][$tag->tagID] = $tag; } return $tags; diff --git a/wcfsetup/install/files/lib/system/user/notification/event/ModerationQueueCommentResponseUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/ModerationQueueCommentResponseUserNotificationEvent.class.php index 52da16177c..9b70f26f5a 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/ModerationQueueCommentResponseUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/ModerationQueueCommentResponseUserNotificationEvent.class.php @@ -7,6 +7,7 @@ use wcf\system\cache\runtime\CommentRuntimeCache; use wcf\system\cache\runtime\UserProfileRuntimeCache; use wcf\system\email\Email; use wcf\system\moderation\queue\report\IModerationQueueReportHandler; +use wcf\system\user\notification\object\CommentResponseUserNotificationObject; use wcf\system\WCF; /** @@ -17,6 +18,8 @@ use wcf\system\WCF; * @license GNU Lesser General Public License * @package WoltLabSuite\Core\System\User\Notification\Event * @since 3.0 + * + * @method CommentResponseUserNotificationObject getUserNotificationObject() */ class ModerationQueueCommentResponseUserNotificationEvent extends AbstractSharedUserNotificationEvent { /** @@ -57,7 +60,7 @@ class ModerationQueueCommentResponseUserNotificationEvent extends AbstractShared * @inheritDoc */ public function getEmailMessage($notificationType = 'instant') { - $comment = CommentRuntimeCache::getInstance()->getObject($this->userNotificationObject->commentID); + $comment = CommentRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->commentID); if ($comment->userID) { $commentAuthor = UserProfileRuntimeCache::getInstance()->getObject($comment->userID); } @@ -116,7 +119,7 @@ class ModerationQueueCommentResponseUserNotificationEvent extends AbstractShared ]); } - $comment = CommentRuntimeCache::getInstance()->getObject($this->userNotificationObject->commentID); + $comment = CommentRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->commentID); if ($comment->userID) { $commentAuthor = UserProfileRuntimeCache::getInstance()->getObject($comment->userID); } @@ -139,7 +142,7 @@ class ModerationQueueCommentResponseUserNotificationEvent extends AbstractShared */ public function getModerationQueue() { if (!$this->moderationQueueLoaded) { - $comment = CommentRuntimeCache::getInstance()->getObject($this->userNotificationObject->commentID); + $comment = CommentRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->commentID); $this->moderationQueue = ViewableModerationQueue::getViewableModerationQueue($comment->objectID); $this->moderationQueueLoaded = true; @@ -182,7 +185,7 @@ class ModerationQueueCommentResponseUserNotificationEvent extends AbstractShared * @inheritDoc */ protected function prepare() { - CommentRuntimeCache::getInstance()->cacheObjectID($this->userNotificationObject->commentID); + CommentRuntimeCache::getInstance()->cacheObjectID($this->getUserNotificationObject()->commentID); UserProfileRuntimeCache::getInstance()->cacheObjectID($this->additionalData['userID']); } } diff --git a/wcfsetup/install/files/lib/system/user/notification/event/ModerationQueueCommentUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/ModerationQueueCommentUserNotificationEvent.class.php index 9dd34cf044..0218732b58 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/ModerationQueueCommentUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/ModerationQueueCommentUserNotificationEvent.class.php @@ -6,6 +6,7 @@ use wcf\data\user\notification\UserNotification; use wcf\data\user\UserProfile; use wcf\system\email\Email; use wcf\system\moderation\queue\IModerationQueueHandler; +use wcf\system\user\notification\object\CommentUserNotificationObject; use wcf\system\user\notification\object\IUserNotificationObject; use wcf\system\WCF; @@ -17,6 +18,8 @@ use wcf\system\WCF; * @license GNU Lesser General Public License * @package WoltLabSuite\Core\System\User\Notification\Event * @since 3.0 + * + * @method CommentUserNotificationObject getUserNotificationObject() */ class ModerationQueueCommentUserNotificationEvent extends AbstractUserNotificationEvent { /** @@ -127,7 +130,7 @@ class ModerationQueueCommentUserNotificationEvent extends AbstractUserNotificati parent::setObject($notification, $object, $author, $additionalData); // if the active user has no access, $this->moderationQueue is null - $this->moderationQueue = ViewableModerationQueue::getViewableModerationQueue($this->userNotificationObject->objectID); + $this->moderationQueue = ViewableModerationQueue::getViewableModerationQueue($this->getUserNotificationObject()->objectID); if ($this->moderationQueue) { /** @var IModerationQueueHandler $moderationHandler */ diff --git a/wcfsetup/install/files/lib/system/user/notification/event/UserFollowFollowingUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/UserFollowFollowingUserNotificationEvent.class.php index 882ac72205..4f7a2aad7d 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/UserFollowFollowingUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/UserFollowFollowingUserNotificationEvent.class.php @@ -1,6 +1,7 @@ * @package WoltLabSuite\Core\System\User\Notification\Event + * + * @method UserFollowUserNotificationObject getUserNotificationObject() */ class UserFollowFollowingUserNotificationEvent extends AbstractUserNotificationEvent { /** @@ -68,6 +71,6 @@ class UserFollowFollowingUserNotificationEvent extends AbstractUserNotificationE * @inheritDoc */ public function getEventHash() { - return sha1($this->eventID . '-' . $this->userNotificationObject->followUserID); + return sha1($this->eventID . '-' . $this->getUserNotificationObject()->followUserID); } }