[MediaWiki-commits] [Gerrit] Add and fix lots of PHPDoc @param, @return and @var tags - change (mediawiki...Translate)
jenkins-bot has submitted this change and it was merged. Change subject: Add and fix lots of PHPDoc @param, @return and @var tags .. Add and fix lots of PHPDoc @param, @return and @var tags * I focused on lines that start with "/// @var" because PHPStorm and other tools do not realize these are meant to be PHPDoc tags. * I'm fixing some actual mistakes in some PHPDoc tags. * I'm changing generic "array" to "string[]" and so on, if possible. * I'm adding "...|null" when a class property is null by default. * I'm also removing two class properties that are unused. Change-Id: Ie114dcc33fe0db58c3c5e283247e14ac8b542fa0 --- M MessageGroups.php M TranslateHooks.php M TranslateTasks.php M ffs/AmdFFS.php M messagegroups/WikiPageMessageGroup.php M scripts/mwcore-export.php M scripts/processMessageChanges.php M scripts/ttmserver-export.php M tag/TPSection.php M utils/MessageGroupStatesUpdaterJob.php M utils/MessageGroupStats.php M utils/MessageHandle.php M utils/MessageIndex.php M utils/StatsBar.php M utils/StatsTable.php 15 files changed, 179 insertions(+), 56 deletions(-) Approvals: Nikerabbit: Looks good to me, approved jenkins-bot: Verified diff --git a/MessageGroups.php b/MessageGroups.php index 028f2f0..308370a 100644 --- a/MessageGroups.php +++ b/MessageGroups.php @@ -16,14 +16,18 @@ */ class MessageGroups { /** -* @var Array Cache for message group priorities +* @var string[]|null Cache for message group priorities */ protected static $prioritycache = null; - /// @var array + /** +* @var array|null +*/ protected $groups = null; - /// @var BagOStuff + /** +* @var BagOStuff|null +*/ protected $cache = null; /// Initialises the list of groups @@ -49,6 +53,9 @@ $this->postInit( $groups ); } + /** +* @param array $groups +*/ protected function postInit( $groups ) { // Expand groups to objects foreach ( $groups as $id => $mixed ) { @@ -98,7 +105,7 @@ /** * Override cache, for example during tests. * -* @param BagOStuff $cache +* @param BagOStuff|null $cache */ public function setCache( BagOStuff $cache = null ) { $this->cache = $cache; diff --git a/TranslateHooks.php b/TranslateHooks.php index 8356af5..3cde7f8 100644 --- a/TranslateHooks.php +++ b/TranslateHooks.php @@ -198,7 +198,7 @@ $directoryIterator = new RecursiveDirectoryIterator( $dir ); $fileIterator = new RecursiveIteratorIterator( $directoryIterator ); - /// @var SplFileInfo $fileInfo + /** @var SplFileInfo $fileInfo */ foreach ( $fileIterator as $fileInfo ) { if ( substr( $fileInfo->getFilename(), -8 ) === 'Test.php' ) { $files[] = $fileInfo->getPathname(); diff --git a/TranslateTasks.php b/TranslateTasks.php index 312bf76..559a93b 100644 --- a/TranslateTasks.php +++ b/TranslateTasks.php @@ -14,7 +14,9 @@ * messages of given message group in given language. */ abstract class TranslateTask { - /// @var string Task identifier. + /** +* @var string Task identifier. +*/ protected $id = '__BUG__'; // We need $id here because staticness prevents subclass overriding. diff --git a/ffs/AmdFFS.php b/ffs/AmdFFS.php index b04dfde..8f7e0d9 100644 --- a/ffs/AmdFFS.php +++ b/ffs/AmdFFS.php @@ -91,7 +91,7 @@ $messages = array(); $mangler = $this->group->getMangler(); - /// @var $m ThinMessage + /** @var ThinMessage $m */ foreach ( $collection as $key => $m ) { $value = $m->translation(); if ( $value === null ) { diff --git a/messagegroups/WikiPageMessageGroup.php b/messagegroups/WikiPageMessageGroup.php index c80b113..b3f0ef9 100644 --- a/messagegroups/WikiPageMessageGroup.php +++ b/messagegroups/WikiPageMessageGroup.php @@ -13,9 +13,15 @@ * @ingroup PageTranslation MessageGroup */ class WikiPageMessageGroup extends WikiMessageGroup { - /// @var string|Title + /** +* @var Title|string +*/ protected $title; + /** +* @param string $id +* @param Title|string $source +*/ public function __construct( $id, $source ) { $this->id = $id; $this->title = $source; diff --git a/scripts/mwcore-export.php b/scripts/mwcore-export.php index 31ce058..a857934 100644 --- a/scripts/mwcore-export.php +++ b/scripts/mwcore-export.php @@ -89,7 +89,7 @@ $variable = preg_quote( $matches[1], '~' ); - /// @var FileBasedMessageGroup $group +
[MediaWiki-commits] [Gerrit] Add and fix lots of PHPDoc @param, @return and @var tags - change (mediawiki...Translate)
Thiemo Mättig (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/243623 Change subject: Add and fix lots of PHPDoc @param, @return and @var tags .. Add and fix lots of PHPDoc @param, @return and @var tags * I focused on lines that start with "/// @var" because PHPStorm and other tools do not realize these are meant to be PHPDoc tags. * I'm fixing some actual mistakes in some PHPDoc tags. * I'm changing generic "array" to "string[]" and so on, if possible. * I'm adding "...|null" when a class property is null by default. * I'm also removing two class properties that are unused. Change-Id: Ie114dcc33fe0db58c3c5e283247e14ac8b542fa0 --- M MessageGroups.php M TranslateHooks.php M TranslateTasks.php M ffs/AmdFFS.php M messagegroups/WikiPageMessageGroup.php M scripts/mwcore-export.php M scripts/processMessageChanges.php M scripts/ttmserver-export.php M tag/TPSection.php M utils/MessageGroupStatesUpdaterJob.php M utils/MessageGroupStats.php M utils/MessageHandle.php M utils/MessageIndex.php M utils/StatsBar.php M utils/StatsTable.php 15 files changed, 178 insertions(+), 55 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate refs/changes/23/243623/1 diff --git a/MessageGroups.php b/MessageGroups.php index 028f2f0..308370a 100644 --- a/MessageGroups.php +++ b/MessageGroups.php @@ -16,14 +16,18 @@ */ class MessageGroups { /** -* @var Array Cache for message group priorities +* @var string[]|null Cache for message group priorities */ protected static $prioritycache = null; - /// @var array + /** +* @var array|null +*/ protected $groups = null; - /// @var BagOStuff + /** +* @var BagOStuff|null +*/ protected $cache = null; /// Initialises the list of groups @@ -49,6 +53,9 @@ $this->postInit( $groups ); } + /** +* @param array $groups +*/ protected function postInit( $groups ) { // Expand groups to objects foreach ( $groups as $id => $mixed ) { @@ -98,7 +105,7 @@ /** * Override cache, for example during tests. * -* @param BagOStuff $cache +* @param BagOStuff|null $cache */ public function setCache( BagOStuff $cache = null ) { $this->cache = $cache; diff --git a/TranslateHooks.php b/TranslateHooks.php index 8356af5..3cde7f8 100644 --- a/TranslateHooks.php +++ b/TranslateHooks.php @@ -198,7 +198,7 @@ $directoryIterator = new RecursiveDirectoryIterator( $dir ); $fileIterator = new RecursiveIteratorIterator( $directoryIterator ); - /// @var SplFileInfo $fileInfo + /** @var SplFileInfo $fileInfo */ foreach ( $fileIterator as $fileInfo ) { if ( substr( $fileInfo->getFilename(), -8 ) === 'Test.php' ) { $files[] = $fileInfo->getPathname(); diff --git a/TranslateTasks.php b/TranslateTasks.php index 312bf76..559a93b 100644 --- a/TranslateTasks.php +++ b/TranslateTasks.php @@ -14,7 +14,9 @@ * messages of given message group in given language. */ abstract class TranslateTask { - /// @var string Task identifier. + /** +* @var string Task identifier. +*/ protected $id = '__BUG__'; // We need $id here because staticness prevents subclass overriding. diff --git a/ffs/AmdFFS.php b/ffs/AmdFFS.php index b04dfde..8f7e0d9 100644 --- a/ffs/AmdFFS.php +++ b/ffs/AmdFFS.php @@ -91,7 +91,7 @@ $messages = array(); $mangler = $this->group->getMangler(); - /// @var $m ThinMessage + /** @var ThinMessage $m */ foreach ( $collection as $key => $m ) { $value = $m->translation(); if ( $value === null ) { diff --git a/messagegroups/WikiPageMessageGroup.php b/messagegroups/WikiPageMessageGroup.php index c80b113..b3f0ef9 100644 --- a/messagegroups/WikiPageMessageGroup.php +++ b/messagegroups/WikiPageMessageGroup.php @@ -13,9 +13,15 @@ * @ingroup PageTranslation MessageGroup */ class WikiPageMessageGroup extends WikiMessageGroup { - /// @var string|Title + /** +* @var Title|string +*/ protected $title; + /** +* @param string $id +* @param Title|string $source +*/ public function __construct( $id, $source ) { $this->id = $id; $this->title = $source; diff --git a/scripts/mwcore-export.php b/scripts/mwcore-export.php index 31ce058..a857934 100644 --- a/scripts/mwcore-export.php +++ b/scripts/mwcore-export.php @@ -89,7 +89,7 @@ $variable = preg_quote( $matches[1], '~' ); -