From cd80906d4ae6a2760717257ae32c083f1add7298 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Wed, 13 Aug 2014 19:54:49 +0200 Subject: [PATCH] Change @return to start with type MediaWiki default is "@return type Description", so set a type after return and start the description with a capital letter. Also use the more common spelling of boolean. See http://phpdoc.org/docs/latest/references/phpdoc/tags/return.html for more about @return Change-Id: I4e5198822fe92836f9cef9918a9fc1a1a1e0a043 --- includes/db/DatabaseUtility.php | 6 +++--- includes/skins/Skin.php | 2 +- includes/skins/SkinFactory.php | 2 +- languages/Language.php | 6 +++--- maintenance/findHooks.php | 14 +++++++------- maintenance/sqlite.inc | 2 +- tests/parser/parserTest.inc | 2 +- tests/phpunit/includes/StatusTest.php | 4 ++-- tests/phpunit/includes/api/ApiTestCase.php | 4 ++-- .../phpunit/includes/api/RandomImageGenerator.php | 8 ++++---- .../api/query/ApiQueryContinueTestBase.php | 4 ++-- .../includes/content/ContentHandlerTest.php | 4 ++-- tests/phpunit/includes/db/ORMRowTest.php | 2 +- .../phpunit/includes/diff/DifferenceEngineTest.php | 2 +- .../includes/media/MediaWikiMediaTestCase.php | 6 +++--- tests/phpunit/languages/LanguageTest.php | 2 +- tests/phpunit/maintenance/backupTextPassTest.php | 2 +- 17 files changed, 36 insertions(+), 36 deletions(-) diff --git a/includes/db/DatabaseUtility.php b/includes/db/DatabaseUtility.php index 7ec3b4a427..c1e80d3331 100644 --- a/includes/db/DatabaseUtility.php +++ b/includes/db/DatabaseUtility.php @@ -192,7 +192,7 @@ class ResultWrapper implements Iterator { } /** - * @return stdClass|array|false + * @return stdClass|array|bool */ function current() { if ( is_null( $this->currentRow ) ) { @@ -281,7 +281,7 @@ class FakeResultWrapper extends ResultWrapper { /** * Callers want to be able to access fields with $this->fieldName - * @return false|stdClass + * @return bool|stdClass */ function fetchObject() { $this->fetchRow(); @@ -298,7 +298,7 @@ class FakeResultWrapper extends ResultWrapper { } /** - * @return false|stdClass + * @return bool|stdClass */ function next() { return $this->fetchObject(); diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php index 3750bad979..dc06ebaa24 100644 --- a/includes/skins/Skin.php +++ b/includes/skins/Skin.php @@ -417,7 +417,7 @@ abstract class Skin extends ContextSource { /** * Return values for element - * @return array of associative name-to-value elements for element + * @return array Array of associative name-to-value elements for element */ public function getHtmlElementAttributes() { $lang = $this->getLanguage(); diff --git a/includes/skins/SkinFactory.php b/includes/skins/SkinFactory.php index 0935e3347e..64480884b7 100644 --- a/includes/skins/SkinFactory.php +++ b/includes/skins/SkinFactory.php @@ -159,7 +159,7 @@ class SkinFactory { * Get a legacy skin which uses the autodiscovery mechanism. * * @param string $name - * @return Skin|bool false if the skin couldn't be constructed + * @return Skin|bool False if the skin couldn't be constructed */ private function getLegacySkin( $name ) { $skinNames = $this->getLegacySkinNames(); diff --git a/languages/Language.php b/languages/Language.php index 8440bd41d2..68b3123d5f 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -3997,7 +3997,7 @@ class Language { * Get the list of variants supported by this language * see sample implementation in LanguageZh.php * - * @return array an array of language codes + * @return array An array of language codes */ public function getVariants() { return $this->mConverter->getVariants(); @@ -4289,7 +4289,7 @@ class Language { * * @since 1.22 * @param string $code Language code - * @return array array( fallbacks, site fallbacks ) + * @return array Array( fallbacks, site fallbacks ) */ public static function getFallbacksIncludingSiteLanguage( $code ) { global $wgLanguageCode; @@ -4344,7 +4344,7 @@ class Language { * * @since 1.19 * @param string $code Language code - * @return array of message keys (strings) + * @return array Array of message keys (strings) */ public static function getMessageKeysFor( $code ) { return self::getLocalisationCache()->getSubItemList( $code, 'messages' ); diff --git a/maintenance/findHooks.php b/maintenance/findHooks.php index d40fec6fd7..17b9a04a0e 100644 --- a/maintenance/findHooks.php +++ b/maintenance/findHooks.php @@ -137,7 +137,7 @@ class FindHooks extends Maintenance { /** * Get the hook documentation, either locally or from MediaWiki.org * @param string $doc - * @return Array of documented hooks + * @return array Array of documented hooks */ private function getHooksFromDoc( $doc ) { if ( $this->hasOption( 'online' ) ) { @@ -150,7 +150,7 @@ class FindHooks extends Maintenance { /** * Get hooks from a local file (for example docs/hooks.txt) * @param string $doc Filename to look in - * @return Array of documented hooks + * @return array Array of documented hooks */ private function getHooksFromLocalDoc( $doc ) { $m = array(); @@ -162,7 +162,7 @@ class FindHooks extends Maintenance { /** * Get hooks from www.mediawiki.org using the API - * @return Array of documented hooks + * @return array Array of documented hooks */ private function getHooksFromOnlineDoc() { // All hooks @@ -200,7 +200,7 @@ class FindHooks extends Maintenance { /** * Get hooks from a PHP file * @param string $file Full filename to the PHP file. - * @return Array of hooks found. + * @return array Array of hooks found */ private function getHooksFromFile( $file ) { $content = file_get_contents( $file ); @@ -217,7 +217,7 @@ class FindHooks extends Maintenance { /** * Get hooks from the source code. * @param string $path Directory where the include files can be found - * @return Array of hooks found. + * @return array Array of hooks found */ private function getHooksFromPath( $path ) { $hooks = array(); @@ -237,7 +237,7 @@ class FindHooks extends Maintenance { /** * Get bad hooks (where the hook name could not be determined) from a PHP file * @param string $file Full filename to the PHP file. - * @return Array of bad wfRunHooks() lines + * @return array Array of bad wfRunHooks() lines */ private function getBadHooksFromFile( $file ) { $content = file_get_contents( $file ); @@ -255,7 +255,7 @@ class FindHooks extends Maintenance { /** * Get bad hooks from the source code. * @param string $path Directory where the include files can be found - * @return Array of bad wfRunHooks() lines + * @return array Array of bad wfRunHooks() lines */ private function getBadHooksFromPath( $path ) { $hooks = array(); diff --git a/maintenance/sqlite.inc b/maintenance/sqlite.inc index 43b259806c..5c0fd07fbb 100644 --- a/maintenance/sqlite.inc +++ b/maintenance/sqlite.inc @@ -42,7 +42,7 @@ class Sqlite { * Will throw exceptions on SQL errors * @param array|string $files * @throws MWException - * @return True if no error or error string in case of errors + * @return bool True if no error or error string in case of errors */ public static function checkSqlSyntax( $files ) { if ( !Sqlite::isPresent() ) { diff --git a/tests/parser/parserTest.inc b/tests/parser/parserTest.inc index 2c44150546..a342fec56e 100644 --- a/tests/parser/parserTest.inc +++ b/tests/parser/parserTest.inc @@ -1395,7 +1395,7 @@ class ParserTest { /** * Print a skipped message. * - * @return boolean + * @return bool */ protected function showSkipped() { if ( $this->showProgress ) { diff --git a/tests/phpunit/includes/StatusTest.php b/tests/phpunit/includes/StatusTest.php index 11f867a2ca..628c59b617 100644 --- a/tests/phpunit/includes/StatusTest.php +++ b/tests/phpunit/includes/StatusTest.php @@ -320,7 +320,7 @@ class StatusTest extends MediaWikiLangTestCase { } /** - * @return array of arrays with values; + * @return array Array of arrays with values; * 0 => status object * 1 => expected string (with no context) */ @@ -391,7 +391,7 @@ class StatusTest extends MediaWikiLangTestCase { } /** - * @return array of arrays with values; + * @return array Array of arrays with values; * 0 => status object * 1 => expected Message parameters (with no context) * 2 => expected Message key diff --git a/tests/phpunit/includes/api/ApiTestCase.php b/tests/phpunit/includes/api/ApiTestCase.php index f6333150ad..cd141947b5 100644 --- a/tests/phpunit/includes/api/ApiTestCase.php +++ b/tests/phpunit/includes/api/ApiTestCase.php @@ -47,7 +47,7 @@ abstract class ApiTestCase extends MediaWikiLangTestCase { * @param string $text Content of the page * @param string $summary Optional summary string for the revision * @param int $defaultNs Optional namespace id - * @return Array as returned by WikiPage::doEditContent() + * @return array Array as returned by WikiPage::doEditContent() */ protected function editPage( $pageName, $text, $summary = '', $defaultNs = NS_MAIN ) { $title = Title::newFromText( $pageName, $defaultNs ); @@ -121,7 +121,7 @@ abstract class ApiTestCase extends MediaWikiLangTestCase { * @param array $params Key-value API params * @param array|null $session Session array * @param User|null $user A User object for the context - * @return Result of the API call + * @return array Result of the API call * @throws Exception In case wsToken is not set in the session */ protected function doApiRequestWithToken( array $params, array $session = null, diff --git a/tests/phpunit/includes/api/RandomImageGenerator.php b/tests/phpunit/includes/api/RandomImageGenerator.php index 328ea8e22f..6374cfac81 100644 --- a/tests/phpunit/includes/api/RandomImageGenerator.php +++ b/tests/phpunit/includes/api/RandomImageGenerator.php @@ -328,7 +328,7 @@ class RandomImageGenerator { * This is used when simulating a rotated image capture with Exif orientation * @param array $spec Returned by getImageSpec * @param array $matrix 2x2 transformation matrix - * @return array transformed Spec + * @return array Transformed Spec */ private static function rotateImageSpec( &$spec, $matrix ) { $tSpec = array(); @@ -367,7 +367,7 @@ class RandomImageGenerator { * @param array $matrix 2x2 rotation matrix * @param int $x The x-coordinate number * @param int $y The y-coordinate number - * @return Transformed with properties x, y + * @return array Transformed with properties x, y */ private static function matrixMultiply2x2( $matrix, $x, $y ) { return array( @@ -432,7 +432,7 @@ class RandomImageGenerator { * array( array( 'foo', 'bar' ), array( 'quux', 'baz' ) ); * * @param int $number Number of pairs - * @return array two-element arrays + * @return array Two-element arrays */ private function getRandomWordPairs( $number ) { $lines = $this->getRandomLines( $number * 2 ); @@ -454,7 +454,7 @@ class RandomImageGenerator { * @param int $number_desired Number of lines desired * * @throws Exception - * @return Array of exactly n elements, drawn randomly from lines the file + * @return array Array of exactly n elements, drawn randomly from lines the file */ private function getRandomLines( $number_desired ) { $filepath = $this->dictionaryFile; diff --git a/tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php b/tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php index d986e694e7..bce626853a 100644 --- a/tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php +++ b/tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php @@ -38,7 +38,7 @@ abstract class ApiQueryContinueTestBase extends ApiQueryTestBase { * @param int $expectedCount Max number of iterations * @param string $id Unit test id * @param bool $continue True to use smart continue - * @return Merged results data array + * @return array Merged results data array */ protected function checkC( $expected, $params, $expectedCount, $id, $continue = true ) { $result = $this->query( $params, $expectedCount, $id, $continue ); @@ -51,7 +51,7 @@ abstract class ApiQueryContinueTestBase extends ApiQueryTestBase { * @param int $expectedCount Max number of iterations * @param string $id Unit test id * @param bool $useContinue True to use smart continue - * @return Merged results data array + * @return array Merged results data array * @throws Exception */ protected function query( $params, $expectedCount, $id, $useContinue = true ) { diff --git a/tests/phpunit/includes/content/ContentHandlerTest.php b/tests/phpunit/includes/content/ContentHandlerTest.php index 042ae93e4b..f7449734c4 100644 --- a/tests/phpunit/includes/content/ContentHandlerTest.php +++ b/tests/phpunit/includes/content/ContentHandlerTest.php @@ -448,7 +448,7 @@ class DummyContentForTesting extends AbstractContent { * Returns native represenation of the data. Interpretation depends on the data model used, * as given by getDataModel(). * - * @return mixed the native representation of the content. Could be a string, a nested array + * @return mixed The native representation of the content. Could be a string, a nested array * structure, an object, a binary blob... anything, really. */ public function getNativeData() { @@ -476,7 +476,7 @@ class DummyContentForTesting extends AbstractContent { * return $this. That is, $copy === $original may be true, but only for imutable content * objects. * - * @return Content. A copy of this object. + * @return Content A copy of this object */ public function copy() { return $this; diff --git a/tests/phpunit/includes/db/ORMRowTest.php b/tests/phpunit/includes/db/ORMRowTest.php index 4ff61655ab..447bf21997 100644 --- a/tests/phpunit/includes/db/ORMRowTest.php +++ b/tests/phpunit/includes/db/ORMRowTest.php @@ -115,7 +115,7 @@ abstract class ORMRowTest extends \MediaWikiTestCase { /** * @since 1.20 - * @return array of IORMRow + * @return array Array of IORMRow */ public function instanceProvider() { $instances = array(); diff --git a/tests/phpunit/includes/diff/DifferenceEngineTest.php b/tests/phpunit/includes/diff/DifferenceEngineTest.php index e1a69e3bc5..5474b963e8 100644 --- a/tests/phpunit/includes/diff/DifferenceEngineTest.php +++ b/tests/phpunit/includes/diff/DifferenceEngineTest.php @@ -39,7 +39,7 @@ class DifferenceEngineTest extends MediaWikiTestCase { } /** - * @return int[] revision ids + * @return int[] Revision ids */ protected function doEdits() { $title = $this->getTitle(); diff --git a/tests/phpunit/includes/media/MediaWikiMediaTestCase.php b/tests/phpunit/includes/media/MediaWikiMediaTestCase.php index 8e56245445..8f28158dcd 100644 --- a/tests/phpunit/includes/media/MediaWikiMediaTestCase.php +++ b/tests/phpunit/includes/media/MediaWikiMediaTestCase.php @@ -33,7 +33,7 @@ abstract class MediaWikiMediaTestCase extends MediaWikiTestCase { } /** - * @return Array Argument for FSRepo constructor + * @return array Argument for FSRepo constructor */ protected function getRepoOptions() { return array( @@ -47,7 +47,7 @@ abstract class MediaWikiMediaTestCase extends MediaWikiTestCase { * The result of this method will set the file path to use, * as well as the protected member $filePath * - * @return String path where files are + * @return string Path where files are */ protected function getFilePath() { return __DIR__ . '/../../data/media/'; @@ -59,7 +59,7 @@ abstract class MediaWikiMediaTestCase extends MediaWikiTestCase { * * Override this method if your test case creates thumbnails * - * @return boolean + * @return bool */ protected function createsThumbnails() { return false; diff --git a/tests/phpunit/languages/LanguageTest.php b/tests/phpunit/languages/LanguageTest.php index ec514413c2..cff2e8fd68 100644 --- a/tests/phpunit/languages/LanguageTest.php +++ b/tests/phpunit/languages/LanguageTest.php @@ -276,7 +276,7 @@ class LanguageTest extends LanguageClassesTestCase { } /** - * @return array format is ($len, $ellipsis, $input, $expected) + * @return array Format is ($len, $ellipsis, $input, $expected) */ public static function provideHTMLTruncateData() { return array( diff --git a/tests/phpunit/maintenance/backupTextPassTest.php b/tests/phpunit/maintenance/backupTextPassTest.php index 016b7e0cf1..a37a97c78f 100644 --- a/tests/phpunit/maintenance/backupTextPassTest.php +++ b/tests/phpunit/maintenance/backupTextPassTest.php @@ -434,7 +434,7 @@ class TextPassDumperTest extends DumpTestCase { * revision id increase further and further, while the text * id of the first iteration is reused. The pages and revision * of iteration > 1 have no corresponding representation in the database. - * @return string absolute filename of the stub + * @return string Absolute filename of the stub */ private function setUpStub( $fname = null, $iterations = 1 ) { if ( $fname === null ) { -- 2.20.1