Update PHPDoc types in several maintenance scripts and related
authorThiemo Kreuz <thiemo.kreuz@wikimedia.de>
Thu, 28 Feb 2019 11:33:47 +0000 (12:33 +0100)
committerUmherirrender <umherirrender_de.wp@web.de>
Thu, 7 Mar 2019 17:54:26 +0000 (17:54 +0000)
There is like a billion of these in our core codebase. I would love to
update them all. But I don't have the time, at least not to do them all
at once.

TL;DR: It's an improvement. :-)

Change-Id: I0a9c51bdcf0f261f971586bb8703f418324b0f98

includes/libs/filebackend/FileBackendStore.php
includes/upload/UploadBase.php
maintenance/categoryChangesAsRdf.php
maintenance/cleanupInvalidDbKeys.php
maintenance/cleanupTable.inc
maintenance/cleanupUsersWithNoId.php
maintenance/convertExtensionToRegistration.php
maintenance/copyFileBackend.php
maintenance/deleteOrphanedRevisions.php
maintenance/dumpCategoriesAsRdf.php
maintenance/generateJsonI18n.php

index 28a293f..97da557 100644 (file)
@@ -1009,7 +1009,7 @@ abstract class FileBackendStore extends FileBackend {
         * @param string $container Resolved container name
         * @param string $dir Resolved path relative to container
         * @param array $params
-        * @return Traversable|array|null Returns null on failure
+        * @return Traversable|string[]|null Returns null on failure
         */
        abstract public function getFileListInternal( $container, $dir, array $params );
 
index d9e8e99..c42584c 100644 (file)
@@ -1169,7 +1169,7 @@ abstract class UploadBase {
         * scripts, so the blacklist needs to check them all.
         *
         * @param string $filename
-        * @return array
+        * @return array [ string, string[] ]
         */
        public static function splitExtensions( $filename ) {
                $bits = explode( '.', $filename );
@@ -1194,8 +1194,8 @@ abstract class UploadBase {
         * Perform case-insensitive match against a list of file extensions.
         * Returns an array of matching extensions.
         *
-        * @param array $ext
-        * @param array $list
+        * @param string[] $ext
+        * @param string[] $list
         * @return bool
         */
        public static function checkFileExtensionList( $ext, $list ) {
index 8324133..1d85dcc 100644 (file)
@@ -402,7 +402,7 @@ SPARQL;
        /**
         * Get iterator for links for categories.
         * @param IDatabase $dbr
-        * @param array $ids List of page IDs
+        * @param int[] $ids List of page IDs
         * @return Traversable
         */
        protected function getCategoryLinksIterator( IDatabase $dbr, array $ids ) {
index a1820b8..abae4f4 100644 (file)
@@ -30,7 +30,7 @@ require_once __DIR__ . '/Maintenance.php';
  * @ingroup Maintenance
  */
 class CleanupInvalidDbKeys extends Maintenance {
-       /** @var array List of tables to clean up, and the field prefix for that table */
+       /** @var array[] List of tables to clean up, and the field prefix for that table */
        protected static $tables = [
                // Data tables
                [ 'page', 'page' ],
index 3ace09c..b78e691 100644 (file)
@@ -165,7 +165,7 @@ class TableCleanup extends Maintenance {
        }
 
        /**
-        * @param array $matches
+        * @param string[] $matches
         * @return string
         */
        protected function hexChar( $matches ) {
index b2fdf2f..61d1e5d 100644 (file)
@@ -95,7 +95,7 @@ class CleanupUsersWithNoId extends LoggedUpdateMaintenance {
         * @param IDatabase $dbw
         * @param string[] $indexFields Fields in the index being ordered by
         * @param object $row Database row
-        * @return array [ string $next, string $display ]
+        * @return string[] [ string $next, string $display ]
         */
        private function makeNextCond( $dbw, $indexFields, $row ) {
                $next = '';
index 6c1edc2..a09ca5c 100644 (file)
@@ -19,7 +19,7 @@ class ConvertExtensionToRegistration extends Maintenance {
        /**
         * Things that were formerly globals and should still be converted
         *
-        * @var array
+        * @var string[]
         */
        protected $formerGlobals = [
                'TrackingCategories',
@@ -28,7 +28,7 @@ class ConvertExtensionToRegistration extends Maintenance {
        /**
         * No longer supported globals (with reason) should not be converted and emit a warning
         *
-        * @var array
+        * @var string[]
         */
        protected $noLongerSupportedGlobals = [
                'SpecialPageGroups' => 'deprecated', // Deprecated 1.21, removed in 1.26
@@ -37,7 +37,7 @@ class ConvertExtensionToRegistration extends Maintenance {
        /**
         * Keys that should be put at the top of the generated JSON file (T86608)
         *
-        * @var array
+        * @var string[]
         */
        protected $promote = [
                'name',
index 3374893..9ba5bf5 100644 (file)
@@ -168,7 +168,7 @@ class CopyFileBackend extends Maintenance {
         * @param FileBackend $src
         * @param FileBackend $dst
         * @param string $backendRel
-        * @return array (rel paths in $src minus those in $dst)
+        * @return string[] (rel paths in $src minus those in $dst)
         */
        protected function getListingDiffRel( FileBackend $src, FileBackend $dst, $backendRel ) {
                $srcPathsRel = $src->getFileList( [
@@ -200,7 +200,7 @@ class CopyFileBackend extends Maintenance {
        }
 
        /**
-        * @param array $srcPathsRel
+        * @param string[] $srcPathsRel
         * @param string $backendRel
         * @param FileBackend $src
         * @param FileBackend $dst
@@ -288,7 +288,7 @@ class CopyFileBackend extends Maintenance {
        }
 
        /**
-        * @param array $dstPathsRel
+        * @param string[] $dstPathsRel
         * @param string $backendRel
         * @param FileBackend $dst
         * @return void
index 8d3f6b3..6f3ea4c 100644 (file)
@@ -84,13 +84,10 @@ class DeleteOrphanedRevisions extends Maintenance {
         * Delete one or more revisions from the database
         * Do this inside a transaction
         *
-        * @param array $id Array of revision id values
+        * @param int[] $id Array of revision id values
         * @param IDatabase $dbw Master DB handle
         */
-       private function deleteRevs( $id, &$dbw ) {
-               if ( !is_array( $id ) ) {
-                       $id = [ $id ];
-               }
+       private function deleteRevs( array $id, &$dbw ) {
                $dbw->delete( 'revision', [ 'rev_id' => $id ], __METHOD__ );
 
                // Delete from ip_changes should a record exist.
index e4bd756..873d628 100644 (file)
@@ -90,7 +90,7 @@ class DumpCategoriesAsRdf extends Maintenance {
        /**
         * Get iterator for links for categories.
         * @param IDatabase $dbr
-        * @param array $ids List of page IDs
+        * @param int[] $ids List of page IDs
         * @return Traversable
         */
        public function getCategoryLinksIterator( IDatabase $dbr, array $ids ) {
index efddfb3..a7224b4 100644 (file)
@@ -182,7 +182,7 @@ class GenerateJsonI18n extends Maintenance {
        /**
         * Get an array of author names from a documentation comment containing @author declarations.
         * @param string $comment Documentation comment
-        * @return array Array of author names (strings)
+        * @return string[] Array of author names
         */
        protected function getAuthorsFromComment( $comment ) {
                $matches = null;