Cleaned up various revisiondelete IDE warnings
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 22 May 2015 18:18:12 +0000 (11:18 -0700)
committerUmherirrender <umherirrender_de.wp@web.de>
Fri, 29 May 2015 21:40:36 +0000 (21:40 +0000)
Change-Id: I4750eabf9985785520aaac8eca12d488ca746966

includes/revisiondelete/RevDelItem.php
includes/revisiondelete/RevDelList.php
includes/revisiondelete/RevDelLogItem.php
includes/revisiondelete/RevisionDeleter.php
includes/specials/SpecialRevisiondelete.php

index ebdbf3a..dba368d 100644 (file)
@@ -36,6 +36,8 @@ abstract class RevDelItem extends RevisionItemBase {
 
        /**
         * Get the current deletion bitfield value
+        *
+        * @return integer
         */
        abstract public function getBits();
 
index 1ce9691..837557c 100644 (file)
@@ -78,7 +78,7 @@ abstract class RevDelList extends RevisionListBase {
         * transactions are done here.
         *
         * @param array $params Associative array of parameters. Members are:
-        *     value:         The integer value to set the visibility to
+        *     value:         ExtractBitParams() bitfield array
         *     comment:       The log comment.
         *     perItemStatus: Set if you want per-item status reports
         * @return Status
@@ -109,6 +109,7 @@ abstract class RevDelList extends RevisionListBase {
                // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
                for ( $this->reset(); $this->current(); $this->next() ) {
                        // @codingStandardsIgnoreEnd
+                       /** @var $item RevDelItem */
                        $item = $this->current();
                        unset( $missing[$item->getId()] );
 
@@ -200,6 +201,7 @@ abstract class RevDelList extends RevisionListBase {
                }
 
                // Log it
+               // @FIXME: $newBits/$oldBits set in for loop, makes IDE warnings too
                $this->updateLog( array(
                        'title' => $this->title,
                        'count' => $successCount,
index 5c83107..65b0309 100644 (file)
@@ -48,7 +48,7 @@ class RevDelLogItem extends RevDelItem {
        }
 
        public function getBits() {
-               return $this->row->log_deleted;
+               return (int)$this->row->log_deleted;
        }
 
        public function setBits( $bits ) {
index ba1f0f6..db2bc6a 100644 (file)
@@ -233,9 +233,9 @@ class RevisionDeleter {
         * @since 1.22
         * @param array $bitPars ExtractBitParams() params
         * @param int $oldfield Current bitfield
-        * @return array
+        * @return integer
         */
-       public static function extractBitfield( $bitPars, $oldfield ) {
+       public static function extractBitfield( array $bitPars, $oldfield ) {
                // Build the actual new rev_deleted bitfield
                $newBits = 0;
                foreach ( $bitPars as $const => $val ) {
index 21867b5..5bd3a29 100644 (file)
@@ -585,7 +585,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                        throw new PermissionsError( 'suppressrevision' );
                }
                # If the save went through, go to success message...
-               $status = $this->save( $bitParams, $comment, $this->targetObj );
+               $status = $this->save( $bitParams, $comment );
                if ( $status->isGood() ) {
                        $this->success();
 
@@ -651,14 +651,13 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
 
        /**
         * Do the write operations. Simple wrapper for RevDel*List::setVisibility().
-        * @param int $bitfield
+        * @param array $bitPars ExtractBitParams() bitfield array
         * @param string $reason
-        * @param Title $title
         * @return Status
         */
-       protected function save( $bitfield, $reason, $title ) {
+       protected function save( array $bitPars, $reason ) {
                return $this->getList()->setVisibility(
-                       array( 'value' => $bitfield, 'comment' => $reason )
+                       array( 'value' => $bitPars, 'comment' => $reason )
                );
        }