From a13849b85ac6661b32aa5ae727f217d2efc58a53 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sat, 21 May 2016 18:55:23 +0200 Subject: [PATCH] Fix code warnings for PIPs --- .../ACLOptionPackageInstallationPlugin.class.php | 6 +++++- .../ACPTemplatePackageInstallationPlugin.class.php | 1 + ...AbstractOptionPackageInstallationPlugin.class.php | 8 ++++++++ .../plugin/BBCodePackageInstallationPlugin.class.php | 9 ++++++--- .../plugin/BoxPackageInstallationPlugin.class.php | 2 ++ ...lipboardActionPackageInstallationPlugin.class.php | 9 ++++++--- .../CronjobPackageInstallationPlugin.class.php | 1 + .../EventListenerPackageInstallationPlugin.class.php | 1 + .../plugin/FilePackageInstallationPlugin.class.php | 1 + .../MenuItemPackageInstallationPlugin.class.php | 2 ++ .../plugin/MenuPackageInstallationPlugin.class.php | 2 ++ .../plugin/PagePackageInstallationPlugin.class.php | 12 +++++++----- .../TemplatePackageInstallationPlugin.class.php | 1 + ...ificationEventPackageInstallationPlugin.class.php | 8 +++++--- 14 files changed, 48 insertions(+), 15 deletions(-) diff --git a/wcfsetup/install/files/lib/system/package/plugin/ACLOptionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/ACLOptionPackageInstallationPlugin.class.php index 2346a8b556..55c47ae081 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/ACLOptionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/ACLOptionPackageInstallationPlugin.class.php @@ -33,7 +33,7 @@ class ACLOptionPackageInstallationPlugin extends AbstractOptionPackageInstallati /** * @inheritDoc - */ + */ public $tagName = 'option'; /** @@ -41,6 +41,8 @@ class ACLOptionPackageInstallationPlugin extends AbstractOptionPackageInstallati */ protected function importCategories(\DOMXPath $xpath) { $elements = $xpath->query('/ns:data/ns:import/ns:categories/ns:category'); + + /** @var \DOMElement $element */ foreach ($elements as $element) { $data = ['categoryName' => $element->getAttribute('name')]; @@ -95,6 +97,8 @@ class ACLOptionPackageInstallationPlugin extends AbstractOptionPackageInstallati */ protected function importOptions(\DOMXPath $xpath) { $elements = $xpath->query('/ns:data/ns:import/ns:options/ns:option'); + + /** @var \DOMElement $element */ foreach ($elements as $element) { $data = []; $children = $xpath->query('child::*', $element); diff --git a/wcfsetup/install/files/lib/system/package/plugin/ACPTemplatePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/ACPTemplatePackageInstallationPlugin.class.php index 0909688c4a..2b2cbfa9ee 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/ACPTemplatePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/ACPTemplatePackageInstallationPlugin.class.php @@ -73,6 +73,7 @@ class ACPTemplatePackageInstallationPlugin extends AbstractPackageInstallationPl } foreach ($templates as $application => $templateNames) { + /** @noinspection PhpUndefinedMethodInspection */ $this->installation->deleteFiles(Application::getDirectory($application), $templateNames, false, $this->installation->getPackage()->isApplication); // delete log entries diff --git a/wcfsetup/install/files/lib/system/package/plugin/AbstractOptionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/AbstractOptionPackageInstallationPlugin.class.php index 49278235d7..93d71ac011 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/AbstractOptionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/AbstractOptionPackageInstallationPlugin.class.php @@ -42,6 +42,8 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag // delete options $elements = $xpath->query('/ns:data/ns:delete/ns:option'); $options = []; + + /** @var \DOMElement $element */ foreach ($elements as $element) { $options[] = $element->getAttribute('name'); } @@ -63,6 +65,8 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag // delete categories $elements = $xpath->query('/ns:data/ns:delete/ns:optioncategory'); $categories = []; + + /** @var \DOMElement $element */ foreach ($elements as $element) { $categories[] = $element->getAttribute('name'); } @@ -103,6 +107,8 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag */ protected function importCategories(\DOMXPath $xpath) { $elements = $xpath->query('/ns:data/ns:import/ns:categories/ns:category'); + + /** @var \DOMElement $element */ foreach ($elements as $element) { $data = []; @@ -152,6 +158,8 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag */ protected function importOptions(\DOMXPath $xpath) { $elements = $xpath->query('/ns:data/ns:import/ns:options/ns:option'); + + /** @var \DOMElement $element */ foreach ($elements as $element) { $data = []; $children = $xpath->query('child::*', $element); diff --git a/wcfsetup/install/files/lib/system/package/plugin/BBCodePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/BBCodePackageInstallationPlugin.class.php index 4e1a04683e..4e43d601fc 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/BBCodePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/BBCodePackageInstallationPlugin.class.php @@ -1,6 +1,7 @@ attributes[$object->bbcodeID] = $attributes; + $this->attributes[$bbcode->bbcodeID] = $attributes; + + return $bbcode; } /** diff --git a/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php index 6a1506f6e0..a59e290306 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php @@ -322,6 +322,8 @@ class BoxPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); $boxes = []; + + /** @var Box $box */ while ($box = $statement->fetchObject(Box::class)) { $boxes[$box->identifier] = $box; } diff --git a/wcfsetup/install/files/lib/system/package/plugin/ClipboardActionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/ClipboardActionPackageInstallationPlugin.class.php index 0bde28501c..2b5306665b 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/ClipboardActionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/ClipboardActionPackageInstallationPlugin.class.php @@ -1,5 +1,6 @@ pages[$object->actionID] = $pages; + $this->pages[$action->actionID] = $pages; + + return $action; } /** diff --git a/wcfsetup/install/files/lib/system/package/plugin/CronjobPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/CronjobPackageInstallationPlugin.class.php index 6c44739183..2ab6c15b65 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/CronjobPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/CronjobPackageInstallationPlugin.class.php @@ -104,6 +104,7 @@ class CronjobPackageInstallationPlugin extends AbstractXMLPackageInstallationPlu unset($data['cronjobName']); } + /** @var Cronjob $cronjob */ $cronjob = parent::import($row, $data); // update cronjob name diff --git a/wcfsetup/install/files/lib/system/package/plugin/EventListenerPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/EventListenerPackageInstallationPlugin.class.php index d29d7413db..a6c794a134 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/EventListenerPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/EventListenerPackageInstallationPlugin.class.php @@ -95,6 +95,7 @@ class EventListenerPackageInstallationPlugin extends AbstractXMLPackageInstallat unset($data['listenerName']); } + /** @var EventListener $eventListener */ $eventListener = parent::import($row, $data); // update event listener name diff --git a/wcfsetup/install/files/lib/system/package/plugin/FilePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/FilePackageInstallationPlugin.class.php index 274b0e9d45..8b88cfe29a 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/FilePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/FilePackageInstallationPlugin.class.php @@ -101,6 +101,7 @@ class FilePackageInstallationPlugin extends AbstractPackageInstallationPlugin { } foreach ($files as $application => $filenames) { + /** @noinspection PhpUndefinedMethodInspection */ $this->installation->deleteFiles(Application::getDirectory($application), $filenames); // delete log entries diff --git a/wcfsetup/install/files/lib/system/package/plugin/MenuItemPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/MenuItemPackageInstallationPlugin.class.php index 844b3055d0..1720f6a80c 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/MenuItemPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/MenuItemPackageInstallationPlugin.class.php @@ -99,6 +99,8 @@ class MenuItemPackageInstallationPlugin extends AbstractXMLPackageInstallationPl WHERE identifier = ?"; $statement = WCF::getDB()->prepareStatement($sql, 1); $statement->execute([$data['elements']['parent']]); + + /** @var MenuItem|null $parent */ $parent = $statement->fetchObject(MenuItem::class); if ($parent === null) { throw new SystemException("Unable to find parent menu item '" . $data['elements']['parent'] . "' for menu item '" . $data['attributes']['identifier'] . "'"); diff --git a/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php index c21f8ab710..0f0b8307fc 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php @@ -202,6 +202,8 @@ class MenuPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); $boxes = []; + + /** @var Box $box */ while ($box = $statement->fetchObject(Box::class)) { $boxes[$box->identifier] = $box; } diff --git a/wcfsetup/install/files/lib/system/package/plugin/PagePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/PagePackageInstallationPlugin.class.php index 098eb76ffc..20fd6fbc89 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/PagePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/PagePackageInstallationPlugin.class.php @@ -1,6 +1,7 @@ $data['controller']]); + $page = parent::import($row, ['controller' => $data['controller']]); } else { $baseClass = call_user_func([$this->className, 'getBaseClass']); - $object = new $baseClass(null, $row); + $page = new $baseClass(null, $row); } } else { // import - $object = parent::import($row, $data); + $page = parent::import($row, $data); } // store content for later import - $this->content[$object->pageID] = $content; + $this->content[$page->pageID] = $content; - return $object; + return $page; } /** diff --git a/wcfsetup/install/files/lib/system/package/plugin/TemplatePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/TemplatePackageInstallationPlugin.class.php index c599d03999..78883fd36d 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/TemplatePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/TemplatePackageInstallationPlugin.class.php @@ -75,6 +75,7 @@ class TemplatePackageInstallationPlugin extends AbstractPackageInstallationPlugi } foreach ($templates as $application => $templateNames) { + /** @noinspection PhpUndefinedMethodInspection */ $this->installation->deleteFiles(Application::getDirectory($application), $templateNames, false, $this->installation->getPackage()->isApplication); // delete log entries diff --git a/wcfsetup/install/files/lib/system/package/plugin/UserNotificationEventPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/UserNotificationEventPackageInstallationPlugin.class.php index aa28ff0ffd..42894d9bb1 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/UserNotificationEventPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/UserNotificationEventPackageInstallationPlugin.class.php @@ -1,5 +1,6 @@ presetEventIDs[$result->eventID] = $data['presetMailNotificationType']; + $this->presetEventIDs[$event->eventID] = $data['presetMailNotificationType']; } - return $result; + return $event; } /** -- 2.20.1