Merge "Rephrase tog-norollbackdiff"
[lhc/web/wiklou.git] / maintenance / userOptions.inc
index 9b8714d..4b0a817 100644 (file)
@@ -22,8 +22,8 @@
  */
 
 // Options we will use
-$options = array( 'list', 'nowarn', 'quiet', 'usage', 'dry' );
-$optionsWithArgs = array( 'old', 'new' );
+$options = [ 'list', 'nowarn', 'quiet', 'usage', 'dry' ];
+$optionsWithArgs = [ 'old', 'new' ];
 
 require_once __DIR__ . '/commandLine.inc';
 
@@ -40,7 +40,11 @@ class UserOptions {
 
        private $mMode, $mReady;
 
-       /** Constructor. Will show usage and exit if script options are not correct */
+       /**
+        * Constructor. Will show usage and exit if script options are not correct
+        * @param array $opts
+        * @param array $args
+        */
        function __construct( $opts, $args ) {
                if ( !$this->checkOpts( $opts, $args ) ) {
                        UserOptions::showUsageAndExit();
@@ -101,7 +105,9 @@ class UserOptions {
                return true;
        }
 
-       // Dumb stuff to run a mode.
+       /**
+        * Dumb stuff to run a mode.
+        */
        public function run() {
                if ( !$this->mReady ) {
                        return false;
@@ -112,11 +118,9 @@ class UserOptions {
                return true;
        }
 
-       #
-       # Modes.
-       #
-
-       /** List default options and their value */
+       /**
+        * List default options and their value
+        */
        private function LISTER() {
                $def = User::getDefaultOptions();
                ksort( $def );
@@ -129,16 +133,18 @@ class UserOptions {
                }
        }
 
-       /** List options usage */
+       /**
+        * List options usage
+        */
        private function USAGER() {
-               $ret = array();
+               $ret = [];
                $defaultOptions = User::getDefaultOptions();
 
                // We list user by user_id from one of the slave database
                $dbr = wfGetDB( DB_SLAVE );
                $result = $dbr->select( 'user',
-                       array( 'user_id' ),
-                       array(),
+                       [ 'user_id' ],
+                       [],
                        __METHOD__
                );
 
@@ -182,15 +188,17 @@ class UserOptions {
                }
        }
 
-       /** Change our users options */
+       /**
+        * Change our users options
+        */
        private function CHANGER() {
                $this->warn();
 
                // We list user by user_id from one of the slave database
                $dbr = wfGetDB( DB_SLAVE );
                $result = $dbr->select( 'user',
-                       array( 'user_id' ),
-                       array(),
+                       [ 'user_id' ],
+                       [],
                        __METHOD__
                );
 
@@ -230,7 +238,7 @@ class UserOptions {
         */
        public static function getDefaultOptionsNames() {
                $def = User::getDefaultOptions();
-               $ret = array();
+               $ret = [];
                foreach ( $def as $optname => $defaultValue ) {
                        array_push( $ret, $optname );
                }
@@ -238,10 +246,6 @@ class UserOptions {
                return $ret;
        }
 
-       #
-       # Helper methods
-       #
-
        public static function showUsageAndExit() {
                print <<<USAGE