Merge "maintenance: Explicitly declare all used properties"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 9 Sep 2019 19:11:52 +0000 (19:11 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 9 Sep 2019 19:11:52 +0000 (19:11 +0000)
12 files changed:
maintenance/cleanupImages.php
maintenance/compareParsers.php
maintenance/dumpIterator.php
maintenance/importDump.php
maintenance/includes/BackupDumper.php
maintenance/mwdocgen.php
maintenance/preprocessDump.php
maintenance/preprocessorFuzzTest.php
maintenance/rebuildImages.php
maintenance/recountCategories.php
maintenance/renderDump.php
maintenance/storage/recompressTracked.php

index 4d0c0e6..6928181 100644 (file)
@@ -42,6 +42,9 @@ class CleanupImages extends TableCleanup {
                'callback' => 'processRow',
        ];
 
+       /** @var LocalRepo|null */
+       private $repo;
+
        public function __construct() {
                parent::__construct();
                $this->addDescription( 'Script to clean up broken, unparseable upload filenames' );
@@ -116,7 +119,7 @@ class CleanupImages extends TableCleanup {
         * @return string
         */
        private function filePath( $name ) {
-               if ( !isset( $this->repo ) ) {
+               if ( $this->repo === null ) {
                        $this->repo = RepoGroup::singleton()->getLocalRepo();
                }
 
index 3f55878..0d4b7b1 100644 (file)
@@ -39,6 +39,18 @@ require_once __DIR__ . '/dumpIterator.php';
 class CompareParsers extends DumpIterator {
 
        private $count = 0;
+       /** @var bool */
+       private $saveFailed;
+       /** @var bool */
+       private $stripParametersEnabled;
+       /** @var bool */
+       private $showParsedOutput;
+       /** @var bool */
+       private $showDiff;
+       /** @var ParserOptions */
+       private $options;
+       /** @var int */
+       private $failed;
 
        public function __construct() {
                parent::__construct();
index 751932d..20e9459 100644 (file)
@@ -34,9 +34,10 @@ require_once __DIR__ . '/Maintenance.php';
  * @ingroup Maintenance
  */
 abstract class DumpIterator extends Maintenance {
-
        private $count = 0;
        private $startTime;
+       /** @var string|bool|null */
+       private $from;
 
        public function __construct() {
                parent::__construct();
@@ -60,6 +61,7 @@ abstract class DumpIterator extends Maintenance {
                        $revision->setTitle( Title::newFromText(
                                rawurldecode( basename( $this->getOption( 'file' ), '.txt' ) )
                        ) );
+                       $this->from = false;
                        $this->handleRevision( $revision );
 
                        return;
@@ -131,7 +133,7 @@ abstract class DumpIterator extends Maintenance {
                }
 
                $this->count++;
-               if ( isset( $this->from ) ) {
+               if ( $this->from !== false ) {
                        if ( $this->from != $title ) {
                                return;
                        }
index cda16fe..d5f94ad 100644 (file)
@@ -43,6 +43,16 @@ class BackupReader extends Maintenance {
        public $imageBasePath = false;
        /** @var array|false */
        public $nsFilter = false;
+       /** @var bool|resource */
+       public $stderr;
+       /** @var callable|null */
+       protected $importCallback;
+       /** @var callable|null */
+       protected $logItemCallback;
+       /** @var callable|null */
+       protected $uploadCallback;
+       /** @var int */
+       protected $startTime;
 
        function __construct() {
                parent::__construct();
index 358dc21..6c1c083 100644 (file)
@@ -49,6 +49,8 @@ abstract class BackupDumper extends Maintenance {
        public $dumpUploadFileContents = false;
        public $orderRevs = false;
        public $limitNamespaces = [];
+       /** @var bool|resource */
+       public $stderr;
 
        protected $reportingInterval = 100;
        protected $pageCount = 0;
@@ -65,6 +67,33 @@ abstract class BackupDumper extends Maintenance {
 
        protected $ID = 0;
 
+       /** @var int */
+       protected $startTime;
+       /** @var int */
+       protected $pageCountPart;
+       /** @var int */
+       protected $revCountPart;
+       /** @var int */
+       protected $maxCount;
+       /** @var int */
+       protected $timeOfCheckpoint;
+       /** @var ExportProgressFilter */
+       protected $egress;
+       /** @var string */
+       protected $buffer;
+       /** @var array|false */
+       protected $openElement;
+       /** @var bool */
+       protected $atStart;
+       /** @var string|null */
+       protected $thisRevModel;
+       /** @var string|null */
+       protected $thisRevFormat;
+       /** @var string */
+       protected $lastName;
+       /** @var string */
+       protected $state;
+
        /**
         * The dependency-injected database to use.
         *
index 4a50cc5..f600f13 100644 (file)
@@ -42,6 +42,26 @@ require_once __DIR__ . '/Maintenance.php';
  * @ingroup Maintenance
  */
 class MWDocGen extends Maintenance {
+       /** @var string */
+       private $doxygen;
+       /** @var string */
+       private $mwVersion;
+       /** @var string */
+       private $output;
+       /** @var string */
+       private $input;
+       /** @var string */
+       private $inputFilter;
+       /** @var string */
+       private $template;
+       /** @var string[] */
+       private $excludes;
+       /** @var string[] */
+       private $excludePatterns;
+       /** @var bool */
+       private $doDot;
+       /** @var bool */
+       private $doMan;
 
        /**
         * Prepare Maintenance class
index 05b78d4..fddac8a 100644 (file)
@@ -41,6 +41,8 @@ class PreprocessDump extends DumpIterator {
        /* Variables for dressing up as a parser */
        public $mTitle = 'PreprocessDump';
        public $mPPNodeCount = 0;
+       /** @var Preprocessor */
+       public $mPreprocessor;
 
        public function getStripList() {
                $parser = MediaWikiServices::getInstance()->getParser();
index 39b2ff0..3a43ae8 100644 (file)
@@ -150,6 +150,13 @@ class PPFuzzTester {
 class PPFuzzTest {
        public $templates, $mainText, $title, $entryPoint, $output;
 
+       /** @var PPFuzzTester */
+       private $parent;
+       /** @var string */
+       public $nickname;
+       /** @var bool */
+       public $fancySig;
+
        /**
         * @param PPFuzzTester $tester
         */
index 3de0070..df2ab04 100644 (file)
@@ -41,12 +41,32 @@ use Wikimedia\Rdbms\IMaintainableDatabase;
  * @ingroup Maintenance
  */
 class ImageBuilder extends Maintenance {
-
        /**
         * @var IMaintainableDatabase
         */
        protected $dbw;
 
+       /** @var bool */
+       private $dryrun;
+
+       /** @var LocalRepo|null */
+       private $repo;
+
+       /** @var int */
+       private $updated;
+
+       /** @var int */
+       private $processed;
+
+       /** @var int */
+       private $count;
+
+       /** @var int */
+       private $startTime;
+
+       /** @var string */
+       private $table;
+
        function __construct() {
                parent::__construct();
 
@@ -79,7 +99,7 @@ class ImageBuilder extends Maintenance {
         * @return LocalRepo
         */
        function getRepo() {
-               if ( !isset( $this->repo ) ) {
+               if ( $this->repo === null ) {
                        $this->repo = RepoGroup::singleton()->getLocalRepo();
                }
 
index 7e8f063..8ec648f 100644 (file)
@@ -36,6 +36,12 @@ use MediaWiki\MediaWikiServices;
  * @ingroup Maintenance
  */
 class RecountCategories extends Maintenance {
+       /** @var string */
+       private $mode;
+
+       /** @var int */
+       private $minimumId;
+
        public function __construct() {
                parent::__construct();
                $this->addDescription( <<<'TEXT'
index cc5ae59..85795ca 100644 (file)
@@ -40,6 +40,8 @@ class DumpRenderer extends Maintenance {
 
        private $count = 0;
        private $outputDirectory, $startTime;
+       /** @var string */
+       private $prefix;
 
        public function __construct() {
                parent::__construct();
index 0d506ef..9f20e67 100644 (file)
@@ -713,6 +713,8 @@ class CgzCopyTransaction {
        /** @var ConcatenatedGzipHistoryBlob|false */
        public $cgz;
        public $referrers;
+       /** @var array */
+       private $texts;
 
        /**
         * Create a transaction from a RecompressTracked object