Fix warnings about unused local variables
authorMatthias Schmidt <gravatronics@live.com>
Fri, 27 May 2016 07:08:04 +0000 (09:08 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Fri, 27 May 2016 09:48:12 +0000 (11:48 +0200)
30 files changed:
wcfsetup/install/files/lib/acp/form/PaidSubscriptionUserAddForm.class.php
wcfsetup/install/files/lib/acp/page/ExceptionLogViewPage.class.php
wcfsetup/install/files/lib/action/PaypalCallbackAction.class.php
wcfsetup/install/files/lib/core.functions.php
wcfsetup/install/files/lib/data/ad/AdEditor.class.php
wcfsetup/install/files/lib/data/comment/CommentAction.class.php
wcfsetup/install/files/lib/data/comment/LikeableComment.class.php
wcfsetup/install/files/lib/data/comment/response/LikeableCommentResponse.class.php
wcfsetup/install/files/lib/data/notice/NoticeEditor.class.php
wcfsetup/install/files/lib/data/paid/subscription/PaidSubscriptionEditor.class.php
wcfsetup/install/files/lib/data/style/StyleEditor.class.php
wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php
wcfsetup/install/files/lib/system/cache/builder/UserBirthdayCacheBuilder.class.php
wcfsetup/install/files/lib/system/cli/command/CLICommandHandler.class.php
wcfsetup/install/files/lib/system/cli/command/PackageCLICommand.class.php
wcfsetup/install/files/lib/system/condition/AbstractIntegerCondition.class.php
wcfsetup/install/files/lib/system/cronjob/BackgroundQueueCleanUpCronjob.class.php
wcfsetup/install/files/lib/system/image/adapter/GDImageAdapter.class.php
wcfsetup/install/files/lib/system/importer/UserImporter.class.php
wcfsetup/install/files/lib/system/like/LikeHandler.class.php
wcfsetup/install/files/lib/system/message/quote/MessageQuoteManager.class.php
wcfsetup/install/files/lib/system/option/MessageOptionType.class.php
wcfsetup/install/files/lib/system/option/user/group/BBCodeSelectUserGroupOptionType.class.php
wcfsetup/install/files/lib/system/request/FlexibleRoute.class.php
wcfsetup/install/files/lib/system/request/LinkHandler.class.php
wcfsetup/install/files/lib/system/search/SearchResultTextParser.class.php
wcfsetup/install/files/lib/system/template/TemplateEngine.class.php
wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php
wcfsetup/install/files/lib/util/CronjobUtil.class.php
wcfsetup/install/files/lib/util/Diff.class.php

index b3da84c313790a6ec3a87d9bb6eb22303a66999e..a7973735f8dd6f3273ab30a33c1728024af8cd7a 100644 (file)
@@ -136,8 +136,7 @@ class PaidSubscriptionUserAddForm extends AbstractForm {
                                'subscription' => $this->subscription,
                                'data' => $data
                        ]);
