From 1cf9e18f59fea7d423aa2ec2bdb95296166f937b Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 29 May 2016 14:36:21 +0200 Subject: [PATCH] Fix warnings about undefined methods in data classes --- .../files/lib/data/attachment/AttachmentAction.class.php | 3 +++ wcfsetup/install/files/lib/data/box/Box.class.php | 2 ++ .../files/lib/data/language/LanguageEditor.class.php | 6 ++++++ wcfsetup/install/files/lib/data/like/LikeAction.class.php | 4 ++++ .../install/files/lib/data/like/ViewableLikeList.class.php | 1 + wcfsetup/install/files/lib/data/style/StyleAction.class.php | 2 ++ wcfsetup/install/files/lib/data/style/StyleEditor.class.php | 2 ++ 7 files changed, 20 insertions(+) diff --git a/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php b/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php index 6dfefbeff4..8f1c669846 100644 --- a/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php +++ b/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php @@ -12,6 +12,7 @@ use wcf\system\exception\UserInputException; use wcf\system\request\LinkHandler; use wcf\system\upload\DefaultUploadFileSaveStrategy; use wcf\system\upload\DefaultUploadFileValidationStrategy; +use wcf\system\upload\UploadFile; use wcf\system\WCF; use wcf\util\ArrayUtil; use wcf\util\FileUtil; @@ -177,6 +178,8 @@ class AttachmentAction extends AbstractDatabaseObjectAction implements ISortable } } + /** @noinspection PhpUndefinedMethodInspection */ + /** @var UploadFile[] $files */ $files = $this->parameters['__files']->getFiles(); foreach ($files as $file) { if ($file->getValidationErrorType()) { diff --git a/wcfsetup/install/files/lib/data/box/Box.class.php b/wcfsetup/install/files/lib/data/box/Box.class.php index 0cc2495ae8..1b727fcb3a 100644 --- a/wcfsetup/install/files/lib/data/box/Box.class.php +++ b/wcfsetup/install/files/lib/data/box/Box.class.php @@ -473,7 +473,9 @@ class Box extends DatabaseObject { * @return Condition[] */ public function getConditions() { + /** @noinspection PhpUndefinedMethodInspection */ if ($this->boxType === 'system' && $this->getController() instanceof IConditionBoxController && $this->getController()->getConditionDefinition()) { + /** @noinspection PhpUndefinedMethodInspection */ return ConditionHandler::getInstance()->getConditions($this->getController()->getConditionDefinition(), $this->boxID); } diff --git a/wcfsetup/install/files/lib/data/language/LanguageEditor.class.php b/wcfsetup/install/files/lib/data/language/LanguageEditor.class.php index c296a9f206..9825ab6835 100644 --- a/wcfsetup/install/files/lib/data/language/LanguageEditor.class.php +++ b/wcfsetup/install/files/lib/data/language/LanguageEditor.class.php @@ -183,6 +183,8 @@ class LanguageEditor extends DatabaseObjectEditor implements IEditableCachedObje // fetch categories $categories = $xpath->query('/ns:language/ns:category'); + + /** @var \DOMElement $category */ foreach ($categories as $category) { $usedCategories[$category->getAttribute('name')] = 0; } @@ -214,12 +216,16 @@ class LanguageEditor extends DatabaseObjectEditor implements IEditableCachedObje // loop through categories to import items $itemData = []; + + /** @var \DOMElement $category */ foreach ($categories as $category) { $categoryName = $category->getAttribute('name'); $categoryID = $usedCategories[$categoryName]; // loop through items $elements = $xpath->query('child::*', $category); + + /** @var \DOMElement $element */ foreach ($elements as $element) { $itemName = $element->getAttribute('name'); $itemValue = $element->nodeValue; diff --git a/wcfsetup/install/files/lib/data/like/LikeAction.class.php b/wcfsetup/install/files/lib/data/like/LikeAction.class.php index 73b3241bbc..3ab9500558 100644 --- a/wcfsetup/install/files/lib/data/like/LikeAction.class.php +++ b/wcfsetup/install/files/lib/data/like/LikeAction.class.php @@ -91,10 +91,12 @@ class LikeAction extends AbstractDatabaseObjectAction implements IGroupedUserLis $values = []; if (!empty($data[Like::LIKE])) { $values[Like::LIKE] = new GroupedUserList(WCF::getLanguage()->get('wcf.like.details.like')); + /** @noinspection PhpUndefinedMethodInspection */ $values[Like::LIKE]->addUserIDs($data[Like::LIKE]); } if (!empty($data[Like::DISLIKE])) { $values[Like::DISLIKE] = new GroupedUserList(WCF::getLanguage()->get('wcf.like.details.dislike')); + /** @noinspection PhpUndefinedMethodInspection */ $values[Like::DISLIKE]->addUserIDs($data[Like::DISLIKE]); } @@ -260,10 +262,12 @@ class LikeAction extends AbstractDatabaseObjectAction implements IGroupedUserLis $values = []; if (!empty($data[Like::LIKE])) { $values[Like::LIKE] = new GroupedUserList(WCF::getLanguage()->get('wcf.like.details.like')); + /** @noinspection PhpUndefinedMethodInspection */ $values[Like::LIKE]->addUserIDs($data[Like::LIKE]); } if (!empty($data[Like::DISLIKE])) { $values[Like::DISLIKE] = new GroupedUserList(WCF::getLanguage()->get('wcf.like.details.dislike')); + /** @noinspection PhpUndefinedMethodInspection */ $values[Like::DISLIKE]->addUserIDs($data[Like::DISLIKE]); } diff --git a/wcfsetup/install/files/lib/data/like/ViewableLikeList.class.php b/wcfsetup/install/files/lib/data/like/ViewableLikeList.class.php index a75c7adae2..cee47929bb 100644 --- a/wcfsetup/install/files/lib/data/like/ViewableLikeList.class.php +++ b/wcfsetup/install/files/lib/data/like/ViewableLikeList.class.php @@ -70,6 +70,7 @@ class ViewableLikeList extends LikeList { // parse like foreach ($likeGroups as $likeData) { if ($likeData['provider'] instanceof IViewableLikeProvider) { + /** @noinspection PhpUndefinedMethodInspection */ $likeData['provider']->prepare($likeData['objects']); } } diff --git a/wcfsetup/install/files/lib/data/style/StyleAction.class.php b/wcfsetup/install/files/lib/data/style/StyleAction.class.php index 73be5c9d8c..54759149b7 100644 --- a/wcfsetup/install/files/lib/data/style/StyleAction.class.php +++ b/wcfsetup/install/files/lib/data/style/StyleAction.class.php @@ -284,6 +284,7 @@ class StyleAction extends AbstractDatabaseObjectAction implements IToggleAction, */ public function upload() { // save files + /** @noinspection PhpUndefinedMethodInspection */ /** @var UploadFile[] $files */ $files = $this->parameters['__files']->getFiles(); $file = $files[0]; @@ -365,6 +366,7 @@ class StyleAction extends AbstractDatabaseObjectAction implements IToggleAction, */ public function uploadLogo() { // save files + /** @noinspection PhpUndefinedMethodInspection */ /** @var UploadFile[] $files */ $files = $this->parameters['__files']->getFiles(); $file = $files[0]; diff --git a/wcfsetup/install/files/lib/data/style/StyleEditor.class.php b/wcfsetup/install/files/lib/data/style/StyleEditor.class.php index 5a24783ae5..ca698d852e 100644 --- a/wcfsetup/install/files/lib/data/style/StyleEditor.class.php +++ b/wcfsetup/install/files/lib/data/style/StyleEditor.class.php @@ -255,6 +255,8 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject $variables = $xml->xpath()->query('/ns:variables/ns:variable'); $data = []; + + /** @var \DOMElement $variable */ foreach ($variables as $variable) { $data[$variable->getAttribute('name')] = $variable->nodeValue; } -- 2.20.1