From: Thiemo Kreuz Date: Thu, 28 Feb 2019 11:33:47 +0000 (+0100) Subject: Update PHPDoc types in several maintenance scripts and related X-Git-Tag: 1.34.0-rc.0~2620 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=cc329a5b06c0658cc2d1050bb05c38ce651b30f3;p=lhc%2Fweb%2Fwiklou.git Update PHPDoc types in several maintenance scripts and related 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 --- diff --git a/includes/libs/filebackend/FileBackendStore.php b/includes/libs/filebackend/FileBackendStore.php index 28a293f7d2..97da5572fd 100644 --- a/includes/libs/filebackend/FileBackendStore.php +++ b/includes/libs/filebackend/FileBackendStore.php @@ -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 ); diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index d9e8e99498..c42584cb1e 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -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 ) { diff --git a/maintenance/categoryChangesAsRdf.php b/maintenance/categoryChangesAsRdf.php index 83241334f5..1d85dccd15 100644 --- a/maintenance/categoryChangesAsRdf.php +++ b/maintenance/categoryChangesAsRdf.php @@ -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 ) { diff --git a/maintenance/cleanupInvalidDbKeys.php b/maintenance/cleanupInvalidDbKeys.php index a1820b89aa..abae4f4379 100644 --- a/maintenance/cleanupInvalidDbKeys.php +++ b/maintenance/cleanupInvalidDbKeys.php @@ -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' ], diff --git a/maintenance/cleanupTable.inc b/maintenance/cleanupTable.inc index 3ace09cb30..b78e691e8f 100644 --- a/maintenance/cleanupTable.inc +++ b/maintenance/cleanupTable.inc @@ -165,7 +165,7 @@ class TableCleanup extends Maintenance { } /** - * @param array $matches + * @param string[] $matches * @return string */ protected function hexChar( $matches ) { diff --git a/maintenance/cleanupUsersWithNoId.php b/maintenance/cleanupUsersWithNoId.php index b2fdf2f9c7..61d1e5d5ab 100644 --- a/maintenance/cleanupUsersWithNoId.php +++ b/maintenance/cleanupUsersWithNoId.php @@ -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 = ''; diff --git a/maintenance/convertExtensionToRegistration.php b/maintenance/convertExtensionToRegistration.php index 6c1edc2ba0..a09ca5ceb5 100644 --- a/maintenance/convertExtensionToRegistration.php +++ b/maintenance/convertExtensionToRegistration.php @@ -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', diff --git a/maintenance/copyFileBackend.php b/maintenance/copyFileBackend.php index 3374893755..9ba5bf5a5a 100644 --- a/maintenance/copyFileBackend.php +++ b/maintenance/copyFileBackend.php @@ -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 diff --git a/maintenance/deleteOrphanedRevisions.php b/maintenance/deleteOrphanedRevisions.php index 8d3f6b3e5b..6f3ea4c54d 100644 --- a/maintenance/deleteOrphanedRevisions.php +++ b/maintenance/deleteOrphanedRevisions.php @@ -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. diff --git a/maintenance/dumpCategoriesAsRdf.php b/maintenance/dumpCategoriesAsRdf.php index e4bd7564a6..873d628bad 100644 --- a/maintenance/dumpCategoriesAsRdf.php +++ b/maintenance/dumpCategoriesAsRdf.php @@ -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 ) { diff --git a/maintenance/generateJsonI18n.php b/maintenance/generateJsonI18n.php index efddfb3435..a7224b43b8 100644 --- a/maintenance/generateJsonI18n.php +++ b/maintenance/generateJsonI18n.php @@ -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;