specials: Cleanup and fix PHPDoc comments
authorDerick Alangi <alangiderick@gmail.com>
Sat, 23 Feb 2019 14:17:53 +0000 (15:17 +0100)
committerDerick Alangi <alangiderick@gmail.com>
Sun, 24 Feb 2019 17:11:31 +0000 (18:11 +0100)
Fix and cleanup code documentation in PHPDoc for clarity. This involves
correcting return types, parameter types and errors expected to be thrown
by methods within a class.

Change-Id: I30ba4b99d25460f84d348dd96480df67e92c69a6

includes/specials/SpecialAllPages.php
includes/specials/SpecialBlock.php
includes/specials/SpecialEditTags.php
includes/specials/SpecialLinkAccounts.php
includes/specials/SpecialLog.php
includes/specials/SpecialRandomInCategory.php
includes/specials/SpecialRecentchanges.php
includes/specials/SpecialUploadStash.php
includes/specials/pagers/AllMessagesTablePager.php

index e96df0b..fc32d2d 100644 (file)
@@ -169,8 +169,8 @@ class SpecialAllPages extends IncludableSpecialPage {
 
        /**
         * @param int $namespace Namespace (Default NS_MAIN)
 
        /**
         * @param int $namespace Namespace (Default NS_MAIN)
-        * @param string $from List all pages from this name (default false)
-        * @param string $to List all pages to this name (default false)
+        * @param string|false $from List all pages from this name (default false)
+        * @param string|false $to List all pages to this name (default false)
         * @param bool $hideredirects Don't show redirects (default false)
         */
        function showChunk( $namespace = NS_MAIN, $from = false, $to = false, $hideredirects = false ) {
         * @param bool $hideredirects Don't show redirects (default false)
         */
        function showChunk( $namespace = NS_MAIN, $from = false, $to = false, $hideredirects = false ) {
index a00c42c..a816edc 100644 (file)
@@ -310,8 +310,6 @@ class SpecialBlock extends FormSpecialPage {
         * If the user has already been blocked with similar settings, load that block
         * and change the defaults for the form fields to match the existing settings.
         * @param array &$fields HTMLForm descriptor array
         * If the user has already been blocked with similar settings, load that block
         * and change the defaults for the form fields to match the existing settings.
         * @param array &$fields HTMLForm descriptor array
-        * @return bool Whether fields were altered (that is, whether the target is
-        *     already blocked)
         */
        protected function maybeAlterFormDefaults( &$fields ) {
                # This will be overwritten by request data
         */
        protected function maybeAlterFormDefaults( &$fields ) {
                # This will be overwritten by request data
index 02b72dd..bcc81c7 100644 (file)
@@ -374,7 +374,6 @@ class SpecialEditTags extends UnlistedSpecialPage {
 
        /**
         * UI entry point for form submission.
 
        /**
         * UI entry point for form submission.
-        * @throws PermissionsError
         * @return bool
         */
        protected function submit() {
         * @return bool
         */
        protected function submit() {
index d4ef936..859a638 100644 (file)
@@ -32,8 +32,8 @@ class SpecialLinkAccounts extends AuthManagerSpecialPage {
 
        /**
         * @param null|string $subPage
 
        /**
         * @param null|string $subPage
-        * @throws MWException
-        * @throws PermissionsError
+        * @throws ErrorPageError
+        * @throws LogicException
         */
        public function execute( $subPage ) {
                $this->setHeaders();
         */
        public function execute( $subPage ) {
                $this->setHeaders();
index 594626f..4d50642 100644 (file)
@@ -180,7 +180,6 @@ class SpecialLog extends SpecialPage {
         *
         * @param FormOptions $opts
         * @param string $par
         *
         * @param FormOptions $opts
         * @param string $par
-        * @throws ConfigException
         */
        private function parseParams( FormOptions $opts, $par ) {
                # Get parameters
         */
        private function parseParams( FormOptions $opts, $par ) {
                # Get parameters
index adf12d4..d781e16 100644 (file)
@@ -291,7 +291,7 @@ class SpecialRandomInCategory extends FormSpecialPage {
         * @param int $offset A small offset to make the result seem more "random"
         * @param bool $up Get the result above the random value
         * @param string $fname The name of the calling method
         * @param int $offset A small offset to make the result seem more "random"
         * @param bool $up Get the result above the random value
         * @param string $fname The name of the calling method
-        * @return array Info for the title selected.
+        * @return stdClass|false Info for the title selected.
         */
        private function selectRandomPageFromDB( $rand, $offset, $up, $fname = __METHOD__ ) {
                $dbr = wfGetDB( DB_REPLICA );
         */
        private function selectRandomPageFromDB( $rand, $offset, $up, $fname = __METHOD__ ) {
                $dbr = wfGetDB( DB_REPLICA );
index b566305..1e016a5 100644 (file)
@@ -674,7 +674,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
         * Creates the choose namespace selection
         *
         * @param FormOptions $opts
         * Creates the choose namespace selection
         *
         * @param FormOptions $opts
-        * @return string
+        * @return string[]
         */
        protected function namespaceFilterForm( FormOptions $opts ) {
                $nsSelect = Html::namespaceSelector(
         */
        protected function namespaceFilterForm( FormOptions $opts ) {
                $nsSelect = Html::namespaceSelector(
index 2da9a41..abd3e07 100644 (file)
@@ -165,8 +165,6 @@ class SpecialUploadStash extends UnlistedSpecialPage {
         *
         * @param File $file
         * @param array $params
         *
         * @param File $file
         * @param array $params
-        *
-        * @return bool Success
         */
        private function outputThumbFromStash( $file, $params ) {
                $flags = 0;
         */
        private function outputThumbFromStash( $file, $params ) {
                $flags = 0;
index 8081f4d..f045333 100644 (file)
@@ -281,7 +281,10 @@ class AllMessagesTablePager extends TablePager {
                return '';
        }
 
                return '';
        }
 
-       /** @return string HTML */
+       /**
+        * @param stdClass $row
+        * @return string HTML
+        */
        function formatRow( $row ) {
                // Do all the normal stuff
                $s = parent::formatRow( $row );
        function formatRow( $row ) {
                // Do all the normal stuff
                $s = parent::formatRow( $row );
@@ -306,7 +309,11 @@ class AllMessagesTablePager extends TablePager {
                return [];
        }
 
                return [];
        }
 
-       /** @return array HTML attributes */
+       /**
+        * @param string $field
+        * @param string $value
+        * @return array HTML attributes
+        */
        function getCellAttrs( $field, $value ) {
                $attr = [];
                if ( $field === 'am_title' ) {
        function getCellAttrs( $field, $value ) {
                $attr = [];
                if ( $field === 'am_title' ) {