Fix warnings about undefined properties and methods
authorMatthias Schmidt <gravatronics@live.com>
Thu, 26 May 2016 14:23:16 +0000 (16:23 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Thu, 26 May 2016 14:27:35 +0000 (16:27 +0200)
13 files changed:
files/lib/data/conversation/Conversation.class.php
files/lib/data/conversation/FeedConversation.class.php
files/lib/data/conversation/ViewableConversation.class.php
files/lib/data/conversation/message/ConversationMessageAction.class.php
files/lib/data/conversation/message/SearchResultConversationMessage.class.php
files/lib/form/ConversationMessageAddForm.class.php
files/lib/form/ConversationMessageEditForm.class.php
files/lib/page/ConversationListPage.class.php
files/lib/page/ConversationPage.class.php
files/lib/system/attachment/ConversationMessageAttachmentObjectType.class.php
files/lib/system/search/ConversationMessageSearch.class.php
files/lib/system/user/notification/event/ConversationMessageUserNotificationEvent.class.php
files/lib/system/user/notification/event/ConversationUserNotificationEvent.class.php

index 2f7d797d447e58c6ba08c83ef79ad8fe8fe783f9..6b2dc13138945d1bb05eda2cb2acd5d09a4fccac 100644 (file)
@@ -40,6 +40,10 @@ use wcf\util\ArrayUtil;
  * @property-read      integer         $isClosed
  * @property-read      integer         $isDraft
  * @property-read      string          $draftData
+ * @property-read      integer|null    $participantID
+ * @property-read      integer|null    $hideConversation
+ * @property-read      integer|null    $isInvisible
+ * @property-read      integer|null    $lastVisitTime
  */
 class Conversation extends DatabaseObject implements IRouteController, ITitledLinkObject {
        /**
@@ -442,6 +446,7 @@ class Conversation extends DatabaseObject implements IRouteController, ITitledLi
                
                if (!WCF::getSession()->getPermission('user.profile.cannotBeIgnored')) {
                        // check if user wants to receive any conversations
+                       /** @noinspection PhpUndefinedFieldInspection */
                        if ($user->canSendConversation == 2) {
                                throw new UserInputException($field, 'doesNotAcceptConversation');
                        }
@@ -449,6 +454,7 @@ class Conversation extends DatabaseObject implements IRouteController, ITitledLi
                        // check if user only wants to receive conversations by
                        // users they are following and if the active user is followed
                        // by the relevant user
+                       /** @noinspection PhpUndefinedFieldInspection */
                        if ($user->canSendConversation == 1 && !$user->isFollowing(WCF::getUser()->userID)) {
                                throw new UserInputException($field, 'doesNotAcceptConversation');
                        }
index ea5b80170f9f1fdb543f051f81a3141adf87f752..042fe939a30c17f3a00949b795195f03090f70e5 100644 (file)
@@ -13,6 +13,9 @@ use wcf\system\request\LinkHandler;
  * @package    com.woltlab.wcf.conversation
  * @subpackage data.conversation
  * @category   Community Framework
+ *
+ * @method     Conversation    getDecoratedObject()
+ * @mixin      Conversation
  */
 class FeedConversation extends DatabaseObjectDecorator implements IFeedEntry {
        /**
index ce8fda81e2586440193a764f06dc0a05647a3652..51559de8b9dafc9a6737d424a3ad33820962d164 100644 (file)
@@ -22,6 +22,8 @@ use wcf\system\WCF;
  * 
  * @method     Conversation    getDecoratedObject()
  * @mixin      Conversation
+ * @property-read      integer|null    $otherParticipantID
+ * @property-read      string|null     $otherParticipant
  */
 class ViewableConversation extends DatabaseObjectDecorator {
        use TLegacyUserPropertyAccess;
@@ -148,7 +150,9 @@ class ViewableConversation extends DatabaseObjectDecorator {
         * @return      integer
         */
        public function getPages() {
+               /** @noinspection PhpUndefinedFieldInspection */
                if (WCF::getUser()->conversationMessagesPerPage) {
+                       /** @noinspection PhpUndefinedFieldInspection */
                        $messagesPerPage = WCF::getUser()->conversationMessagesPerPage;
                }
                else {
index 063d1a8dae956bff5be95a89b7c7bfeae3bb6dfd..fb54eefb9765231e3e2bc6f3e106f33f96243eb8 100644 (file)
@@ -151,6 +151,7 @@ class ConversationMessageAction extends AbstractDatabaseObjectAction implements
                
                // update attachments
                if (isset($this->parameters['attachmentHandler']) && $this->parameters['attachmentHandler'] !== null) {
+                       /** @noinspection PhpUndefinedMethodInspection */
                        $this->parameters['attachmentHandler']->updateObjectID($message->messageID);
                }
                
@@ -456,6 +457,8 @@ class ConversationMessageAction extends AbstractDatabaseObjectAction implements
         * @inheritDoc
         */
        public function validateContainer(DatabaseObject $conversation) {
+               /** @var Conversation $conversation */
+               
                if (!$conversation->conversationID) {
                        throw new UserInputException('objectID');
                }
@@ -511,6 +514,8 @@ class ConversationMessageAction extends AbstractDatabaseObjectAction implements
         * @inheritDoc
         */
        public function getPageNo(DatabaseObject $conversation) {
+               /** @var Conversation $conversation */
+               
                $sql = "SELECT  COUNT(*) AS count
                        FROM    wcf".WCF_N."_conversation_message
                        WHERE   conversationID = ?";
@@ -525,6 +530,7 @@ class ConversationMessageAction extends AbstractDatabaseObjectAction implements
         * @inheritDoc
         */
        public function getRedirectUrl(DatabaseObject $conversation, DatabaseObject $message) {
+               /** @var ConversationMessage $message */
                return LinkHandler::getInstance()->getLink('Conversation', [
                        'object' => $conversation,
                        'messageID' => $message->messageID
index d3e658c45f2d094a9df14c5db5033fa773b9c0fd..28a877447399dc75e2b53a96d21609f2284438a8 100644 (file)
@@ -14,6 +14,8 @@ use wcf\system\search\SearchResultTextParser;
  * @package    com.woltlab.wcf.conversation
  * @subpackage data.conversation.message
  * @category   Community Framework
+ * 
+ * @property-read      string|null     $subject
  */
 class SearchResultConversationMessage extends ViewableConversationMessage implements ISearchResultObject {
        /**
index b6d85c5a9cd3e9366ddb82f97cbc23739b5a450c..29880cb56f4af81e9a8a4a51826033862d5c4bc7 100644 (file)
@@ -58,7 +58,7 @@ class ConversationMessageAddForm extends MessageForm {
        
        /**
         * message list
-        * @var \wcf\data\conversation\message\ConversationMessageList
+        * @var ViewableConversationMessageList
         */
        public $messageList = null;
        
@@ -161,10 +161,12 @@ class ConversationMessageAddForm extends MessageForm {
                        'time' => TIME_NOW,
                        'userID' => WCF::getUser()->userID,
                        'username' => WCF::getUser()->username,
+                       /* TODO:
                        'enableBBCodes' => $this->enableBBCodes,
                        'enableHtml' => $this->enableHtml,
                        'enableSmilies' => $this->enableSmilies,
                        'showSignature' => $this->showSignature
+                       */
                ]);
                
                $messageData = [
index 3e364feef7903d8d0349cc8668274bf6b68f99a6..6901ac67d948ab3435bd66a026e1b115d6a7c9ba 100644 (file)
@@ -54,7 +54,7 @@ class ConversationMessageEditForm extends ConversationAddForm {
        
        /**
         * message list
-        * @var \wcf\data\conversation\message\ConversationMessageList
+        * @var ViewableConversationMessageList
         */
        public $messageList = null;
        
@@ -123,10 +123,12 @@ class ConversationMessageEditForm extends ConversationAddForm {
                // save message
                $data = array_merge($this->additionalFields, [
                        'message' => $this->text,
+                       /* TODO:
                        'enableBBCodes' => $this->enableBBCodes,
                        'enableHtml' => $this->enableHtml,
                        'enableSmilies' => $this->enableSmilies,
                        'showSignature' => $this->showSignature
+                       */
                ]);
                if ($this->conversation->isDraft && !$this->draft) {
                        $data['time'] = TIME_NOW;
index b1f97fff25598306d859d9a2a4d5fd33c4888444..a1e774ba75c23cc60252f72c57e2e4a9f46e09c3 100644 (file)
@@ -115,7 +115,11 @@ class ConversationListPage extends SortablePage {
                if (!in_array($this->filter, UserConversationList::$availableFilters)) $this->filter = '';
                
                // user settings
-               if (WCF::getUser()->conversationsPerPage) $this->itemsPerPage = WCF::getUser()->conversationsPerPage;
+               /** @noinspection PhpUndefinedFieldInspection */
+               if (WCF::getUser()->conversationsPerPage) {
+                       /** @noinspection PhpUndefinedFieldInspection */
+                       $this->itemsPerPage = WCF::getUser()->conversationsPerPage;
+               }
                
                // labels
                $this->labelList = ConversationLabel::getLabelsByUser();
index 4e88732997b85739975df06765da3758922c674c..c95c6e711ec564100ab72772a7c0c2fc44d790e8 100644 (file)
@@ -134,8 +134,12 @@ class ConversationPage extends MultipleLinkPage {
                $this->labelList = ConversationLabel::getLabelsByUser();
                $this->conversation = ViewableConversation::getViewableConversation($this->conversation, $this->labelList);
                
-               // posts per page
-               if (WCF::getUser()->conversationMessagesPerPage) $this->itemsPerPage = WCF::getUser()->conversationMessagesPerPage;
+               // messages per page
+               /** @noinspection PhpUndefinedFieldInspection */
+               if (WCF::getUser()->conversationMessagesPerPage) {
+                       /** @noinspection PhpUndefinedFieldInspection */
+                       $this->itemsPerPage = WCF::getUser()->conversationMessagesPerPage;
+               }
                
                $this->canonicalURL = LinkHandler::getInstance()->getLink('Conversation', [
                        'object' => $this->conversation
index 3f00e0279a20c5e0f5a3830433377b87389cf6b2..f8942c584aa50f281a5c94b2e89690dc1bdedb22 100644 (file)
@@ -15,6 +15,8 @@ use wcf\util\ArrayUtil;
  * @package    com.woltlab.wcf.conversation
  * @subpackage system.attachment
  * @category   Community Framework
+ * 
+ * @method     ConversationMessage     getObject($objectID)
  */
 class ConversationMessageAttachmentObjectType extends AbstractAttachmentObjectType {
        /**
index 0ff5706e61d3f930e45e8c639d1d59854a3c0161..5c530129e2711f4d90b39ddc42362b31e88e0c68 100644 (file)
@@ -4,6 +4,7 @@ use wcf\data\conversation\message\SearchResultConversationMessage;
 use wcf\data\conversation\message\SearchResultConversationMessageList;
 use wcf\data\conversation\Conversation;
 use wcf\form\IForm;
+use wcf\form\SearchForm;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\WCF;
 
@@ -132,6 +133,8 @@ class ConversationMessageSearch extends AbstractSearchableObjectType {
         * @inheritDoc
         */
        public function show(IForm $form = null) {
+               /** @var SearchForm $form */
+               
                // get existing values
                if ($form !== null && isset($form->searchData['additionalData']['com.woltlab.wcf.conversation.message']['conversationID'])) {
                        $this->conversationID = $form->searchData['additionalData']['com.woltlab.wcf.conversation.message']['conversationID'];
index 148b9b41de08e1c3c623bddeb24571919c3484f5..8857cbd9d53537ada077e8cf894b819ae2a40a62 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 namespace wcf\system\user\notification\event;
 use wcf\system\request\LinkHandler;
+use wcf\system\user\notification\object\ConversationMessageUserNotificationObject;
 
 /**
  * User notification event for conversation messages.
@@ -11,6 +12,8 @@ use wcf\system\request\LinkHandler;
  * @package    com.woltlab.wcf.conversation
  * @subpackage system.user.notification.event
  * @category   Community Framework
+ * 
+ * @method     ConversationMessageUserNotificationObject       getUserNotificationObject()
  */
 class ConversationMessageUserNotificationEvent extends AbstractUserNotificationEvent {
        /**
@@ -69,22 +72,22 @@ class ConversationMessageUserNotificationEvent extends AbstractUserNotificationE
         */
        public function getLink() {
                return LinkHandler::getInstance()->getLink('Conversation', [
-                       'object' => $this->userNotificationObject->getConversation(),
-                       'messageID' => $this->userNotificationObject->messageID
-               ], '#message'.$this->userNotificationObject->messageID);
+                       'object' => $this->getUserNotificationObject()->getConversation(),
+                       'messageID' => $this->getUserNotificationObject()->messageID
+               ], '#message'.$this->getUserNotificationObject()->messageID);
        }
        
        /**
         * @inheritDoc
         */
        public function getEventHash() {
-               return sha1($this->eventID . '-' . $this->userNotificationObject->conversationID);
+               return sha1($this->eventID . '-' . $this->getUserNotificationObject()->conversationID);
        }
        
        /**
         * @inheritDoc
         */
        public function checkAccess() {
-               return $this->userNotificationObject->getConversation()->canRead();
+               return $this->getUserNotificationObject()->getConversation()->canRead();
        }
 }
index d19b9a776427d1caae05ec59a3873c0a6b1eb584..6979b2a46fc56b70279d8905a4d5c7810b19e47b 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 namespace wcf\system\user\notification\event;
 use wcf\system\request\LinkHandler;
+use wcf\system\user\notification\object\ConversationUserNotificationObject;
 
 /**
  * User notification event for conversations.
@@ -11,6 +12,8 @@ use wcf\system\request\LinkHandler;
  * @package    com.woltlab.wcf.conversation
  * @subpackage system.user.notification.event
  * @category   Community Framework
+ * 
+ * @method     ConversationUserNotificationObject      getUserNotificationObject()
  */
 class ConversationUserNotificationEvent extends AbstractUserNotificationEvent {
        /**
@@ -52,6 +55,6 @@ class ConversationUserNotificationEvent extends AbstractUserNotificationEvent {
         * @inheritDoc
         */
        public function checkAccess() {
-               return $this->userNotificationObject->canRead();
+               return $this->getUserNotificationObject()->canRead();
        }
 }