EBernhardson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/119890

Change subject: Cleanup another round of analysis warnings
......................................................................

Cleanup another round of analysis warnings

Change-Id: Ic8eb1cebe50ba0b9635ed308e1e4a00e7cf465aa
---
M includes/Block/Block.php
M includes/Block/BoardHistory.php
M includes/Data/ObjectLocator.php
M includes/Data/RootPostLoader.php
M includes/Data/TopKIndex.php
M includes/Formatter/ContributionsQuery.php
M includes/Log/Logger.php
M includes/Log/PostModerationLogger.php
M includes/Model/Workflow.php
M includes/Parsoid/BadImageRemover.php
M includes/Parsoid/Controller.php
M includes/Parsoid/Redlinker.php
M includes/Parsoid/Utils.php
M includes/RevisionActionPermissions.php
14 files changed, 17 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/90/119890/1

diff --git a/includes/Block/Block.php b/includes/Block/Block.php
index cef5de2..aba87ba 100644
--- a/includes/Block/Block.php
+++ b/includes/Block/Block.php
@@ -105,6 +105,7 @@
        }
 
        public function onSubmit( $action, User $user, array $data  ) {
+               /** @noinspection PhpUnusedLocalVariableInspection */
                $section = new \ProfileSection( __METHOD__ );
                if ( false === array_search( $this->getActionName( $action ), 
$this->supportedPostActions ) ) {
                        return null;
@@ -119,6 +120,7 @@
        }
 
        public function onRender( $action, Templating $templating, array 
$options ) {
+               /** @noinspection PhpUnusedLocalVariableInspection */
                $section = new \ProfileSection( __METHOD__ );
                if ( !in_array( $this->getActionName( $action ), 
$this->supportedGetActions ) ) {
                        return false;
diff --git a/includes/Block/BoardHistory.php b/includes/Block/BoardHistory.php
index 0fdee39..3225040 100644
--- a/includes/Block/BoardHistory.php
+++ b/includes/Block/BoardHistory.php
@@ -9,7 +9,6 @@
 use Flow\View\History\HistoryRenderer;
 use Flow\Container;
 use Flow\Templating;
-use Flow\Exception\InvalidDataException;
 use Flow\Exception\DataModelException;
 
 class BoardHistoryBlock extends AbstractBlock {
diff --git a/includes/Data/ObjectLocator.php b/includes/Data/ObjectLocator.php
index dcd2cf1..b43c460 100644
--- a/includes/Data/ObjectLocator.php
+++ b/includes/Data/ObjectLocator.php
@@ -62,6 +62,7 @@
         * @return array|null  null is query failure.  empty array is no 
result.  array is success
         */
        public function findMulti( array $queries, array $options = array() ) {
+               /** @noinspection PhpUnusedLocalVariableInspection */
                $section = new \ProfileSection( __METHOD__ );
                if ( !$queries ) {
                        return array();
@@ -117,6 +118,7 @@
         * @return bool
         */
        public function foundMulti( array $queries, array $options = array() ) {
+               /** @noinspection PhpUnusedLocalVariableInspection */
                $section = new \ProfileSection( __METHOD__ );
                if ( !$queries ) {
                        return true;
@@ -152,6 +154,7 @@
        // Be careful with regards to order on composite primary keys,
        // must be in same order as provided to the storage implementation.
        public function getMulti( array $objectIds ) {
+               /** @noinspection PhpUnusedLocalVariableInspection */
                $section = new \ProfileSection( __METHOD__ );
                if ( !$objectIds ) {
                        return array();
@@ -199,6 +202,7 @@
         * @return bool
         */
        public function gotMulti( array $objectIds ) {
+               /** @noinspection PhpUnusedLocalVariableInspection */
                $section = new \ProfileSection( __METHOD__ );
                if ( !$objectIds ) {
                        return true;
diff --git a/includes/Data/RootPostLoader.php b/includes/Data/RootPostLoader.php
index cb4815b..93bee54 100644
--- a/includes/Data/RootPostLoader.php
+++ b/includes/Data/RootPostLoader.php
@@ -26,6 +26,7 @@
         * @param UUID|string $postId The uid of the post being requested
         * @return PostRevision[] associative array with 'root' and 'post' 
keys. Array
         *   values may be null if not found.
+        * @throws InvalidDataException
         */
        public function getWithRoot( $postId ) {
                $postId = UUID::create( $postId );
diff --git a/includes/Data/TopKIndex.php b/includes/Data/TopKIndex.php
index 17725fc..6507e76 100644
--- a/includes/Data/TopKIndex.php
+++ b/includes/Data/TopKIndex.php
@@ -136,7 +136,8 @@
        public function sortIndex( array $values ) {
                // I dont think this is a valid way to sort a 128bit integer 
string
                $callback = new SortArrayByKeys( $this->options['sort'], true );
-               usort( $values, $callback );
+        /** @noinspection PhpParamsInspection */
+        usort( $values, $callback );
                if ( $this->options['order'] === 'DESC' ) {
                        $values = array_reverse( $values );
                }
diff --git a/includes/Formatter/ContributionsQuery.php 
b/includes/Formatter/ContributionsQuery.php
index fb4fa85..7b36d3b 100644
--- a/includes/Formatter/ContributionsQuery.php
+++ b/includes/Formatter/ContributionsQuery.php
@@ -11,7 +11,6 @@
 use Flow\Model\PostRevision;
 use Flow\Model\Header;
 use Flow\Model\Workflow;
-use Flow\Data\RawSql;
 use Flow\Data\ManagerGroup;
 use Flow\Model\UUID;
 use Flow\Repository\TreeRepository;
diff --git a/includes/Log/Logger.php b/includes/Log/Logger.php
index bcfc981..c9db530 100644
--- a/includes/Log/Logger.php
+++ b/includes/Log/Logger.php
@@ -4,7 +4,6 @@
 
 use Flow\FlowActions;
 use Flow\Model\PostRevision;
-use Flow\Model\Workflow;
 use Flow\UrlGenerator;
 use ManualLogEntry;
 use User;
@@ -60,6 +59,7 @@
         * @return int The id of the newly inserted log entry
         */
        public function log( PostRevision $post, $action, $reason, UUID 
$workflowId, $params = array() ) {
+               /** @noinspection PhpUnusedLocalVariableInspection */
                $section = new \ProfileSection( __METHOD__ );
 
                if ( !$this->canLog( $post, $action ) ) {
diff --git a/includes/Log/PostModerationLogger.php 
b/includes/Log/PostModerationLogger.php
index 2e1f5f9..c2c85ae 100644
--- a/includes/Log/PostModerationLogger.php
+++ b/includes/Log/PostModerationLogger.php
@@ -3,10 +3,8 @@
 namespace Flow\Log;
 
 use Flow\Data\LifecycleHandler;
-use Flow\Data\ManagerGroup;
 use Flow\Model\AbstractRevision;
 use Flow\Model\PostRevision;
-use Flow\Repository\TreeRepository;
 
 class PostModerationLogger implements LifecycleHandler {
 
diff --git a/includes/Model/Workflow.php b/includes/Model/Workflow.php
index c0f8842..4c6acea 100644
--- a/includes/Model/Workflow.php
+++ b/includes/Model/Workflow.php
@@ -120,7 +120,6 @@
                        'workflow_page_id' => $obj->pageId,
                        'workflow_namespace' => $obj->namespace,
                        'workflow_title_text' => $obj->titleText,
-                       'workflow_name' => '', // @todo: temp - remove before 
commit; should be fixed in separate patch
                        'workflow_user_id' => $obj->userId,
                        'workflow_user_ip' => $obj->userIp,
                        'workflow_user_wiki' => $obj->userWiki,
diff --git a/includes/Parsoid/BadImageRemover.php 
b/includes/Parsoid/BadImageRemover.php
index 7c689e2..90aa92b 100644
--- a/includes/Parsoid/BadImageRemover.php
+++ b/includes/Parsoid/BadImageRemover.php
@@ -35,6 +35,7 @@
                if ( !$content ) {
                        return '';
                }
+               /** @noinspection PhpUnusedLocalVariableInspection */
                $section = new \ProfileSection( __METHOD__ );
 
                /*
diff --git a/includes/Parsoid/Controller.php b/includes/Parsoid/Controller.php
index b73f07a..13fa050 100644
--- a/includes/Parsoid/Controller.php
+++ b/includes/Parsoid/Controller.php
@@ -53,8 +53,9 @@
        }
 
        /**
-        * @param string $content
+        * @param string $content Html
         * @param Title $title
+        * @return string Html
         */
        public function apply( $content, Title $title ) {
                // resolve all registered recursive callbacks
diff --git a/includes/Parsoid/Redlinker.php b/includes/Parsoid/Redlinker.php
index 307f8a7..9477c48 100644
--- a/includes/Parsoid/Redlinker.php
+++ b/includes/Parsoid/Redlinker.php
@@ -140,6 +140,7 @@
                if ( !$content ) {
                        return '';
                }
+               /** @noinspection PhpUnusedLocalVariableInspection */
                $section = new \ProfileSection( __METHOD__ );
 
                /*
diff --git a/includes/Parsoid/Utils.php b/includes/Parsoid/Utils.php
index f3ccb47..c4c6f06 100644
--- a/includes/Parsoid/Utils.php
+++ b/includes/Parsoid/Utils.php
@@ -22,6 +22,7 @@
                        return $content;
                }
 
+               /** @noinspection PhpUnusedLocalVariableInspection */
                $section = new \ProfileSection( __METHOD__ );
 
                try {
diff --git a/includes/RevisionActionPermissions.php 
b/includes/RevisionActionPermissions.php
index 1749d62..08a8ee9 100644
--- a/includes/RevisionActionPermissions.php
+++ b/includes/RevisionActionPermissions.php
@@ -55,7 +55,8 @@
         * @return bool
         */
        public function isAllowed( AbstractRevision $revision = null, $action ) 
{
-               $section = new \ProfileSection( __METHOD__ );
+        /** @noinspection PhpUnusedLocalVariableInspection */
+        $section = new \ProfileSection( __METHOD__ );
                $allowed = $this->isRevisionAllowed( $revision, $action );
 
                // if there was no revision object, it's pointless to find last 
revision

-- 
To view, visit https://gerrit.wikimedia.org/r/119890
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic8eb1cebe50ba0b9635ed308e1e4a00e7cf465aa
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to