From: Matthias Schmidt Date: Sun, 2 Oct 2016 09:52:07 +0000 (+0200) Subject: Improve code for better code analysis by IDE X-Git-Tag: 3.0.0_Beta_2~27 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fc52a8455af83ba1bd477080a6524ff58a107db7;p=GitHub%2FWoltLab%2FWCF.git Improve code for better code analysis by IDE --- diff --git a/wcfsetup/install/files/lib/acp/form/BoxEditForm.class.php b/wcfsetup/install/files/lib/acp/form/BoxEditForm.class.php index ab1c5dfe9b..19fd944ec0 100644 --- a/wcfsetup/install/files/lib/acp/form/BoxEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/BoxEditForm.class.php @@ -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) { diff --git a/wcfsetup/install/files/lib/data/article/ViewableArticle.class.php b/wcfsetup/install/files/lib/data/article/ViewableArticle.class.php index f5c06c638f..73f071e221 100644 --- a/wcfsetup/install/files/lib/data/article/ViewableArticle.class.php +++ b/wcfsetup/install/files/lib/data/article/ViewableArticle.class.php @@ -1,5 +1,6 @@ * @package WoltLabSuite\Core\Form + * + * @property UserOptionHandler $optionHandler */ class UserSearchForm extends UserOptionListForm { /** diff --git a/wcfsetup/install/files/lib/system/CLIWCF.class.php b/wcfsetup/install/files/lib/system/CLIWCF.class.php index fd114a8072..355376699e 100644 --- a/wcfsetup/install/files/lib/system/CLIWCF.class.php +++ b/wcfsetup/install/files/lib/system/CLIWCF.class.php @@ -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(); diff --git a/wcfsetup/install/files/lib/system/bulk/processing/AbstractBulkProcessableObjectType.class.php b/wcfsetup/install/files/lib/system/bulk/processing/AbstractBulkProcessableObjectType.class.php index 2bf6620a02..a754eca1ca 100644 --- a/wcfsetup/install/files/lib/system/bulk/processing/AbstractBulkProcessableObjectType.class.php +++ b/wcfsetup/install/files/lib/system/bulk/processing/AbstractBulkProcessableObjectType.class.php @@ -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'; } diff --git a/wcfsetup/install/files/lib/system/cli/command/PackageCLICommand.class.php b/wcfsetup/install/files/lib/system/cli/command/PackageCLICommand.class.php index 571de1725a..73f6d50154 100644 --- a/wcfsetup/install/files/lib/system/cli/command/PackageCLICommand.class.php +++ b/wcfsetup/install/files/lib/system/cli/command/PackageCLICommand.class.php @@ -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(); } /** diff --git a/wcfsetup/install/files/lib/system/cli/command/WorkerCLICommand.class.php b/wcfsetup/install/files/lib/system/cli/command/WorkerCLICommand.class.php index 48ee2ac37b..b9d5c6f9e8 100644 --- a/wcfsetup/install/files/lib/system/cli/command/WorkerCLICommand.class.php +++ b/wcfsetup/install/files/lib/system/cli/command/WorkerCLICommand.class.php @@ -128,7 +128,7 @@ class WorkerCLICommand implements IArgumentedCLICommand { } $progressbar->update($progress); - $progressbar->getAdapter()->finish(); + $progressbar->finish(); } /** diff --git a/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseUserNotificationEvent.class.php index b9f699de77..1ed3ec7db4 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseUserNotificationEvent.class.php @@ -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 * @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); } } diff --git a/wcfsetup/install/files/lib/util/DirectoryUtil.class.php b/wcfsetup/install/files/lib/util/DirectoryUtil.class.php index d18bfe4b30..40c22bd024 100644 --- a/wcfsetup/install/files/lib/util/DirectoryUtil.class.php +++ b/wcfsetup/install/files/lib/util/DirectoryUtil.class.php @@ -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; diff --git a/wcfsetup/install/files/lib/util/HTTPRequest.class.php b/wcfsetup/install/files/lib/util/HTTPRequest.class.php index 6dca65df20..2a5cbc7e00 100644 --- a/wcfsetup/install/files/lib/util/HTTPRequest.class.php +++ b/wcfsetup/install/files/lib/util/HTTPRequest.class.php @@ -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++) {