Improve code for better code analysis by IDE
authorMatthias Schmidt <gravatronics@live.com>
Sun, 2 Oct 2016 09:52:07 +0000 (11:52 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 2 Oct 2016 09:52:07 +0000 (11:52 +0200)
wcfsetup/install/files/lib/acp/form/BoxEditForm.class.php
wcfsetup/install/files/lib/data/article/ViewableArticle.class.php
wcfsetup/install/files/lib/data/box/Box.class.php
wcfsetup/install/files/lib/form/UserSearchForm.class.php
wcfsetup/install/files/lib/system/CLIWCF.class.php
wcfsetup/install/files/lib/system/bulk/processing/AbstractBulkProcessableObjectType.class.php
wcfsetup/install/files/lib/system/cli/command/PackageCLICommand.class.php
wcfsetup/install/files/lib/system/cli/command/WorkerCLICommand.class.php
wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseUserNotificationEvent.class.php
wcfsetup/install/files/lib/util/DirectoryUtil.class.php
wcfsetup/install/files/lib/util/HTTPRequest.class.php

index ab1c5dfe9b4f687f5135532b99b95192522fca51..19fd944ec087457e1654a316a2d7eca1c4ce3584 100644 (file)
@@ -119,8 +119,14 @@ class BoxEditForm extends BoxAddForm {
                $this->objectAction->executeAction();
                
                // delete old conditions
-               if ($this->box->getController() && $this->box->getController() instanceof IConditionBoxController && $this->box->getController()->getConditionDefinition() && (!$this->boxController || (!($this->boxController->getProcessor() instanceof IConditionBoxController)) || !$this->boxController->getProcessor()->getConditionDefinition())) {
-                       ConditionHandler::getInstance()->deleteConditions($this->box->getController()->getConditionDefinition(), [$this->box->boxID]);
+               if ($this->box->getController() && $this->box->getController() instanceof IConditionBoxController) {
+                       /** @var IConditionBoxController $oldController */
+                       $oldController = $this->box->getController();
+                       
+                       /** @noinspection PhpUndefinedMethodInspection */
+                       if ($oldController->getConditionDefinition() && (!$this->boxController || (!($this->boxController->getProcessor() instanceof IConditionBoxController)) || !$this->boxController->getProcessor()->getConditionDefinition())) {
+                               ConditionHandler::getInstance()->deleteConditions($oldController->getConditionDefinition(), [$this->box->boxID]);
+                       }
                }
                
                if ($this->boxController) {
index f5c06c638f61a0e6df914316328540ab8c0bf673..73f071e221f273caeb3239ee56bb27a6018a2988 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\data\article;
+use wcf\data\article\content\ArticleContent;
 use wcf\data\article\content\ViewableArticleContent;
 use wcf\data\media\ViewableMedia;
 use wcf\data\user\User;
@@ -16,7 +17,8 @@ use wcf\system\cache\runtime\UserProfileRuntimeCache;
  * @package    WoltLabSuite\Core\Data\Article
  * @since      3.0
  *
- * @method     Article getDecoratedObject()
+ * @method     Article                                 getDecoratedObject()
+ * @method     ArticleContent|ViewableArticleContent   getArticleContent()
  * @mixin      Article
  */
 class ViewableArticle extends DatabaseObjectDecorator {
index ebb34f46bc17e1723e749e67c76d27067478f3c6..650957f40aeedf88a9769e1f0b35a9a33b7ee24b 100644 (file)
@@ -46,6 +46,9 @@ use wcf\system\WCF;
  * @property-read      integer         $linkPageObjectID       id of the object the (internal) page links refers to or `0` if no internal link is used or no specific object is linked 
  * @property-read      string          $externalURL            external link used to for the box image and box title or empty if no external link is set
  * @property-read      array           $additionalData         array with additional data of the box
+ * @property-read      integer|null    $limit                  number of objects shown in the box for `AbstractDatabaseObjectListBoxController` controllers or `null` otherwise
+ * @property-read      string|null     $sortField              sort field of the objects shown in the box for `AbstractDatabaseObjectListBoxController` controllers or `null` otherwise
+ * @property-read      string|null     $sortOrder              sort order of the objects shown in the box for `AbstractDatabaseObjectListBoxController` controllers or `null` otherwise
  */
 class Box extends DatabaseObject {
        /**
index ea0af2948338288b1164fa0b4ea4c5211cb58dfe..463ae0a49dd64eb112338a60636d77be17b8aa33 100644 (file)
@@ -4,6 +4,7 @@ use wcf\acp\form\UserOptionListForm;
 use wcf\data\search\SearchEditor;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\exception\UserInputException;
+use wcf\system\option\user\UserOptionHandler;
 use wcf\system\page\PageLocationManager;
 use wcf\system\request\LinkHandler;
 use wcf\system\WCF;
@@ -17,6 +18,8 @@ use wcf\util\StringUtil;
  * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    WoltLabSuite\Core\Form
+ * 
+ * @property   UserOptionHandler       $optionHandler
  */
 class UserSearchForm extends UserOptionListForm {
        /**
index fd114a80728ffb11b5d1e6af9bcdcc5b283b712b..355376699e063a1fe41e678e69c53906cf119a82 100644 (file)
@@ -96,8 +96,11 @@ class CLIWCF extends WCF {
         */
        public static function destruct() {
                if (self::getReader() !== null && self::getReader()->getHistory() instanceof DatabaseCLICommandHistory) {
-                       self::getReader()->getHistory()->save();
-                       self::getReader()->getHistory()->autoSave = false;
+                       /** @var DatabaseCLICommandHistory $history */
+                       $history = self::getReader()->getHistory();
+                       
+                       $history->save();
+                       $history->autoSave = false;
                }
                
                self::getSession()->delete();
index 2bf6620a02091e46d71c925a90ea336663735f5e..a754eca1cab977f18720ba845db3a94e20f4dec8 100644 (file)
@@ -42,7 +42,7 @@ abstract class AbstractBulkProcessableObjectType extends AbstractObjectTypeProce
         */
        public function getActionObjectTypeDefinition() {
                if (empty($this->actionObjectTypeDefinition)) {
-                       $this->actionObjectTypeDefinition = $this->object->objectType.'.action';
+                       $this->actionObjectTypeDefinition = $this->getDecoratedObject()->objectType.'.action';
                }
                
                return $this->actionObjectTypeDefinition;
@@ -60,7 +60,7 @@ abstract class AbstractBulkProcessableObjectType extends AbstractObjectTypeProce
         */
        public function getConditionObjectTypeDefinition() {
                if (empty($this->conditionObjectTypeDefinition)) {
-                       $this->conditionObjectTypeDefinition = $this->object->objectType.'.condition';
+                       $this->conditionObjectTypeDefinition = $this->getDecoratedObject()->objectType.'.condition';
                }
                
                return $this->conditionObjectTypeDefinition;
@@ -72,7 +72,7 @@ abstract class AbstractBulkProcessableObjectType extends AbstractObjectTypeProce
        public function getLanguageItemPrefix() {
                if (empty($this->languageItemPrefix)) {
                        $application = explode('\\', get_class($this))[0];
-                       $objectTypePieces = explode('.', $this->object->objectType);
+                       $objectTypePieces = explode('.', $this->getDecoratedObject()->objectType);
                        
                        $this->languageItemPrefix = $application.'.acp.'.end($objectTypePieces).'.bulkProcessing';
                }
index 571de1725a257ecf3b6737049e6038143390f63f..73f6d5015423e4e3022634614cb86c3e203bcde5 100644 (file)
@@ -334,7 +334,7 @@ class PackageCLICommand implements IArgumentedCLICommand {
                        $progressbar->update($progress, $currentAction);
                }
                
-               $progressbar->getAdapter()->finish();
+               $progressbar->finish();
        }
        
        /**
@@ -431,7 +431,7 @@ class PackageCLICommand implements IArgumentedCLICommand {
                        $progressbar->update($progress, $currentAction);
                }
                
-               $progressbar->getAdapter()->finish();
+               $progressbar->finish();
        }
        
        /**
index 48ee2ac37b5d48fa444cc47257e70359760a9cf4..b9d5c6f9e86deda21ce8d7f5bc8f3cbce1da0201 100644 (file)
@@ -128,7 +128,7 @@ class WorkerCLICommand implements IArgumentedCLICommand {
                }
                $progressbar->update($progress);
                
-               $progressbar->getAdapter()->finish();
+               $progressbar->finish();
        }
        
        /**
index b9f699de770b0ba5e60a7f38625b71431a75353b..1ed3ec7db493b414cc2bb81ac8a822e2ad925213 100644 (file)
@@ -3,6 +3,7 @@ namespace wcf\system\user\notification\event;
 use wcf\system\cache\runtime\CommentRuntimeCache;
 use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\email\Email;
+use wcf\system\user\notification\object\CommentResponseUserNotificationObject;
 
 /**
  * User notification event for profile comment responses.
@@ -11,6 +12,8 @@ use wcf\system\email\Email;
  * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    WoltLabSuite\Core\System\User\Notification\Event
+ * 
+ * @method     CommentResponseUserNotificationObject   getUserNotificationObject()
  */
 class UserProfileCommentResponseUserNotificationEvent extends AbstractSharedUserNotificationEvent {
        /**
@@ -100,6 +103,6 @@ class UserProfileCommentResponseUserNotificationEvent extends AbstractSharedUser
         * @inheritDoc
         */
        public function getEventHash() {
-               return sha1($this->eventID . '-' . $this->userNotificationObject->commentID);
+               return sha1($this->eventID . '-' . $this->getUserNotificationObject()->commentID);
        }
 }
index d18bfe4b30060866f3836e43b74c630d9daf8f1c..40c22bd024a17d648dc627ddd6d8c08db5c6609c 100644 (file)
@@ -201,6 +201,7 @@ final class DirectoryUtil {
                        
                        foreach ($it as $filename => $obj) {
                                // ignore . and ..
+                               /** @noinspection PhpUndefinedMethodInspection */
                                if ($it->isDot()) continue;
                                
                                $this->files[FileUtil::unifyDirSeparator($filename)] = FileUtil::unifyDirSeparator($filename);
@@ -231,6 +232,7 @@ final class DirectoryUtil {
                        
                        foreach ($it as $filename => $obj) {
                                // ignore . and ..
+                               /** @noinspection PhpUndefinedMethodInspection */
                                if ($it->isDot()) continue;
                                
                                $this->fileObjects[FileUtil::unifyDirSeparator($filename)] = $obj;
index 6dca65df2048fe8d72c5556ac8de9b2e8044988d..2a5cbc7e005a2f02f0d50c428d593e450e13f0e1 100644 (file)
@@ -170,6 +170,7 @@ final class HTTPRequest {
                                if (!empty($this->postParameters)) {
                                        $iterator = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($this->postParameters), \RecursiveIteratorIterator::SELF_FIRST);
                                        foreach ($iterator as $k => $v) {
+                                               /** @noinspection PhpUndefinedMethodInspection */
                                                if (!$iterator->hasChildren()) {
                                                        $key = '';
                                                        for ($i = 0, $max = $iterator->getDepth(); $i <= $max; $i++) {
@@ -186,6 +187,7 @@ final class HTTPRequest {
                                
                                $iterator = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($this->files), \RecursiveIteratorIterator::SELF_FIRST);
                                foreach ($iterator as $k => $v) {
+                                       /** @noinspection PhpUndefinedMethodInspection */
                                        if (!$iterator->hasChildren()) {
                                                $key = '';
                                                for ($i = 0, $max = $iterator->getDepth(); $i <= $max; $i++) {