-                       $returnValues = $action->executeAction();
-                       $userSubscription = $returnValues['returnValues'];
+                       $action->executeAction();
                }
                else {
                        // extend existing subscription
index e94aea00c9147b18c3e2d0c07cd618c9ac7ddb11..9b20d9313d3bf32b96e16a2528e29b2abc6349d0 100644 (file)
@@ -151,7 +151,6 @@ Error Code: (?P<code>\d+)\s*
 File: (?P<file>.*?) \((?P<line>\d+)\)\s*
 Extra Information: (?P<information>(?:-|[a-zA-Z0-9+/]+={0,2}))\s*
 Stack Trace: (?P<stack>[a-zA-Z0-9+/]+={0,2})', Regex::DOT_ALL);
-               $stackTraceFormatter = new Regex('^\s+(#\d+)', Regex::MULTILINE);
                foreach ($this->exceptions as $key => $val) {
                        $i++;
                        if ($i < $this->startIndex || $i > $this->endIndex) {
index 478662a35aad152399def2deb06c78f17fc37af0..6f4357f11d94c9202f811f0b212d085b9568d3d9 100644 (file)
@@ -27,6 +27,7 @@ class PaypalCallbackAction extends AbstractAction {
                $processor = null;
                try {
                        // post back to paypal to validate 
+                       /** @noinspection PhpUnusedLocalVariableInspection */
                        $content = '';
                        try {
                                $url = 'https://www.paypal.com/cgi-bin/webscr';
index d314cbdf48348475726fff44b9a74a81be351f53..7a6620146cfa884d14ea0819dd2022bf68cc897a 100644 (file)
@@ -442,9 +442,6 @@ EXPLANATION;
                                                                <ul class="exceptionStacktrace">
                                                                        <?php
                                                                        $trace = sanitizeStacktrace($e);
-                                                                       $pathLength = array_reduce($trace, function ($carry, $item) {
-                                                                               return max($carry, mb_strlen($item['file'].$item['line']));
-                                                                       }, 0) + 3;
                                                                        for ($i = 0, $max = count($trace); $i < $max; $i++) {
                                                                                ?>
                                                                                <li class="exceptionStacktraceFile"><?php echo '#'.$i.' '.StringUtil::encodeHTML($trace[$i]['file']).' ('.$trace[$i]['line'].')'.':'; ?></li>
index 74e0da70fe7850f962c6aded676bd8236130994a..91c32cb2d92a4a54d347cf2706cafd446254c9f3 100644 (file)
@@ -32,8 +32,6 @@ class AdEditor extends DatabaseObjectEditor implements IEditableCachedObject {
         * @param       integer         $showOrder
         */
        public function setShowOrder($showOrder = 0) {
-               $newShowOrder = 1;
-               
                $sql = "SELECT  MAX(showOrder)
                        FROM    wcf".WCF_N."_ad";
                $statement = WCF::getDB()->prepareStatement($sql);
index 2185311d2043e536bd7911fc0d119568b9a81ce1..1ae8206607e4c5f91de56c93c727d78115f1955a 100644 (file)
@@ -477,7 +477,6 @@ class CommentAction extends AbstractDatabaseObjectAction {
         * @return      array
         */
        public function prepareEdit() {
-               $message = '';
                if ($this->comment !== null) {
                        $message = $this->comment->message;
                }
index 6f8f54daa1e501160dfb7bb596d5a5ea4ef55f18..cea7adee012689f797cc9a52b03e51fb5c322fbf 100644 (file)
@@ -65,7 +65,6 @@ class LikeableComment extends AbstractLikeObject {
        public function sendNotification(Like $like) {
                $objectType = CommentHandler::getInstance()->getObjectType($this->object->objectTypeID);
                if (UserNotificationHandler::getInstance()->getObjectTypeID($objectType->objectType.'.like.notification')) {
-                       $notificationObjectType = UserNotificationHandler::getInstance()->getObjectTypeProcessor($objectType->objectType.'.like.notification');
                        if ($this->userID != WCF::getUser()->userID) {
                                $notificationObject = new LikeUserNotificationObject($like);
                                UserNotificationHandler::getInstance()->fireEvent('like', $objectType->objectType.'.like.notification', $notificationObject, [$this->userID], [
index a1fd084bc3b3ac6fa533096ae80d7303152e8693..d14e8884a91b8f642fa92c194e60ed9ea8d273cc 100644 (file)
@@ -67,7 +67,6 @@ class LikeableCommentResponse extends AbstractLikeObject {
                $comment = new Comment($this->object->commentID);
                $objectType = CommentHandler::getInstance()->getObjectType($comment->objectTypeID);
                if (UserNotificationHandler::getInstance()->getObjectTypeID($objectType->objectType.'.response.like.notification')) {
-                       $notificationObjectType = UserNotificationHandler::getInstance()->getObjectTypeProcessor($objectType->objectType.'.response.like.notification');
                        if ($this->userID != WCF::getUser()->userID) {
                                $notificationObject = new LikeUserNotificationObject($like);
                                UserNotificationHandler::getInstance()->fireEvent('like', $objectType->objectType.'.response.like.notification', $notificationObject, [$this->userID], [
index ecdca8344e869ac2e357d86794a70b15a2a3246a..cff05197bb3b1eb841f565f11b09a8fa222ea165 100644 (file)
@@ -32,8 +32,6 @@ class NoticeEditor extends DatabaseObjectEditor implements IEditableCachedObject
         * @param       integer         $showOrder
         */
        public function setShowOrder($showOrder = 0) {
-               $newShowOrder = 1;
-               
                $sql = "SELECT  MAX(showOrder)
                        FROM    wcf".WCF_N."_notice";
                $statement = WCF::getDB()->prepareStatement($sql);
index 53ce8b20fc3f78693f194008e48ea9995278ca79..35f6552eb86059aae662b6dab1193fb5031c1065 100644 (file)
@@ -30,8 +30,6 @@ class PaidSubscriptionEditor extends DatabaseObjectEditor implements IEditableCa
         * @param       integer         $showOrder
         */
        public function setShowOrder($showOrder = 0) {
-               $newShowOrder = 1;
-               
                $sql = "SELECT  MAX(showOrder)
                        FROM    wcf".WCF_N."_paid_subscription";
                $statement = WCF::getDB()->prepareStatement($sql);
index 0f1c17c00d31c864268f7f181e29c74505a3b637..71a678fb794da613d8761935425f60a96c193d15 100644 (file)
@@ -250,7 +250,6 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject
                // open variables.xml
                $xml = new XML();
                $xml->loadXML($filename, $content);
-               $xpath = $xml->xpath();
                $variables = $xml->xpath()->query('/ns:variables/ns:variable');
                
                $data = [];
index 2427d1cae6b576fae96238e3f67f30be1d3e17d5..cc3733bb20dde9e07a3ed3d86369460b01da5aa5 100644 (file)
@@ -73,7 +73,6 @@ class AttachmentBBCode extends AbstractBBCode {
                                        }
                                }
                                
-                               $result = '';
                                if ($width > 0) {
                                        $class = '';
                                        if ($alignment == 'left' || $alignment == 'right') {
index 5ad5f6d72ed6af15aed7d994f30653c8cd5d651f..0f724966d1bd0083bb2f463000217885cd1e7633 100644 (file)
@@ -37,7 +37,7 @@ class UserBirthdayCacheBuilder extends AbstractCacheBuilder {
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute(['%-' . ($parameters['month'] < 10 ? '0' : '') . $parameters['month'] . '-%']);
                while ($row = $statement->fetchArray()) {
-                       list($year, $month, $day) = explode('-', $row[$birthday]);
+                       list(, $month, $day) = explode('-', $row[$birthday]);
                        if (!isset($data[$month . '-' . $day])) $data[$month . '-' . $day] = [];
                        $data[$month . '-' . $day][] = $row['userID'];
                }
index f3df5cb6dc6082a778d6d0c0cd0324782be5e0ae..65259eab24470be1d5797c3b11cc791746a8b0ed 100644 (file)
@@ -61,7 +61,7 @@ class CLICommandHandler {
         * @throws      IllegalLinkException
         */
        public static function getCommand($line) {
-               list($command, $parameters) = explode(' ', $line.' ', 2);
+               list($command, ) = explode(' ', $line.' ', 2);
                
                if (!isset(self::$commands[strtolower($command)])) throw new IllegalLinkException();
                
@@ -76,7 +76,7 @@ class CLICommandHandler {
         * @throws      IllegalLinkException
         */
        public static function getCommandName($line) {
-               list($command, $parameters) = explode(' ', $line.' ', 2);
+               list($command, ) = explode(' ', $line.' ', 2);
                
                if (!isset(self::$commands[strtolower($command)])) throw new IllegalLinkException();
                
@@ -90,7 +90,7 @@ class CLICommandHandler {
         * @return      string[]
         */
        public static function getParameters($line) {
-               list ($command, $parameters) = explode(' ', $line.' ', 2);
+               list (, $parameters) = explode(' ', $line.' ', 2);
                
                $chars = str_split(StringUtil::trim($parameters));
                $tmp = '';
index 4cf52278a500f017d08490d6b2a7dd218ae90c33..5697256b4621d511b61a164fc327cb092f86c947 100644 (file)
@@ -159,7 +159,7 @@ class PackageCLICommand implements IArgumentedCLICommand {
                $processNo = PackageInstallationQueue::getNewProcessNo();
                
                // insert queue
-               $queue = PackageInstallationQueueEditor::create([
+               PackageInstallationQueueEditor::create([
                        'processNo' => $processNo,
                        'userID' => CLIWCF::getUser()->userID,
                        'package' => $archive->getPackageInfo('name'),
@@ -309,9 +309,8 @@ class PackageCLICommand implements IArgumentedCLICommand {
                                        // InstallPackageAction::stepInstall()
                                        $step_ = $installation->install($node);
                                        $queueID = $installation->nodeBuilder->getQueueByNode($installation->queue->processNo, $step_->getNode());
-                                               
+                                       
                                        if ($step_->hasDocument()) {
-                                               $innerTemplate = $step_->getTemplate();
                                                $progress = $installation->nodeBuilder->calculateProgress($node);
                                                $node = $step_->getNode();
                                                $currentAction = $installation->nodeBuilder->getPackageNameByQueue($queueID);
index 3d8c5ed97a6a2bf9b0bdc7470cdceda6fad13ec9..b4859a120312dc5c317ab0d693e3da1ef443a8f7 100644 (file)
@@ -76,7 +76,6 @@ abstract class AbstractIntegerCondition extends AbstractSingleFieldCondition {
         */
        protected function getErrorMessageElement() {
                if ($this->errorMessage) {
-                       $errorMessage = '';
                        switch ($this->errorMessage) {
                                case 'wcf.condition.greaterThan.error.maxValue':
                                        $errorMessage = WCF::getLanguage()->getDynamicVariable($this->errorMessage, [
index a59004323d72c62d7257f56ccb96b331704eacc9..a8ba91069f7574bf9d46cb0df2b950903a91ae76 100644 (file)
@@ -24,6 +24,7 @@ class BackgroundQueueCleanUpCronjob extends AbstractCronjob {
                parent::execute($cronjob);
                
                WCF::getDB()->beginTransaction();
+               /** @noinspection PhpUnusedLocalVariableInspection */
                $commited = false;
                try {
                        $sql = "SELECT          jobID, job
index e311aedeee12c44761673a0b5650ba29ecb82f3a..89397bc69053eabb885768a34d5dd632e6015d2a 100644 (file)
@@ -108,7 +108,7 @@ class GDImageAdapter implements IImageAdapter {
         * @inheritDoc
         */
        public function createThumbnail($maxWidth, $maxHeight, $obtainDimensions = true) {
-               $width = $height = $x = $y = 0;
+               $x = $y = 0;
                $sourceWidth = $this->width;
                $sourceHeight = $this->height;
                
index 576152af1f62bec3bf21a644d9416568e4cc5043..ec3ddcdb351212e80128fa9cc9efc634f8454f43 100644 (file)
@@ -229,7 +229,6 @@ class UserImporter extends AbstractImporter {
         */
        private static function resolveDuplicate($username) {
                $i = 0;
-               $newUsername = '';
                do {
                        $i++;
                        $newUsername = 'Duplicate'.($i > 1 ? $i : '').' '.$username;
index 6a09218e7a6dbcb5df711f155db4eac73a5b14a5..8b800bbf52bba266e474efaec647c90524db9802 100644 (file)
@@ -174,7 +174,9 @@ class LikeHandler extends SingletonFactory {
                        WCF::getDB()->beginTransaction();
                        
                        // like data
+                       /** @noinspection PhpUnusedLocalVariableInspection */
                        $cumulativeLikes = 0;
+                       /** @noinspection PhpUnusedLocalVariableInspection */
                        $newValue = $oldValue = null;
                        $users = [];
                        
index 03f404b4fb1e4548bf9c5ab0ca037bab38965457..21e45c30816f207244882752a4afadc9bbc0c0c1 100644 (file)
@@ -244,7 +244,6 @@ class MessageQuoteManager extends SingletonFactory {
                }
                
                // find the quote and simulate a regular call to render quotes
-               $quoteData = [];
                foreach ($this->quotes as $objectType => $objectIDs) {
                        foreach ($objectIDs as $objectID => $quoteIDs) {
                                if (isset($quoteIDs[$quoteID])) {
index 48dc6333453fcac58f9aecf99f1158420a7dcac2..b088993fb47c95bf7df181f435c2ec39da46f542 100644 (file)
@@ -34,7 +34,6 @@ class MessageOptionType extends TextareaOptionType {
         * @inheritDoc
         */
        public function getFormElement(Option $option, $value) {
-               $allowedBBCodes = [];
                if ($option->allowedbbcodepermission) {
                        $allowedBBCodes = explode(',', WCF::getSession()->getPermission($option->allowedbbcodepermission));
                }
index 79696fb785fa1fb5772528329bed424538ea2df1..9d424106bd0d5d362b622e0b9116847da14fb6d4 100644 (file)
@@ -43,7 +43,6 @@ class BBCodeSelectUserGroupOptionType extends AbstractOptionType implements IUse
                        $this->loadBBCodeSelection();
                }
                
-               $selectedBBCodes = [];
                if ($value == 'all') {
                        $selectedBBCodes = $this->bbCodes;
                }
index 127f66a9b6f5b227faa142df6a6adb8ea43d097f..89270b34a506fd382323cf71509c0c17fbca89d3 100644 (file)
@@ -81,7 +81,6 @@ class FlexibleRoute implements IRoute {
                
                $buildSchema = ltrim($buildSchema, '/');
                $components = preg_split('~({(?:[a-z]+)})~', $buildSchema, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
-               $delimiters = ['/', '-', '.', '_'];
                
                foreach ($components as $component) {
                        $type = 'component';
index 44049d24843ae2a7926c7cf4e815c9b75eda230d..161fca72c6751b6685e39898797ffc566a205833 100644 (file)
@@ -74,6 +74,7 @@ class LinkHandler extends SingletonFactory {
                /**
                 * @deprecated 2.2 - no longer required
                 */
+               /** @noinspection PhpUnusedLocalVariableInspection */
                $appendSession = false;
                
                // enforce a certain level of sanitation and protection for links embedded in emails
index 52aaba16bf06d794acb3b5dd0109ce52c8e039d8..925499894c905cb602bcda641a4354ba56ef4364 100644 (file)
@@ -84,7 +84,7 @@ class SearchResultTextParser extends SingletonFactory {
                                                        $shiftEndBy += $shiftStartBy;
                                                        $shiftStartBy = 0;
                                                }
-                                                       
+                                               
                                                // shift abstract start
                                                if ($start - $shiftStartBy < 0) {
                                                        $shiftEndBy += $shiftStartBy - $start;
@@ -97,7 +97,6 @@ class SearchResultTextParser extends SingletonFactory {
                                                // shift abstract end
                                                if ($end + $shiftEndBy > mb_strlen($text) - 1) {
                                                        $shiftStartBy = $end + $shiftEndBy - mb_strlen($text) - 1;
-                                                       $shiftEndBy = 0;
                                                        if ($shiftStartBy > $start) {
                                                                $start = 0;
                                                        }
index 92f620e1534d94fa93eadfed1c796a004e7b0789..bd466b84cc21b561449a79e147c32e19b8cf32df 100755 (executable)
@@ -483,6 +483,7 @@ class TemplateEngine extends SingletonFactory {
         * @throws      SystemException
         */
        public function getSourceContent($sourceFilename) {
+               /** @noinspection PhpUnusedLocalVariableInspection */
                $sourceContent = '';
                if (!file_exists($sourceFilename) || (($sourceContent = @file_get_contents($sourceFilename)) === false)) {
                        throw new SystemException("Could not open template '$sourceFilename' for reading");
index 1da4908cf9db72edad1f43298fff2b0944021f51..a59ff5b1aca7d398d08d7b0e9046cc83e509f973 100644 (file)
@@ -784,7 +784,6 @@ class TemplateScriptingCompiler {
                        }
                        
                        // pass remaining tag args as variables
-                       $variables = [];
                        if (!empty($args)) {
                                foreach ($args as $variable => $value) {
                                        if (substr($value, 0, 1) == "'") {
@@ -806,7 +805,6 @@ class TemplateScriptingCompiler {
                        if (!empty($phpCode)) $phpCode = "<?php\n".$phpCode."\n?>";
                        
                        $sourceFilename = $this->template->getSourceFilename($templateName, $application);
-                       $metaDataFilename = $this->template->getMetaDataFilename($templateName);
                        
                        $data = $this->compileString($templateName, file_get_contents($sourceFilename), [
                                'application' => $application,
@@ -1012,7 +1010,7 @@ class TemplateScriptingCompiler {
         * @return      string          $tag
         */
        public function popTag($tag) {
-               list($openTag, $lineNo) = array_pop($this->tagStack);
+               list($openTag, ) = array_pop($this->tagStack);
                if ($tag == $openTag) {
                        return $openTag;
                }
index 3af6774dfca6cf080c74541161b3295a3f372754..2c4c7b6ba2fbf774d242d3b97ee951b3416b107d 100644 (file)
@@ -143,8 +143,7 @@ final class CronjobUtil {
                // calculation starts with month, thus start with
                // month of $time (if within values)
                $currentMonth = gmdate('n', self::$timeBase);
-               $currentYear = gmdate('Y', self::$timeBase);
-               $index = self::findKey($currentMonth, $values['month']);
+               self::findKey($currentMonth, $values['month']);
                
                self::calculateDay($values);
        }
index dbfa8963bdc37629382499034d773db0fa7ac393..17fd38db2f4ca604b6d80b091fa2f85cfc5e3d4f 100644 (file)
@@ -245,11 +245,10 @@ class Diff {
                $result[] = "--- a";
                $result[] = "+++ b";
                
-               $inContext = 0;
                $leftStart = 1;
                $rightStart = 1;
                for ($i = 0, $max = count($d); $i < $max; $i++) {
-                       list($type, $line) = $d[$i];
+                       list($type, ) = $d[$i];
                        
                        if ($type == self::REMOVED || $type == self::ADDED) {
                                // calculate start of context
@@ -266,7 +265,7 @@ class Diff {
                                // search the end of the current window
                                $plus = $minus = 0;
                                for ($j = $start; $j < $max; $j++) {
-                                       list($type, $line) = $d[$j];
+                                       list($type, ) = $d[$j];
                                        
                                        switch ($type) {
                                                case self::REMOVED: