Fix code warnings for PIPs
authorMatthias Schmidt <gravatronics@live.com>
Sat, 21 May 2016 16:55:23 +0000 (18:55 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sat, 21 May 2016 18:42:02 +0000 (20:42 +0200)
14 files changed:
wcfsetup/install/files/lib/system/package/plugin/ACLOptionPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/ACPTemplatePackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/AbstractOptionPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/BBCodePackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/ClipboardActionPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/CronjobPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/EventListenerPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/FilePackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/MenuItemPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/PagePackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/TemplatePackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/UserNotificationEventPackageInstallationPlugin.class.php

index 2346a8b55679a9ef2f51b4926c092d75214fc1cb..55c47ae0819754a13e6dd726b85eb726206d08e2 100644 (file)
@@ -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);
index 0909688c4afd15489fd14505c634d6e68ee4e306..2b2cbfa9ee9ddd143855b84a1c8a9906fa0925ef 100644 (file)
@@ -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
index 49278235d7252a38e1aa475f913f6249bf91b07b..93d71ac011144037e701cc39780e4e7494705bbb 100644 (file)
@@ -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);
index 4e1a04683ea27104e8ba8f55b5ffcc9cd4ada524..4e43d601fc9a3cb27491b6fea7ec8d2bf245e431 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 namespace wcf\system\package\plugin;
 use wcf\data\bbcode\attribute\BBCodeAttributeEditor;
+use wcf\data\bbcode\BBCode;
 use wcf\data\bbcode\BBCodeEditor;
 use wcf\data\package\PackageCache;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
@@ -148,11 +149,13 @@ class BBCodePackageInstallationPlugin extends AbstractXMLPackageInstallationPlug
                $attributes = $data['attributes'];
                unset($data['attributes']);
                
-               // import or update action
-               $object = parent::import($row, $data);
+               /** @var BBCode $bbcode */
+               $bbcode = parent::import($row, $data);
                
                // store attributes for later import
-               $this->attributes[$object->bbcodeID] = $attributes;
+               $this->attributes[$bbcode->bbcodeID] = $attributes;
+               
+               return $bbcode;
        }
        
        /**
index 6a1506f6e002fafdf27fe33ef566219b7b04caa8..a59e290306c8fd74b31714544c49d7c655b2af50 100644 (file)
@@ -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;
                }
index 0bde28501c8692e32ecea8b241326ecaf2511be7..2b5306665b508af3e51d9de71f143d34eca81c70 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\system\package\plugin;
+use wcf\data\clipboard\action\ClipboardAction;
 use wcf\data\clipboard\action\ClipboardActionEditor;
 use wcf\system\WCF;
 
@@ -111,11 +112,13 @@ class ClipboardActionPackageInstallationPlugin extends AbstractXMLPackageInstall
                $pages = $data['pages'];
                unset($data['pages']);
                
-               // import or update action
-               $object = parent::import($row, $data);
+               /** @var ClipboardAction $action */
+               $action = parent::import($row, $data);
                
                // store pages for later import
-               $this->pages[$object->actionID] = $pages;
+               $this->pages[$action->actionID] = $pages;
+               
+               return $action;
        }
        
        /**
index 6c4473918389c13e715db441ca191ea083eb3826..2ab6c15b65c5a4d295103cf1b6c18a60686ef220 100644 (file)
@@ -104,6 +104,7 @@ class CronjobPackageInstallationPlugin extends AbstractXMLPackageInstallationPlu
                        unset($data['cronjobName']);
                }
                
+               /** @var Cronjob $cronjob */
                $cronjob = parent::import($row, $data);
                
                // update cronjob name
index d29d7413db639dbee234e0b5103af924d8823e3c..a6c794a134f8c97cca6e7148337a649c7ed08487 100644 (file)
@@ -95,6 +95,7 @@ class EventListenerPackageInstallationPlugin extends AbstractXMLPackageInstallat
                        unset($data['listenerName']);
                }
                
+               /** @var EventListener $eventListener */
                $eventListener = parent::import($row, $data);
                
                // update event listener name
index 274b0e9d457b8a6bf70e9352135ba9471990266b..8b88cfe29a298df9b31f88234b61efbe5412486f 100644 (file)
@@ -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
index 844b3055d0a6aaaccd3711039e338a8db3ef92c0..1720f6a80cbf2eb7827bdc09e2bc24b7e85a9c54 100644 (file)
@@ -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'] . "'");
index c21f8ab7109c8de53850404e2f19b80d9d1f6621..0f0b8307fc982a023b20718eb6ec3a4299a1ee44 100644 (file)
@@ -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;
                }
index 098eb76ffc3c069e50a5fe3d3aa7b09e60435f57..20fd6fbc898874c72fb843e88c109c103b160fa6 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 namespace wcf\system\package\plugin;
 use wcf\data\package\PackageCache;
+use wcf\data\page\Page;
 use wcf\data\page\PageEditor;
 use wcf\system\exception\SystemException;
 use wcf\system\language\LanguageFactory;
@@ -250,25 +251,26 @@ class PagePackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin
                $content = $data['content'];
                unset($data['content']);
                
+               /** @var Page $page */
                if (!empty($row)) {
                        // allow only updating of controller, everything else would overwrite user modifications
                        if (!empty($data['controller'])) {
-                               $object = parent::import($row, ['controller' => $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;
        }
        
        /**
index c599d0399929fdd362611e7640fb56170d8fec55..78883fd36d042e303272e01bce081e2ccfe4ba10 100644 (file)
@@ -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
index aa28ff0ffdce27a3af75e680cfd7c642939cd5e8..42894d9bb109f80ab2eafac89d41963695cfc3e7 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\system\package\plugin;
+use wcf\data\user\notification\event\UserNotificationEvent;
 use wcf\data\user\notification\event\UserNotificationEventEditor;
 use wcf\system\exception\SystemException;
 use wcf\system\WCF;
@@ -91,13 +92,14 @@ class UserNotificationEventPackageInstallationPlugin extends AbstractXMLPackageI
         * @inheritDoc
         */
        protected function import(array $row, array $data) {
-               $result = parent::import($row, $data);
+               /** @var UserNotificationEvent $event */
+               $event = parent::import($row, $data);
                
                if (empty($row) && $data['preset']) {
-                       $this->presetEventIDs[$result->eventID] = $data['presetMailNotificationType'];
+                       $this->presetEventIDs[$event->eventID] = $data['presetMailNotificationType'];
                }
                
-               return $result;
+               return $event;
        }
        
        /**