Fix warnings about undefined fields in data classes (WIP)
authorMatthias Schmidt <gravatronics@live.com>
Sun, 29 May 2016 12:48:17 +0000 (14:48 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 29 May 2016 12:48:17 +0000 (14:48 +0200)
17 files changed:
wcfsetup/install/files/lib/data/ProcessibleDatabaseObject.class.php
wcfsetup/install/files/lib/data/acp/menu/item/ACPMenuItem.class.php
wcfsetup/install/files/lib/data/acp/session/log/ACPSessionLog.class.php
wcfsetup/install/files/lib/data/ad/Ad.class.php
wcfsetup/install/files/lib/data/comment/LikeableComment.class.php
wcfsetup/install/files/lib/data/comment/LikeableCommentProvider.class.php
wcfsetup/install/files/lib/data/comment/response/LikeableCommentResponse.class.php
wcfsetup/install/files/lib/data/comment/response/LikeableCommentResponseProvider.class.php
wcfsetup/install/files/lib/data/label/group/LabelGroup.class.php
wcfsetup/install/files/lib/data/language/Language.class.php
wcfsetup/install/files/lib/data/media/MediaAction.class.php
wcfsetup/install/files/lib/data/media/ViewableMedia.class.php
wcfsetup/install/files/lib/data/poll/Poll.class.php
wcfsetup/install/files/lib/data/template/Template.class.php
wcfsetup/install/files/lib/data/template/TemplateList.class.php
wcfsetup/install/files/lib/data/user/activity/event/UserActivityEventAction.class.php
wcfsetup/install/files/lib/data/user/online/UserOnline.class.php

index 5e5dfa2b6d1a434bd1dee90819da28aa111959f0..b55147132c0dcfe6e2cde070265bc873d6472513 100644 (file)
@@ -13,6 +13,8 @@ use wcf\system\SingletonFactory;
  * @package    com.woltlab.wcf
  * @subpackage data
  * @category   Community Framework
+ * 
+ * @property-read      string|null     $className
  */
 class ProcessibleDatabaseObject extends DatabaseObject {
        /**
index c4c3db616476d780b1a607aaeea55d6b5b3060bd..55753024b803c7a7fa4a46bb6b16f10317c2bd13 100644 (file)
@@ -68,6 +68,7 @@ class ACPMenuItem extends DatabaseObject implements ITreeMenuItem {
                // links of top option category menu items need the id of the option
                // category
                if ($this->parentMenuItem == 'wcf.acp.menu.link.option.category') {
+                       /** @noinspection PhpUndefinedFieldInspection */
                        $linkParameters['id'] = $this->optionCategoryID;
                }
                
index d1557c4a936bad5512c49eb41c989e406d6e0219..8fa88f91d46ef581ae9f98f64da730ca3427505e 100644 (file)
@@ -22,6 +22,7 @@ use wcf\util\UserUtil;
  * @property-read      string          $userAgent
  * @property-read      integer         $time
  * @property-read      integer         $lastActivityTime
+ * @property-read      string|null     $active
  */
 class ACPSessionLog extends DatabaseObject {
        /**
index 9b906193e240d16f97a53df8bbf877a70a40dc4c..fb296dae0824dbb8ab748c908ed59866b3046953 100644 (file)
@@ -53,7 +53,9 @@ class Ad extends DatabaseObject implements IRouteController {
                $objectType = ObjectTypeCache::getInstance()->getObjectType($this->objectTypeID);
                
                $location = WCF::getLanguage()->get('wcf.acp.ad.location.'.$objectType->objectType);
+               /** @noinspection PhpUndefinedFieldInspection */
                if ($objectType->categoryname != 'com.woltlab.wcf.global') {
+                       /** @noinspection PhpUndefinedFieldInspection */
                        $location = WCF::getLanguage()->get('wcf.acp.ad.location.category.'.$objectType->categoryname).': '.$location;
                }
                
index cea7adee012689f797cc9a52b03e51fb5c322fbf..b123d12777eba1c2142e4992ccffca7271629135 100644 (file)
@@ -63,12 +63,12 @@ class LikeableComment extends AbstractLikeObject {
         * @inheritDoc
         */
        public function sendNotification(Like $like) {
-               $objectType = CommentHandler::getInstance()->getObjectType($this->object->objectTypeID);
+               $objectType = CommentHandler::getInstance()->getObjectType($this->getDecoratedObject()->objectTypeID);
                if (UserNotificationHandler::getInstance()->getObjectTypeID($objectType->objectType.'.like.notification')) {
                        if ($this->userID != WCF::getUser()->userID) {
                                $notificationObject = new LikeUserNotificationObject($like);
                                UserNotificationHandler::getInstance()->fireEvent('like', $objectType->objectType.'.like.notification', $notificationObject, [$this->userID], [
-                                       'objectID' => $this->object->objectID,
+                                       'objectID' => $this->getDecoratedObject()->objectID,
                                        'objectOwnerID' => $this->userID
                                ]);
                        }
index 4c54e29e2a60d3b92670553aec4d86be41c86985..912e050154e234f8c747f582d39efdea1578c3e3 100644 (file)
@@ -39,6 +39,8 @@ class LikeableCommentProvider extends AbstractObjectTypeProvider implements ILik
         * @inheritDoc
         */
        public function checkPermissions(ILikeObject $comment) {
+               /** @var Comment $comment */
+               
                if (!$comment->commentID) return false;
                
                $objectType = CommentHandler::getInstance()->getObjectType($comment->objectTypeID);
index d14e8884a91b8f642fa92c194e60ed9ea8d273cc..6d6c073d2e82c88099974a7d85c1555a03417f71 100644 (file)
@@ -64,7 +64,7 @@ class LikeableCommentResponse extends AbstractLikeObject {
         * @inheritDoc
         */
        public function sendNotification(Like $like) {
-               $comment = new Comment($this->object->commentID);
+               $comment = new Comment($this->getDecoratedObject()->commentID);
                $objectType = CommentHandler::getInstance()->getObjectType($comment->objectTypeID);
                if (UserNotificationHandler::getInstance()->getObjectTypeID($objectType->objectType.'.response.like.notification')) {
                        if ($this->userID != WCF::getUser()->userID) {
index fd8e9b49c0edf5b5f9c70f14ef2403dd2a4b6b56..042b51ad0a083601bce8b8c81fcd232054565aac 100644 (file)
@@ -42,6 +42,8 @@ class LikeableCommentResponseProvider extends AbstractObjectTypeProvider impleme
         * @inheritDoc
         */
        public function checkPermissions(ILikeObject $response) {
+               /** @var CommentResponse $response */
+               
                if (!$response->responseID) return false;
                $comment = new Comment($response->commentID);
                if (!$comment->commentID) {
index 4e20ab7288a78aecad9e7e58d3351d112dd9d087..737f01e0f1d800acb85c519816fca4dee8bb1c4b 100644 (file)
@@ -55,10 +55,13 @@ class LabelGroup extends DatabaseObject implements IRouteController {
         * @return      integer
         */
        public static function sortLabelGroups(DatabaseObject $groupA, DatabaseObject $groupB) {
+               /** @noinspection PhpUndefinedFieldInspection */
                if ($groupA->showOrder == $groupB->showOrder) {
+                       /** @noinspection PhpUndefinedFieldInspection */
                        return ($groupA->groupID > $groupB->groupID) ? 1 : -1;
                }
                
+               /** @noinspection PhpUndefinedFieldInspection */
                return ($groupA->showOrder > $groupB->showOrder) ? 1 : -1;
        }
 }
index 51d32752f255e56a57aa6e01a524848dc36e3b89..641137e694a43d3fb232d4e98f12b800275931ba 100644 (file)
@@ -20,6 +20,7 @@ use wcf\system\WCF;
  * @property-read      string          $countryCode
  * @property-read      integer         $isDefault
  * @property-read      integer         $hasContent
+ * @property-read      integer         $isDisabled
  */
 class Language extends DatabaseObject {
        /**
index cbe6d5e317e7e54baeb85e79fda8d4908a2a7a8e..32c2df9e00876700558679da1a36c670fba9067b 100644 (file)
@@ -60,6 +60,8 @@ class MediaAction extends AbstractDatabaseObjectAction implements ISearchAction,
                
                /** @noinspection PhpUndefinedMethodInspection */
                $this->parameters['__files']->saveFiles($saveStrategy);
+               
+               /** @var Media[] $mediaFiles */
                $mediaFiles = $saveStrategy->getObjects();
                
                $result = [
index 83a32b7b13de8abf52ae2f8267377af0864e08af..c1337634cda5f713f5e268780377f840c5621060 100644 (file)
@@ -18,6 +18,9 @@ use wcf\util\StringUtil;
  * 
  * @method     Media   getDecoratedObject()
  * @mixin      Media
+ * @property-read      string|null     $title
+ * @property-read      string|null     $description
+ * @property-read      string|null     $altText
  */
 class ViewableMedia extends DatabaseObjectDecorator {
        /**
index b372d9d90162ac94246994267fa586c9fd3ba519..5f2069f568fdd87685ab44f810c85e8b4d5a0280 100644 (file)
@@ -61,12 +61,13 @@ class Poll extends DatabaseObject {
        /**
         * Adds an option to current poll.
         * 
-        * @param       \wcf\data\poll\option\PollOption                $option
+        * @param       PollOption      $option
         */
        public function addOption(PollOption $option) {
                if ($option->pollID == $this->pollID) {
                        $this->options[$option->optionID] = $option;
                        
+                       /** @noinspection PhpUndefinedFieldInspection */
                        if ($option->voted) {
                                $this->isParticipant = true;
                        }
@@ -124,6 +125,7 @@ class Poll extends DatabaseObject {
                foreach ($optionList as $option) {
                        $this->options[$option->optionID] = $option;
                        
+                       /** @noinspection PhpUndefinedFieldInspection */
                        if ($option->voted) {
                                $this->isParticipant = true;
                        }
index 374faceeb9bb566b7e627b0b37756da58de6d24a..fd87d12f25c8e0b10897a6bfbb0d7af3d4b3ef23 100644 (file)
@@ -80,6 +80,7 @@ class Template extends DatabaseObject {
         * @return      string
         */
        public function getPath() {
+               /** @noinspection PhpUndefinedFieldInspection */
                $path = FileUtil::getRealPath(WCF_DIR . $this->packageDir) . 'templates/' . $this->templateGroupFolderName . $this->templateName . '.tpl';
                return $path;
        }
index 7ffcb30073b88f50cf7b6a4cba44b55472078ca2..6927d8958157625a3892fc36bf5103c7a9514f24 100644 (file)
@@ -13,6 +13,11 @@ use wcf\system\application\ApplicationHandler;
  * @package    com.woltlab.wcf
  * @subpackage data.template
  * @category   Community Framework
+ * 
+ * @method     Template                current()
+ * @method     Template[]              getObjects()
+ * @method     Template|null           search($objectID)
+ * @property   Template[]              $objects
  */
 class TemplateList extends DatabaseObjectList {
        /**
index 3fac100a28a1634b65e17061a528ce0dcdbac804..603c4af07111d25d2739cd321fc80ed3135496f7 100644 (file)
@@ -96,6 +96,7 @@ class UserActivityEventAction extends AbstractDatabaseObjectAction {
        public function validateSwitchContext() { }
        
        public function switchContext() {
+               /** @noinspection PhpUndefinedFieldInspection */
                $userAction = new UserAction([WCF::getUser()], 'update', [
                        'options' => [
                                User::getUserOptionID('recentActivitiesFilterByFollowing') => (WCF::getUser()->recentActivitiesFilterByFollowing ? 0 : 1)
index c4f30cb0f8f06744cf3325be1e7190eb35c035ea..405341b6e40be7e677c6aee98945659d987cba8c 100644 (file)
@@ -22,6 +22,7 @@ use wcf\util\UserUtil;
  * @property-read      integer|null    $pageID
  * @property-read      integer|null    $pageObjectID
  * @property-read      integer|null    $parentPageObjectID
+ * @property-read      string|null     $userOnlineMarking
  */
 class UserOnline extends UserProfile {
        /**