Umherirrender has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/384290 )
Change subject: Improve some parameter docs ...................................................................... Improve some parameter docs Change-Id: Ie653d3b538daacbb50d354c6865faa1f78b1bf55 --- M Message.php M MessageCollection.php M MessageGroups.php M Translate.php M TranslateEditAddons.php M TranslateHooks.php M TranslateTasks.php M api/ApiQueryMessageCollection.php M ffs/AmdFFS.php M ffs/AppleFFS.php M ffs/DtdFFS.php M ffs/FFS.php M ffs/GettextFFS.php M ffs/JavaFFS.php M ffs/JavaScriptFFS.php M ffs/JsonFFS.php M ffs/MediaWikiComplexMessages.php M ffs/MediaWikiExtensions.php M ffs/YamlFFS.php M messagegroups/FileBasedMessageGroup.php M messagegroups/MessageGroup.php M messagegroups/MessageGroupBase.php M messagegroups/MessageGroupOld.php M messagegroups/RecentMessageGroup.php M phpcs.xml M specials/CompatibleLinkRenderer.php M specials/SpecialImportTranslations.php M specials/SpecialLanguageStats.php M specials/SpecialManageGroups.php M specials/SpecialMessageGroupStats.php M specials/SpecialSearchTranslations.php M specials/SpecialTranslate.php M specials/SpecialTranslationStats.php M stash/StashedTranslation.php M tag/PageTranslationHooks.php M tag/TranslatablePage.php M tag/TranslatablePageMoveJob.php M tag/TranslateDeleteJob.php M tag/TranslateMoveJob.php M tag/TranslateRenderJob.php M translationaids/SupportAid.php M ttmserver/CrossLanguageTranslationSearchQuery.php M ttmserver/DatabaseTTMServer.php M ttmserver/ElasticSearchTTMServer.php M ttmserver/Interfaces.php M ttmserver/SolrTTMServer.php M ttmserver/TTMServer.php M ttmserver/TTMServerMessageUpdateJob.php M utils/Font.php M utils/HTMLJsSelectToInputField.php M utils/JsSelectToInput.php M utils/MemProfile.php M utils/MessageGroupStatesUpdaterJob.php M utils/MessageGroupStats.php M utils/MessageHandle.php M utils/MessageIndex.php M utils/MessageWebImporter.php M utils/ResourceLoader.php M utils/RevTag.php M utils/ToolBox.php M utils/TranslateMetadata.php M utils/TranslateSandbox.php M utils/TranslateYaml.php M utils/TranslationEditPage.php M utils/TranslationHelpers.php M utils/TranslationStats.php M utils/UserToggles.php M webservices/TranslationWebService.php 68 files changed, 495 insertions(+), 200 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate refs/changes/90/384290/1 diff --git a/Message.php b/Message.php index 804300c..d590b42 100644 --- a/Message.php +++ b/Message.php @@ -28,8 +28,8 @@ /** * Creates new message object. * - * @param $key string Unique key identifying this message. - * @param $definition string The authoritave definition of this message. + * @param string $key Unique key identifying this message. + * @param string $definition The authoritave definition of this message. */ public function __construct( $key, $definition ) { $this->key = $key; @@ -60,7 +60,7 @@ /** * Set the committed translation. - * @param $text \string + * @param \string $text */ public function setInfile( $text ) { $this->infile = $text; @@ -76,7 +76,7 @@ /** * Add a tag for this message. - * @param $tag \string + * @param \string $tag */ public function addTag( $tag ) { $this->tags[] = $tag; @@ -84,7 +84,7 @@ /** * Check if this message has a given tag. - * @param $tag \string + * @param \string $tag * @return \bool */ public function hasTag( $tag ) { diff --git a/MessageCollection.php b/MessageCollection.php index 589f4b2..1d2eb43 100644 --- a/MessageCollection.php +++ b/MessageCollection.php @@ -745,6 +745,8 @@ * database fields page_namespace and page_title as keys and returns * the value for those indexes. * @since 2011-12-23 + * @param stdClass $row + * @return string|null */ protected function rowToKey( $row ) { $map = $this->getReverseMap(); @@ -760,6 +762,7 @@ /** * Creates a two-dimensional map of namespace and pagenames. * @since 2011-12-23 + * @return array */ public function getReverseMap() { if ( isset( $this->reverseMap ) ) { @@ -883,7 +886,7 @@ /** * @param mixed $offset - * @param $value + * @param mixed $value */ public function offsetSet( $offset, $value ) { $this->messages[$offset] = $value; diff --git a/MessageGroups.php b/MessageGroups.php index a24fabf..bb5c772 100644 --- a/MessageGroups.php +++ b/MessageGroups.php @@ -30,7 +30,9 @@ */ protected $cache; - /// Initialises the list of groups + /** + * Initialises the list of groups + */ protected function init() { global $wgAutoloadClasses; @@ -143,6 +145,7 @@ * This constructs the list of all groups from multiple different * sources. When possible, a cache dependency is created to automatically * recreate the cache when configuration changes. + * @return array */ protected function loadGroupDefinitions() { global $wgAutoloadClasses; @@ -167,7 +170,12 @@ return $groups; } - /// Hook: TranslatePostInitGroups + /** + * Hook: TranslatePostInitGroups + * @param array &$groups + * @param array &$deps + * @param array &$autoload + */ public static function getTranslatablePages( array &$groups, array &$deps, array &$autoload ) { global $wgEnablePageTranslation; @@ -193,7 +201,12 @@ } } - /// Hook: TranslatePostInitGroups + /** + * Hook: TranslatePostInitGroups + * @param array &$groups + * @param array &$deps + * @param array &$autoload + */ public static function getConfiguredGroups( array &$groups, array &$deps, array &$autoload ) { global $wgTranslateGroupFiles; @@ -225,7 +238,12 @@ } } - /// Hook: TranslatePostInitGroups + /** + * Hook: TranslatePostInitGroups + * @param array &$groups + * @param array &$deps + * @param array &$autoload + */ public static function getWorkflowGroups( array &$groups, array &$deps, array &$autoload ) { global $wgTranslateWorkflowStates; @@ -236,12 +254,22 @@ } } - /// Hook: TranslatePostInitGroups + /** + * Hook: TranslatePostInitGroups + * @param array &$groups + * @param array &$deps + * @param array &$autoload + */ public static function getAggregateGroups( array &$groups, array &$deps, array &$autoload ) { $groups += self::loadAggregateGroups(); } - /// Hook: TranslatePostInitGroups + /** + * Hook: TranslatePostInitGroups + * @param array &$groups + * @param array &$deps + * @param array &$autoload + */ public static function getCCGroups( array &$groups, array &$deps, array &$autoload ) { global $wgTranslateCC; @@ -391,7 +419,11 @@ } } - /// @since 2011-12-28 + /** + * @since 2011-12-28 + * @param MessageGroup $group + * @return bool + */ public static function isDynamic( MessageGroup $group ) { $id = $group->getId(); @@ -596,6 +628,7 @@ /** * Contents on these groups changes on a whim. * @since 2011-12-28 + * @return array */ public static function getDynamicGroups() { return [ @@ -694,12 +727,22 @@ return $tree; } - /// See getGroupStructure, just collects ids into array + /** + * See getGroupStructure, just collects ids into array + * @param MessageGroup $value + * @param string $key + * @param bool $used + */ public static function collectGroupIds( MessageGroup $value, $key, $used ) { $used[0][$value->getId()] = true; } - /// Sorts groups by label value + /** + * Sorts groups by label value + * @param string $a + * @param string $b + * @return int + */ public static function groupLabelSort( $a, $b ) { $al = $a->getLabel(); $bl = $b->getLabel(); diff --git a/Translate.php b/Translate.php index 19b90b8..152f615 100644 --- a/Translate.php +++ b/Translate.php @@ -645,9 +645,9 @@ * * It defines constants for the namespace (and talk namespace) and sets up * restrictions and some other configuration. - * @param $id \int Namespace number - * @param $name \string Name of the namespace - * @param $constant \string (optional) name of namespace constant, defaults to + * @param \int $id Namespace number + * @param \string $name Name of the namespace + * @param \string $constant (optional) name of namespace constant, defaults to * NS_ followed by upper case version of $name, e.g., NS_MEDIAWIKI */ function wfAddNamespace( $id, $name, $constant = null ) { diff --git a/TranslateEditAddons.php b/TranslateEditAddons.php index 9bb2b97..a194b85 100644 --- a/TranslateEditAddons.php +++ b/TranslateEditAddons.php @@ -18,6 +18,7 @@ /** * Do not show the usual introductory messages on edit page for messages. * Hook: AlternateEdit + * @param EditPage $editPage */ public static function suppressIntro( EditPage $editPage ) { $handle = new MessageHandle( $editPage->getTitle() ); @@ -83,6 +84,8 @@ /** * Adds the translation aids and navigation to the normal edit page. * Hook: EditPage::showEditForm:initial + * @param EditPage $object + * @return true */ public static function addTools( EditPage $object ) { $handle = new MessageHandle( $object->getTitle() ); @@ -99,6 +102,10 @@ * Replace the normal save button with one that says if you are editing * message documentation to try to avoid accidents. * Hook: EditPageBeforeEditButtons + * @param EditPage $editpage + * @param array &$buttons + * @param int $tabindex + * @return true */ public static function buttonHack( EditPage $editpage, &$buttons, $tabindex ) { $handle = new MessageHandle( $editpage->getTitle() ); @@ -198,6 +205,16 @@ /** * Runs message checks, adds tp:transver tags and updates statistics. * Hook: PageContentSaveComplete + * @param WikiPage $wikiPage + * @param User $user + * @param Content $content + * @param string $summary + * @param bool $minor + * @param string $_1 + * @param bool $_2 + * @param int $flags + * @param Revision $revision + * @return true */ public static function onSave( WikiPage $wikiPage, $user, $content, $summary, $minor, $_1, $_2, $flags, $revision @@ -377,6 +394,9 @@ /** * Hook: ArticleContentOnDiff + * @param DifferenceEngine $de + * @param OutputPage $out + * @return true */ public static function displayOnDiff( DifferenceEngine $de, OutputPage $out ) { $title = $de->getTitle(); diff --git a/TranslateHooks.php b/TranslateHooks.php index a6b6a52..a06a57b 100644 --- a/TranslateHooks.php +++ b/TranslateHooks.php @@ -13,6 +13,7 @@ class TranslateHooks { /** * Hook: ResourceLoaderTestModules + * @param array &$modules */ public static function onResourceLoaderTestModules( array &$modules ) { $modules['qunit']['ext.translate.parsers.test'] = [ @@ -425,6 +426,7 @@ /** * Hook: ParserTestTables + * @param array &$tables */ public static function parserTestTables( array &$tables ) { $tables[] = 'revtag'; @@ -450,6 +452,8 @@ /** * Hook: LanguageGetTranslatedLanguageNames * Hook: TranslateSupportedLanguages + * @param array &$names + * @param string $code */ public static function translateMessageDocumentationLanguage( array &$names, $code ) { global $wgTranslateDocumentationLanguageCode; @@ -469,6 +473,7 @@ /** * Hook: SpecialSearchProfiles + * @param array &$profiles */ public static function searchProfile( array &$profiles ) { global $wgTranslateMessageNamespaces; @@ -497,6 +502,12 @@ /** * Hook: SpecialSearchProfileForm + * @param SpecialSearch $search + * @param string &$form + * @param string $profile + * @param string $term + * @param array $opts + * @return bool */ public static function searchProfileForm( SpecialSearch $search, @@ -561,6 +572,9 @@ /** * Hook: SpecialSearchSetupEngine + * @param SpecialSearch $search + * @param string $profile + * @param SearchEngine $engine */ public static function searchProfileSetupEngine( SpecialSearch $search, @@ -581,6 +595,9 @@ /** * Hook: Translate:MessageGroupStats:isIncluded + * @param int $id + * @param string $code + * @return bool */ public static function hideDiscouragedFromStats( $id, $code ) { // Return true to keep, false to exclude @@ -589,6 +606,9 @@ /** * Hook: Translate:MessageGroupStats:isIncluded + * @param int $id + * @param string $code + * @return false */ public static function hideRestrictedFromStats( $id, $code ) { $filterLangs = TranslateMetadata::get( $id, 'prioritylangs' ); @@ -605,6 +625,7 @@ /** * Hook: LinksUpdate + * @param LinksUpdate $updater */ public static function preventCategorization( LinksUpdate $updater ) { $handle = new MessageHandle( $updater->getTitle() ); @@ -618,6 +639,8 @@ * * Adds $wgTranslateDocumentationLanguageCode to ResourceLoader configuration * when Special:Translate is shown. + * @param array &$vars + * @param OutputPage $out */ public static function addConfig( array &$vars, OutputPage $out ) { $request = $out->getRequest(); @@ -644,6 +667,7 @@ /** * Hook: AdminLinks + * @param ALTree $tree */ public static function onAdminLinks( ALTree $tree ) { global $wgTranslateUseSandbox; @@ -716,6 +740,10 @@ * Hook: AbortEmailNotification * * False aborts the email. + * @param User $editor + * @param Title $title + * @param RecentChange $rc + * @return bool */ public static function onAbortEmailNotificationReview( User $editor, @@ -762,6 +790,7 @@ /** * Hook: ParserFirstCallInit + * @param Parser $parser */ public static function setupTranslateParserFunction( Parser $parser ) { $parser->setFunctionHook( 'translation', 'TranslateHooks::translateRenderParserFunction' ); diff --git a/TranslateTasks.php b/TranslateTasks.php index c57d0aa..d9aa797 100644 --- a/TranslateTasks.php +++ b/TranslateTasks.php @@ -89,10 +89,14 @@ */ abstract protected function output(); - /// Processes messages before paging is done. + /** + * Processes messages before paging is done. + */ abstract protected function preinit(); - /// Processes messages after paging is done. + /** + * Processes messages after paging is done. + */ abstract protected function postinit(); /** diff --git a/api/ApiQueryMessageCollection.php b/api/ApiQueryMessageCollection.php index a0415b1..0441e05 100644 --- a/api/ApiQueryMessageCollection.php +++ b/api/ApiQueryMessageCollection.php @@ -158,9 +158,9 @@ } /** - * @param $result ApiResult - * @param $props array - * @param $message ThinMessage + * @param ApiResult $result + * @param array $props + * @param ThinMessage $message * @return array */ public function extractMessageData( $result, $props, $message ) { diff --git a/ffs/AmdFFS.php b/ffs/AmdFFS.php index c082dac..1f774ce 100644 --- a/ffs/AmdFFS.php +++ b/ffs/AmdFFS.php @@ -60,7 +60,7 @@ } /** - * @param array $data + * @param string $data * @return array Parsed data. */ public function readFromVariable( $data ) { diff --git a/ffs/AppleFFS.php b/ffs/AppleFFS.php index ae8fcdd..0465d7b 100644 --- a/ffs/AppleFFS.php +++ b/ffs/AppleFFS.php @@ -23,7 +23,7 @@ // READ /** - * @param array $data + * @param string $data * @return array Parsed data. * @throws MWException */ diff --git a/ffs/DtdFFS.php b/ffs/DtdFFS.php index af8192c..140fc16 100644 --- a/ffs/DtdFFS.php +++ b/ffs/DtdFFS.php @@ -21,7 +21,7 @@ } /** - * @param $data string + * @param string $data * @return array Parsed data. */ public function readFromVariable( $data ) { diff --git a/ffs/FFS.php b/ffs/FFS.php index acacec7..87d266e 100644 --- a/ffs/FFS.php +++ b/ffs/FFS.php @@ -52,7 +52,7 @@ * Writes to the location provided with setWritePath and group specific * directory structure. Exports translations included in the given * collection with any special handling needed. - * @param $collection MessageCollection + * @param MessageCollection $collection */ public function write( MessageCollection $collection ); @@ -80,6 +80,8 @@ * have multiple representations. The main case are inline plurals, * which in some formats require expansion at export time. * + * @param string $a + * @param string $b * @return bool * @since 2016.11 */ diff --git a/ffs/GettextFFS.php b/ffs/GettextFFS.php index 2f98352..180195f 100644 --- a/ffs/GettextFFS.php +++ b/ffs/GettextFFS.php @@ -31,7 +31,7 @@ protected $offlineMode = false; /** - * @param $value bool + * @param bool $value */ public function setOfflineMode( $value ) { $this->offlineMode = $value; @@ -328,8 +328,8 @@ * not allowed in MediaWiki pages, the default action is to append * \-character at the end of the message. You can also choose to ignore it * and use the trim action instead. - * @param $data - * @param $whitespace string + * @param string $data + * @param string $whitespace * @throws MWException * @return string */ @@ -606,7 +606,7 @@ /** * Returns plural rule for Gettext. - * @param $code \string Language code. + * @param \string $code Language code. * @return \string */ public static function getPluralRule( $code ) { diff --git a/ffs/JavaFFS.php b/ffs/JavaFFS.php index 77b4fdc..87d9b1b 100644 --- a/ffs/JavaFFS.php +++ b/ffs/JavaFFS.php @@ -21,7 +21,7 @@ protected $keySeparator = '='; /** - * @param $group FileBasedMessageGroup + * @param FileBasedMessageGroup $group */ public function __construct( FileBasedMessageGroup $group ) { parent::__construct( $group ); @@ -34,7 +34,7 @@ // READ /** - * @param $data array + * @param string $data * @return array Parsed data. * @throws MWException */ @@ -98,7 +98,7 @@ // Write /** - * @param $collection MessageCollection + * @param MessageCollection $collection * @return string */ protected function writeReal( MessageCollection $collection ) { @@ -216,7 +216,7 @@ } /** - * @param $collection MessageCollection + * @param MessageCollection $collection * @return string */ protected function doHeader( MessageCollection $collection ) { @@ -236,7 +236,7 @@ } /** - * @param $collection MessageCollection + * @param MessageCollection $collection * @return string */ protected function doAuthors( MessageCollection $collection ) { diff --git a/ffs/JavaScriptFFS.php b/ffs/JavaScriptFFS.php index c77b365..070bfd9 100644 --- a/ffs/JavaScriptFFS.php +++ b/ffs/JavaScriptFFS.php @@ -12,7 +12,7 @@ /** * Message keys format. * - * @param $key string + * @param string $key * * @return string */ @@ -21,8 +21,8 @@ /** * Header of message file. * - * @param $code string - * @param $authors array + * @param string $code + * @param array $authors */ abstract protected function header( $code, $authors ); @@ -32,7 +32,7 @@ abstract protected function footer(); /** - * @param $data array + * @param string $data * @return array Parsed data. */ public function readFromVariable( $data ) { @@ -135,7 +135,7 @@ } /** - * @param $collection MessageCollection + * @param MessageCollection $collection * @return string */ public function writeReal( MessageCollection $collection ) { @@ -177,7 +177,7 @@ } /** - * @param $authors array + * @param array $authors * @return string */ protected function authorsList( $authors ) { @@ -220,7 +220,7 @@ ]; /** - * @param $string string + * @param string $string * @return string */ protected static function escapeJsString( $string ) { @@ -228,7 +228,7 @@ } /** - * @param $string string + * @param string $string * @return string */ protected static function unescapeJsString( $string ) { @@ -243,7 +243,7 @@ class ShapadoJsFFS extends JavaScriptFFS { /** - * @param $key string + * @param string $key * * @return string */ @@ -252,8 +252,8 @@ } /** - * @param $code string - * @param $authors array + * @param string $code + * @param array $authors * @return string */ protected function header( $code, $authors ) { diff --git a/ffs/JsonFFS.php b/ffs/JsonFFS.php index 0c176e9..e68e1ce 100644 --- a/ffs/JsonFFS.php +++ b/ffs/JsonFFS.php @@ -17,7 +17,7 @@ */ class JsonFFS extends SimpleFFS { /** - * @param $data + * @param string $data * @return bool */ public static function isValid( $data ) { @@ -25,7 +25,7 @@ } /** - * @param $group FileBasedMessageGroup + * @param FileBasedMessageGroup $group */ public function __construct( FileBasedMessageGroup $group ) { parent::__construct( $group ); @@ -37,7 +37,7 @@ } /** - * @param array $data + * @param string $data * @return array Parsed data. */ public function readFromVariable( $data ) { diff --git a/ffs/MediaWikiComplexMessages.php b/ffs/MediaWikiComplexMessages.php index f968095..b73ee76 100644 --- a/ffs/MediaWikiComplexMessages.php +++ b/ffs/MediaWikiComplexMessages.php @@ -132,7 +132,7 @@ /** * Gets data from request. Needs to be run before the form is displayed and * validation. Not needed for export, which uses request directly. - * @param $request WebRequest + * @param WebRequest $request */ public function loadFromRequest( WebRequest $request ) { $saved = $this->parse( $this->formatForSave( $request ) ); @@ -181,7 +181,7 @@ /** * Return an array of keys that can be used to iterate over all keys - * @param $group + * @param string $group * @return Array of keys for data */ protected function getIterator( $group ) { @@ -213,8 +213,8 @@ } /** - * @param $group - * @param $code + * @param string $group + * @param string $code * @return array */ protected function readVariable( $group, $code ) { @@ -251,7 +251,7 @@ return $data; } - // /Data retrieval + // Data retrieval // Output public function header( $title ) { @@ -362,7 +362,7 @@ ] ); } - // /Output + // Output // Save to database @@ -429,7 +429,7 @@ $this->init = false; } - // /Save to database + // Save to database // Export public function validate( array &$errors, $filter = false ) { @@ -564,7 +564,7 @@ /** * Returns string with quotes that should be valid php - * @param $data string + * @param string $data * @throws MWException * @return string */ @@ -578,7 +578,7 @@ return "'$data'"; } - // /Export + // Export public function highlight( $key, $values ) { return $values; } diff --git a/ffs/MediaWikiExtensions.php b/ffs/MediaWikiExtensions.php index 044c335..9e88d89 100644 --- a/ffs/MediaWikiExtensions.php +++ b/ffs/MediaWikiExtensions.php @@ -76,12 +76,21 @@ $this->namespace = $value; } - /// Makes an group id from extension name + /** + * Makes an group id from extension name + * @param string $name + * @return string + */ public static function foldId( $name ) { return preg_replace( '/\s+/', '', strtolower( $name ) ); } - /// Hook: TranslatePostInitGroups + /** + * Hook: TranslatePostInitGroups + * @param array &$list + * @param array &$deps + * @return true + */ public function register( array &$list, array &$deps ) { $groups = $this->parseFile(); $groups = $this->processGroups( $groups ); diff --git a/ffs/YamlFFS.php b/ffs/YamlFFS.php index c680ac4..8d2096f 100644 --- a/ffs/YamlFFS.php +++ b/ffs/YamlFFS.php @@ -9,7 +9,7 @@ */ class YamlFFS extends SimpleFFS implements MetaYamlSchemaExtender { /** - * @param $group FileBasedMessageGroup + * @param FileBasedMessageGroup $group */ public function __construct( FileBasedMessageGroup $group ) { parent::__construct( $group ); @@ -21,7 +21,7 @@ } /** - * @param $data + * @param string $data * @return array Parsed data. */ public function readFromVariable( $data ) { @@ -51,7 +51,7 @@ } /** - * @param $collection MessageCollection + * @param MessageCollection $collection * @return string */ protected function writeReal( MessageCollection $collection ) { @@ -94,7 +94,7 @@ } /** - * @param $collection MessageCollection + * @param MessageCollection $collection * @return string */ protected function doHeader( MessageCollection $collection ) { @@ -115,7 +115,7 @@ } /** - * @param $collection MessageCollection + * @param MessageCollection $collection * @return string */ protected function doAuthors( MessageCollection $collection ) { @@ -150,7 +150,7 @@ * Flattens multidimensional array by using the path to the value as key * with each individual key separated by a dot. * - * @param $messages array + * @param array $messages * * @return array */ @@ -162,7 +162,7 @@ * Performs the reverse operation of flatten. Each dot (or custom separator) * in the key starts a new subarray in the final array. * - * @param $messages array + * @param array $messages * * @return array */ diff --git a/messagegroups/FileBasedMessageGroup.php b/messagegroups/FileBasedMessageGroup.php index 182297b..1d11d78 100644 --- a/messagegroups/FileBasedMessageGroup.php +++ b/messagegroups/FileBasedMessageGroup.php @@ -22,7 +22,7 @@ /** * Constructs a FileBasedMessageGroup from any normal message group. * Useful for doing special Gettext exports from any group. - * @param $group MessageGroup + * @param MessageGroup $group * @return FileBasedMessageGroup */ public static function newFromMessageGroup( $group ) { diff --git a/messagegroups/MessageGroup.php b/messagegroups/MessageGroup.php index e7b71e7..5b4f348 100644 --- a/messagegroups/MessageGroup.php +++ b/messagegroups/MessageGroup.php @@ -104,7 +104,7 @@ /** * Initialises a message collection with the given language code, * message definitions and message tags. - * @param $code + * @param string $code * @return MessageCollection */ public function initCollection( $code ); @@ -114,7 +114,7 @@ * that list may be identical with the translation in the wiki. For other * groups the messages may be loaded from a file (and differ from the * current translations or definitions). - * @param $code + * @param string $code * @return array */ public function load( $code ); @@ -127,7 +127,7 @@ /** * Returns message tags. If type is given, only message keys with that * tag are returned. Otherwise an array[tag => keys] is returned. - * @param $type string + * @param string $type * @return array */ public function getTags( $type = null ); diff --git a/messagegroups/MessageGroupBase.php b/messagegroups/MessageGroupBase.php index fb22c4a..74a7d7b 100644 --- a/messagegroups/MessageGroupBase.php +++ b/messagegroups/MessageGroupBase.php @@ -31,7 +31,7 @@ } /** - * @param $conf + * @param array $conf * * @return MessageGroup */ @@ -157,6 +157,7 @@ /** * Returns the configured InsertablesSuggester if any. * @since 2013.09 + * @return CombinedInsertablesSuggester */ public function getInsertablesSuggester() { $allClasses = []; diff --git a/messagegroups/MessageGroupOld.php b/messagegroups/MessageGroupOld.php index 74324f8..f7ca682 100644 --- a/messagegroups/MessageGroupOld.php +++ b/messagegroups/MessageGroupOld.php @@ -32,7 +32,7 @@ } /** - * @param $value string + * @param string $value */ public function setLabel( $value ) { $this->label = $value; @@ -51,7 +51,7 @@ } /** - * @param $value string + * @param string $value */ public function setId( $value ) { $this->id = $value; @@ -64,12 +64,18 @@ */ protected $namespace = NS_MEDIAWIKI; - /// Get the namespace where all the messages of this group belong. + /** + * Get the namespace where all the messages of this group belong. + * @return int + */ public function getNamespace() { return $this->namespace; } - /// Set the namespace where all the messages of this group belong. + /** + * Set the namespace where all the messages of this group belong. + * @param int $ns + */ public function setNamespace( $ns ) { $this->namespace = $ns; } @@ -88,7 +94,7 @@ } /** - * @param $value array + * @param array $value */ public function setOptional( $value ) { $this->optional = $value; @@ -107,7 +113,7 @@ } /** - * @param $value array + * @param array $value */ public function setIgnored( $value ) { $this->ignored = $value; @@ -251,7 +257,7 @@ } /** - * @param $code + * @param string $code * @return bool|string */ public function getMessageFileWithPath( $code ) { @@ -272,8 +278,8 @@ /** * Creates a new MessageCollection for this group. * - * @param $code \string Language code for this collection. - * @param $unique \bool Whether to build collection for messages unique to this + * @param \string $code Language code for this collection. + * @param \bool $unique Whether to build collection for messages unique to this * group only. * @return MessageCollection */ @@ -323,14 +329,17 @@ } /** - * @param $code string + * @param string $code * @return bool */ protected function isSourceLanguage( $code ) { return $code === $this->getSourceLanguage(); } - // Unsupported stuff, just to satisfy the new interface + /** + * Unsupported stuff, just to satisfy the new interface + * @param array $conf + */ public function setConfiguration( $conf ) { } diff --git a/messagegroups/RecentMessageGroup.php b/messagegroups/RecentMessageGroup.php index c961c90..bbf915c 100644 --- a/messagegroups/RecentMessageGroup.php +++ b/messagegroups/RecentMessageGroup.php @@ -61,6 +61,7 @@ /** * Allows subclasses to partially customize the query. + * @return array */ protected function getQueryConditions() { global $wgTranslateMessageNamespaces; diff --git a/phpcs.xml b/phpcs.xml index 9789b19..8519e70 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -5,10 +5,7 @@ <exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected"/> <exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic"/> <exclude name="MediaWiki.Commenting.FunctionComment.MissingParamComment"/> - <exclude name="MediaWiki.Commenting.FunctionComment.MissingParamName"/> - <exclude name="MediaWiki.Commenting.FunctionComment.MissingParamTag"/> - <exclude name="MediaWiki.Commenting.FunctionComment.MissingReturn"/> - <exclude name="MediaWiki.Commenting.FunctionComment.WrongStyle" /> + <exclude name="MediaWiki.Commenting.FunctionComment.WrongStyle"/> <exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" /> <exclude name="MediaWiki.Files.ClassMatchesFilename.WrongCase" /> <exclude name="MediaWiki.Files.OneClassPerFile.MultipleFound" /> diff --git a/specials/CompatibleLinkRenderer.php b/specials/CompatibleLinkRenderer.php index 9a79bc9..8f4d784 100644 --- a/specials/CompatibleLinkRenderer.php +++ b/specials/CompatibleLinkRenderer.php @@ -7,7 +7,7 @@ trait CompatibleLinkRenderer { /** - * @param $target + * @param Title $target * @param string|null $text string must be escaped HTML * @param array $extraAttribs * @param array $query @@ -28,7 +28,7 @@ } /** - * @param $target + * @param Title $target * @param string|null $text string must be escaped HTML * @param array $extraAttribs * @param array $query diff --git a/specials/SpecialImportTranslations.php b/specials/SpecialImportTranslations.php index c667495..33bb094 100644 --- a/specials/SpecialImportTranslations.php +++ b/specials/SpecialImportTranslations.php @@ -109,7 +109,7 @@ * Checks for error state from the return value of loadFile and parseFile * functions. Prints the error and the form and returns true if there is an * error. Returns false and does nothing if there is no error. - * @param $msg array + * @param array $msg * @return bool */ protected function checkError( $msg ) { @@ -163,7 +163,7 @@ /** * Try to get the file data from any of the supported methods. - * @param $filedata + * @param string &$filedata * @return array */ protected function loadFile( &$filedata ) { @@ -180,7 +180,7 @@ /** * Try parsing file. - * @param $data + * @param string $data * @return array */ protected function parseFile( $data ) { diff --git a/specials/SpecialLanguageStats.php b/specials/SpecialLanguageStats.php index cd2a70c..a949724 100644 --- a/specials/SpecialLanguageStats.php +++ b/specials/SpecialLanguageStats.php @@ -173,7 +173,7 @@ /** * Return the list of allowed values for target here. - * @param $value + * @param string $value * @return array */ protected function isValidValue( $value ) { @@ -182,7 +182,9 @@ return isset( $langs[$value] ); } - /// Called when the target is unknown. + /** + * Called when the target is unknown. + */ protected function invalidTarget() { $this->getOutput()->wrapWikiMsg( "<div class='error'>$1</div>", @@ -412,9 +414,9 @@ * If $item is an array, meaning that the first group is an * AggregateMessageGroup and the latter are its children, it will recurse * and create rows for them too. - * @param $item Array|MessageGroup - * @param $cache Array Cache as returned by MessageGroupStats::forLanguage - * @param $parent MessageGroup (do not use, used internally only) + * @param array|MessageGroup $item + * @param array $cache Cache as returned by MessageGroupStats::forLanguage + * @param MessageGroup|null $parent MessageGroup (do not use, used internally only) * @return string */ protected function makeGroupGroup( $item, array $cache, MessageGroup $parent = null ) { diff --git a/specials/SpecialManageGroups.php b/specials/SpecialManageGroups.php index fad2d96..7e1f969 100644 --- a/specials/SpecialManageGroups.php +++ b/specials/SpecialManageGroups.php @@ -332,6 +332,9 @@ * Adds the task-based tabs on Special:Translate and few other special pages. * Hook: SkinTemplateNavigation::SpecialPage * @since 2012-05-14 + * @param Skin $skin + * @param array &$tabs + * @return true */ public static function tabify( Skin $skin, array &$tabs ) { $title = $skin->getTitle(); diff --git a/specials/SpecialMessageGroupStats.php b/specials/SpecialMessageGroupStats.php index 3fb728d..0f80bee 100644 --- a/specials/SpecialMessageGroupStats.php +++ b/specials/SpecialMessageGroupStats.php @@ -200,9 +200,9 @@ * Filter an array of languages based on whether a priority set of * languages present for the passed group. If priority languages are * present, to that list add languages with more than 0% translation. - * @param $languages Array of Languages to be filtered - * @param $group - * @param $cache + * @param array &$languages Array of Languages to be filtered + * @param string $group + * @param array $cache */ protected function filterPriorityLangs( &$languages, $group, $cache ) { $filterLangs = TranslateMetadata::get( $group, 'prioritylangs' ); @@ -223,8 +223,8 @@ } /** - * @param $code - * @param $cache + * @param string $code + * @param array $cache * @return string */ protected function makeRow( $code, $cache ) { @@ -271,8 +271,8 @@ } /** - * @param $code - * @param $params + * @param string $code + * @param array $params * @return string */ protected function getMainColumnCell( $code, $params ) { diff --git a/specials/SpecialSearchTranslations.php b/specials/SpecialSearchTranslations.php index c5efeeb..2ed2e11 100644 --- a/specials/SpecialSearchTranslations.php +++ b/specials/SpecialSearchTranslations.php @@ -410,7 +410,12 @@ ); } - // Build ellipsis to select options + /** + * Build ellipsis to select options + * @param string $key + * @param string $value + * @return string + */ protected function ellipsisSelector( $key, $value ) { $nondefaults = $this->opts->getChangedValues(); $taskParams = [ 'filter' => $value ] + $nondefaults; @@ -435,6 +440,7 @@ /** * Design the tabs + * @return string */ protected function messageSelector() { $nondefaults = $this->opts->getChangedValues(); diff --git a/specials/SpecialTranslate.php b/specials/SpecialTranslate.php index 70532fc..288f743 100644 --- a/specials/SpecialTranslate.php +++ b/specials/SpecialTranslate.php @@ -244,6 +244,7 @@ /** * Returns array of errors in the form parameters. + * @return array */ protected function getFormErrors() { $errors = []; @@ -660,9 +661,9 @@ } /** - * @param $label string - * @param $option string - * @param $error string Html + * @param string $label + * @param string $option + * @param string $error Html * @return string */ private static function optionRow( $label, $option, $error = null ) { @@ -825,6 +826,9 @@ * Adds the task-based tabs on Special:Translate and few other special pages. * Hook: SkinTemplateNavigation::SpecialPage * @since 2012-02-10 + * @param Skin $skin + * @param array &$tabs + * @return true */ public static function tabify( Skin $skin, array &$tabs ) { $title = $skin->getTitle(); diff --git a/specials/SpecialTranslationStats.php b/specials/SpecialTranslationStats.php index b38a812..9a2c391 100644 --- a/specials/SpecialTranslationStats.php +++ b/specials/SpecialTranslationStats.php @@ -785,7 +785,11 @@ return $conds; } - /// @since 2012-03-05 + /** + * @since 2012-03-05 + * @param array $groupIds + * @return array + */ protected static function namespacesFromGroups( $groupIds ) { $namespaces = []; foreach ( $groupIds as $id ) { diff --git a/stash/StashedTranslation.php b/stash/StashedTranslation.php index c2c05bd..8d2cd49 100644 --- a/stash/StashedTranslation.php +++ b/stash/StashedTranslation.php @@ -24,22 +24,30 @@ $this->metadata = $metadata; } - /// @return User + /** + * @return User + */ public function getUser() { return $this->user; } - /// @return Title + /** + * @return Title + */ public function getTitle() { return $this->title; } - /// @return string + /** + * @return string + */ public function getValue() { return $this->value; } - /// @return array + /** + * @return array + */ public function getMetadata() { return $this->metadata; } diff --git a/tag/PageTranslationHooks.php b/tag/PageTranslationHooks.php index 44f4e6a..0fc1dfd 100644 --- a/tag/PageTranslationHooks.php +++ b/tag/PageTranslationHooks.php @@ -75,6 +75,7 @@ * * @param Title $title * @param Language &$pageLang + * @return true */ public static function onPageContentLanguage( Title $title, &$pageLang ) { // For translation pages, parse plural, grammar etc with correct language, @@ -103,7 +104,12 @@ } } - /// Hook: OutputPageBeforeHTML + /** + * Hook: OutputPageBeforeHTML + * @param OutputPage $out + * @param string $text + * @return true + */ public static function injectCss( OutputPage $out, /*string*/$text ) { global $wgTranslatePageTranslationULS; @@ -131,6 +137,15 @@ /** * This is triggered after saves to translation unit pages + * @param WikiPage $wikiPage + * @param User $user + * @param TextContent $content + * @param string $summary + * @param bool $minor + * @param int $flags + * @param Revision $revision + * @param MessageHandle $handle + * @return true */ public static function onSectionSave( WikiPage $wikiPage, User $user, TextContent $content, $summary, $minor, $flags, $revision, MessageHandle $handle @@ -366,6 +381,11 @@ /** * Display nice error when editing content. * Hook: EditFilterMergedContent + * @param IContextSource $context + * @param Content $content + * @param Status $status + * @param string $summary + * @return true */ public static function tpSyntaxCheckForEditContent( $context, $content, $status, $summary ) { if ( !$content instanceof TextContent ) { @@ -390,6 +410,9 @@ /** * Returns any syntax error. + * @param Title $title + * @param string $text + * @return null|TPException */ protected static function tpSyntaxError( $title, $text ) { if ( strpos( $text, '<translate>' ) === false ) { @@ -410,6 +433,16 @@ * When attempting to save, last resort. Edit page would only display * edit conflict if there wasn't tpSyntaxCheckForEditPage. * Hook: PageContentSave + * @param WikiPage $wikiPage + * @param User $user + * @param Content $content + * @param string $summary + * @param bool $minor + * @param string $_1 + * @param bool $_2 + * @param int $flags + * @param Status $status + * @return true */ public static function tpSyntaxCheck( $wikiPage, $user, $content, $summary, $minor, $_1, $_2, $flags, $status @@ -440,6 +473,16 @@ /** * Hook: PageContentSaveComplete + * @param WikiPage $wikiPage + * @param User $user + * @param Content $content + * @param string $summary + * @param bool $minor + * @param string $_1 + * @param bool $_2 + * @param int $flags + * @param Revision $revision + * @return true */ public static function addTranstag( $wikiPage, $user, $content, $summary, $minor, $_1, $_2, $flags, $revision @@ -483,6 +526,10 @@ * at the moment. * Hook: RevisionInsertComplete * @since 2012-05-08 + * @param Revision $rev + * @param string $text + * @param int $flags + * @return true */ public static function updateTranstagOnNullRevisions( Revision $rev, $text, $flags ) { $title = $rev->getTitle(); @@ -590,6 +637,11 @@ /** * Prevent editing of translation pages directly. * Hook: getUserPermissionsErrorsExpensive + * @param Title $title + * @param User $user + * @param string $action + * @param bool &$result + * @return bool */ public static function preventDirectEditing( Title $title, User $user, $action, &$result ) { if ( self::$allowTargetEdit ) { @@ -824,14 +876,25 @@ } } - /// Hook: SpecialPage_initList + /** + * Hook: SpecialPage_initList + * @param array &$list + * @return true + */ public static function replaceMovePage( &$list ) { $list['Movepage'] = 'SpecialPageTranslationMovePage'; return true; } - /// Hook: getUserPermissionsErrorsExpensive + /** + * Hook: getUserPermissionsErrorsExpensive + * @param Title $title + * @param User $user + * @param string $action + * @param array &$result + * @return bool + */ public static function lockedPagesCheck( Title $title, User $user, $action, &$result ) { if ( $action === 'read' ) { return true; @@ -848,7 +911,13 @@ return true; } - /// Hook: SkinSubPageSubtitle + /** + * Hook: SkinSubPageSubtitle + * @param array &$subpages + * @param Skin|null $skin + * @param OutputPage $out + * @return bool + */ public static function replaceSubtitle( &$subpages, $skin = null, OutputPage $out ) { $isTranslationPage = TranslatablePage::isTranslationPage( $out->getTitle() ); if ( !$isTranslationPage @@ -911,6 +980,9 @@ * Converts the edit tab (if exists) for translation pages to translate tab. * Hook: SkinTemplateNavigation * @since 2013.06 + * @param Skin $skin + * @param array &$tabs + * @return true */ public static function translateTab( Skin $skin, array &$tabs ) { $title = $skin->getTitle(); @@ -937,6 +1009,12 @@ * Hook to update source and destination translation pages on moving translation units * Hook: TitleMoveComplete * @since 2014.08 + * @param Title $ot + * @param Title $nt + * @param User $user + * @param int $oldid + * @param int $newid + * @param string $reason */ public static function onMoveTranslationUnits( Title $ot, Title $nt, User $user, $oldid, $newid, $reason @@ -984,6 +1062,12 @@ * Hook to update translation page on deleting a translation unit * Hook: ArticleDeleteComplete * @since 2016.05 + * @param WikiPage &$unit + * @param User &$user + * @param string $reason + * @param int $id + * @param Content $content + * @param ManualLogEntry $logEntry */ public static function onDeleteTranslationUnit( WikiPage &$unit, User &$user, $reason, $id, $content, $logEntry diff --git a/tag/TranslatablePage.php b/tag/TranslatablePage.php index 3502c2a..88ad806 100644 --- a/tag/TranslatablePage.php +++ b/tag/TranslatablePage.php @@ -884,6 +884,7 @@ /** * Get a list of page ids where the latest revision is either tagged or marked + * @return array */ public static function getTranslatablePages() { $dbr = TranslateUtils::getSafeReadDB(); diff --git a/tag/TranslatablePageMoveJob.php b/tag/TranslatablePageMoveJob.php index 52ebaf7..bffa526 100644 --- a/tag/TranslatablePageMoveJob.php +++ b/tag/TranslatablePageMoveJob.php @@ -14,10 +14,13 @@ * @ingroup PageTranslation JobQueue */ class TranslatablePageMoveJob extends Job { + /** - * @param $target Title - * @param $params array, should include base-source and base-target - * @param $performer + * @param Titel $source + * @param Title $target + * @param array $moves should include base-source and base-target + * @param string $summary + * @param User $performer * @return TranslateMoveJob */ public static function newJob( diff --git a/tag/TranslateDeleteJob.php b/tag/TranslateDeleteJob.php index bf50f7c..a40df4d 100644 --- a/tag/TranslateDeleteJob.php +++ b/tag/TranslateDeleteJob.php @@ -15,11 +15,11 @@ */ class TranslateDeleteJob extends Job { /** - * @param $target Title - * @param $base - * @param $full - * @param $performer - * @param $reason + * @param Title $target + * @param string $base + * @param string $full + * @param User $performer + * @param string $reason * @return TranslateDeleteJob */ public static function newJob( Title $target, $base, $full, /*User*/$performer, $reason ) { @@ -128,7 +128,7 @@ } /** - * @param $performer User|string + * @param User|string $performer */ public function setPerformer( $performer ) { if ( is_object( $performer ) ) { @@ -143,7 +143,7 @@ } /** - * @param $user User|string + * @param User|string $user */ public function setUser( $user ) { if ( is_object( $user ) ) { diff --git a/tag/TranslateMoveJob.php b/tag/TranslateMoveJob.php index 6c55030..700bbe2 100644 --- a/tag/TranslateMoveJob.php +++ b/tag/TranslateMoveJob.php @@ -16,10 +16,10 @@ */ class TranslateMoveJob extends Job { /** - * @param $source Title - * @param $target Title - * @param $params array, should include base-source and base-target - * @param $performer + * @param Title $source + * @param Title $target + * @param array $params should include base-source and base-target + * @param User $performer * @return TranslateMoveJob */ public static function newJob( Title $source, Title $target, array $params, @@ -184,7 +184,7 @@ /** * Adapted from wfSuppressWarnings to allow not leaving redirects. - * @param $end bool + * @param bool $end */ public static function forceRedirects( $end = false ) { static $suppressCount = 0; diff --git a/tag/TranslateRenderJob.php b/tag/TranslateRenderJob.php index 489ac35..a6b46aa 100644 --- a/tag/TranslateRenderJob.php +++ b/tag/TranslateRenderJob.php @@ -15,7 +15,7 @@ class TranslateRenderJob extends Job { /** - * @param $target Title + * @param Title $target * @return TranslateRenderJob */ public static function newJob( Title $target ) { @@ -92,7 +92,7 @@ } /** - * @param $user User|string + * @param User|string $user */ public function setUser( $user ) { if ( $user instanceof User ) { diff --git a/translationaids/SupportAid.php b/translationaids/SupportAid.php index 6d94fea..f35d316 100644 --- a/translationaids/SupportAid.php +++ b/translationaids/SupportAid.php @@ -24,7 +24,7 @@ /** * Target URL for a link provided by a support button/aid. * - * @param $title Title Title object for the translation message. + * @param Title $title Title object for the translation message. * @since 2015.09 * @return string * @throws TranslationHelperException diff --git a/ttmserver/CrossLanguageTranslationSearchQuery.php b/ttmserver/CrossLanguageTranslationSearchQuery.php index 5b1ed79..c7e54c9 100644 --- a/ttmserver/CrossLanguageTranslationSearchQuery.php +++ b/ttmserver/CrossLanguageTranslationSearchQuery.php @@ -58,11 +58,15 @@ return $documents; } - /* + /** * Extract messages from the resultset and build message definitions. * Create a message collection from the definitions in the target language. * Filter the message collection to get filtered messages. * Slice messages according to limit and offset given. + * @param resultset $resultset + * @param int $offset + * @param int $limit + * @return array */ protected function extractMessages( $resultset, $offset, $limit ) { $messages = $documents = $ret = []; diff --git a/ttmserver/DatabaseTTMServer.php b/ttmserver/DatabaseTTMServer.php index e947662..f306ec5 100644 --- a/ttmserver/DatabaseTTMServer.php +++ b/ttmserver/DatabaseTTMServer.php @@ -18,7 +18,7 @@ protected $sids; /** - * @param $mode int DB_SLAVE|DB_MASTER + * @param int $mode DB_REPLICA|DB_MASTER * @return DatabaseBase */ protected function getDB( $mode = DB_REPLICA ) { diff --git a/ttmserver/ElasticSearchTTMServer.php b/ttmserver/ElasticSearchTTMServer.php index 357cd06..eb32378 100644 --- a/ttmserver/ElasticSearchTTMServer.php +++ b/ttmserver/ElasticSearchTTMServer.php @@ -597,7 +597,12 @@ $this->updateMapping = true; } - // Parse query string and build the search query + /** + * Parse query string and build the search query + * @param string $queryString + * @param array $opts + * @return array + */ protected function parseQueryString( $queryString, array $opts ) { $fields = $highlights = []; $terms = preg_split( '/\s+/', $queryString ); @@ -663,7 +668,13 @@ return [ $searchQuery, $highlights ]; } - // Search interface + /** + * Search interface + * @param string $queryString + * @param array $opts + * @param array $highlight + * @return array + */ public function search( $queryString, $opts, $highlight ) { $query = new \Elastica\Query(); diff --git a/ttmserver/Interfaces.php b/ttmserver/Interfaces.php index 64e1906..e7abeaa 100644 --- a/ttmserver/Interfaces.php +++ b/ttmserver/Interfaces.php @@ -18,9 +18,9 @@ /** * Fetches all relevant suggestions for given text. * - * @param $sourceLanguage String: language code for the provide text - * @param $targetLanguage String: language code for the suggestions - * @param $text String: the text for which to search suggestions + * @param string $sourceLanguage language code for the provide text + * @param string $targetLanguage language code for the suggestions + * @param string $text the text for which to search suggestions * @return array List: unordered suggestions, which each has fields: * - source: String: the original text of the suggestion * - target: String: the suggestion @@ -135,18 +135,19 @@ public function search( $queryString, $opts, $highlight ); /** - * ... + * @param stdClass $resultset + * @return array */ public function getFacets( $resultset ); /** - * @param $resultset + * @param stdClass $resultset * @return int */ public function getTotalHits( $resultset ); /** - * @param $resultset + * @param stdClass $resultset * @return array[] */ public function getDocuments( $resultset ); diff --git a/ttmserver/SolrTTMServer.php b/ttmserver/SolrTTMServer.php index db8bfac..31ab58b 100644 --- a/ttmserver/SolrTTMServer.php +++ b/ttmserver/SolrTTMServer.php @@ -349,7 +349,13 @@ } } - // Search interface + /** + * Search interface + * @param string $queryString + * @param array $opts + * @param array $highlight + * @return array + */ public function search( $queryString, $opts, $highlight ) { $client = $this->getSolarium(); diff --git a/ttmserver/TTMServer.php b/ttmserver/TTMServer.php index 8ffa9ba..e116418 100644 --- a/ttmserver/TTMServer.php +++ b/ttmserver/TTMServer.php @@ -124,14 +124,22 @@ return $prevRow[$length2]; } - /// Hook: ArticleDeleteComplete + /** + * Hook: ArticleDeleteComplete + * @param WikiPage $wikipage + */ public static function onDelete( WikiPage $wikipage ) { $handle = new MessageHandle( $wikipage->getTitle() ); $job = TTMServerMessageUpdateJob::newJob( $handle, 'delete' ); JobQueueGroup::singleton()->push( $job ); } - /// Called from TranslateEditAddons::onSave + /** + * Called from TranslateEditAddons::onSave + * @param MessageHandle $handle + * @param string $text + * @param bool $fuzzy + */ public static function onChange( MessageHandle $handle, $text, $fuzzy ) { $job = TTMServerMessageUpdateJob::newJob( $handle, 'refresh' ); JobQueueGroup::singleton()->push( $job ); diff --git a/ttmserver/TTMServerMessageUpdateJob.php b/ttmserver/TTMServerMessageUpdateJob.php index 4e407f1..a24314f 100644 --- a/ttmserver/TTMServerMessageUpdateJob.php +++ b/ttmserver/TTMServerMessageUpdateJob.php @@ -51,6 +51,7 @@ /** * @param MessageHandle $handle + * @param string $command * @return TTMServerMessageUpdateJob */ public static function newJob( MessageHandle $handle, $command ) { @@ -79,6 +80,7 @@ /** * Fetch all the translations and update them. + * @return bool */ public function run() { global $wgTranslateTranslationServices, @@ -116,7 +118,7 @@ } /** - * {@inheritDoc} + * @inheritDoc */ public function allowRetries() { return false; diff --git a/utils/Font.php b/utils/Font.php index 2bc75ba..196b0e1 100644 --- a/utils/Font.php +++ b/utils/Font.php @@ -19,7 +19,7 @@ class FCFontFinder { /** * Searches for suitable font in the system. - * @param $code \string Language code. + * @param \string $code Language code. * @return bool|string Full path to the font file, false on failure */ public static function findFile( $code ) { @@ -33,7 +33,7 @@ /** * Searches for suitable font family in the system. - * @param $code \string Language code. + * @param \string $code Language code. * @return bool|string Name of font family, false on failure */ public static function findFamily( $code ) { diff --git a/utils/HTMLJsSelectToInputField.php b/utils/HTMLJsSelectToInputField.php index 1f53af6..eea6832 100644 --- a/utils/HTMLJsSelectToInputField.php +++ b/utils/HTMLJsSelectToInputField.php @@ -12,7 +12,7 @@ */ class HTMLJsSelectToInputField extends HTMLTextField { /** - * @param $value + * @param string $value * @return string */ function getInputHTML( $value ) { @@ -30,7 +30,7 @@ } /** - * @param $value + * @param string $value * @return array */ protected function tidy( $value ) { @@ -41,9 +41,9 @@ } /** - * @param $value - * @param $alldata - * @return bool|String + * @param string $value + * @param array $alldata + * @return bool|string */ function validate( $value, $alldata ) { $p = parent::validate( $value, $alldata ); @@ -73,8 +73,8 @@ } /** - * @param $value - * @param $alldata + * @param string $value + * @param array $alldata * @return string */ function filter( $value, $alldata ) { diff --git a/utils/JsSelectToInput.php b/utils/JsSelectToInput.php index 4a62aea..ee99a6f 100644 --- a/utils/JsSelectToInput.php +++ b/utils/JsSelectToInput.php @@ -33,7 +33,9 @@ $this->select = $select; } - /// @return string + /** + * @return string + */ public function getSourceId() { return $this->sourceId; } @@ -61,7 +63,9 @@ $this->msg = $message; } - /// @return string Message key. + /** + * @return string Message key. + */ public function getMessage() { return $this->msg; } @@ -102,7 +106,9 @@ return $html; } - /// Inject needed JavaScript in the page. + /** + * Inject needed JavaScript in the page. + */ public static function injectJs() { static $done = false; if ( $done ) { diff --git a/utils/MemProfile.php b/utils/MemProfile.php index 41d8d09..2085998 100644 --- a/utils/MemProfile.php +++ b/utils/MemProfile.php @@ -18,7 +18,7 @@ /** * Call to start memory counting for a block. - * @param $a \string Block name. + * @param \string $a Block name. */ function wfMemIn( $a ) { global $wgLang, $wgMemUse, $wgMemStack; @@ -38,7 +38,7 @@ /** * Call to start stop counting for a block. Difference from start is shown. - * @param $a \string Block name. + * @param \string $a Block name. */ function wfMemOut( $a ) { global $wgLang, $wgMemUse, $wgMemStack; diff --git a/utils/MessageGroupStatesUpdaterJob.php b/utils/MessageGroupStatesUpdaterJob.php index 577475e..e8c2aed 100644 --- a/utils/MessageGroupStatesUpdaterJob.php +++ b/utils/MessageGroupStatesUpdaterJob.php @@ -26,6 +26,8 @@ /** * Hook: TranslateEventTranslationReview * and also on translation changes + * @param MessageHandle $handle + * @return true */ public static function onChange( MessageHandle $handle ) { $job = self::newJob( $handle->getTitle() ); @@ -35,7 +37,7 @@ } /** - * @param $title + * @param Title $title * @return MessageGroupStatesUpdaterJob */ public static function newJob( $title ) { diff --git a/utils/MessageGroupStats.php b/utils/MessageGroupStats.php index 90e8023..61e5741 100644 --- a/utils/MessageGroupStats.php +++ b/utils/MessageGroupStats.php @@ -154,6 +154,7 @@ * Clears the cache for all groups associated with the message. * * Hook: TranslateEventTranslationReview + * @param MessageHandle $handle */ public static function clear( MessageHandle $handle ) { $code = $handle->getCode(); @@ -330,8 +331,8 @@ /** * Fetch rows from the database. Use extractResults to process this value. * - * @param null|string[] List of message group ids - * @param null|string[] List of language codes + * @param null|string[] $ids List of message group ids + * @param null|string[] $codes List of language codes * @return Traversable Database result object */ protected static function selectRowsIdLang( $ids = null, $codes = null ) { diff --git a/utils/MessageHandle.php b/utils/MessageHandle.php index 638525b..3379249 100644 --- a/utils/MessageHandle.php +++ b/utils/MessageHandle.php @@ -222,7 +222,7 @@ /** * Check if a string contains the fuzzy string. * - * @param $text string Arbitrary text + * @param string $text Arbitrary text * @return bool If string contains fuzzy string. */ public static function hasFuzzyString( $text ) { diff --git a/utils/MessageIndex.php b/utils/MessageIndex.php index 7b506ec..2e40718 100644 --- a/utils/MessageIndex.php +++ b/utils/MessageIndex.php @@ -120,7 +120,10 @@ } } - /// @return array + /** + * @param bool $forRebuild + * @return array + */ abstract public function retrieve( $forRebuild = false ); abstract protected function store( array $array, array $diff ); @@ -329,9 +332,13 @@ unset( $id ); // Disconnect the previous references to this $id } - /* These are probably slower than serialize and unserialize, + /** + * These are probably slower than serialize and unserialize, * but they are more space efficient because we only need - * strings and arrays. */ + * strings and arrays. + * @param mixed $data + * @return mixed + */ protected function serialize( $data ) { if ( is_array( $data ) ) { return implode( '|', $data ); diff --git a/utils/MessageWebImporter.php b/utils/MessageWebImporter.php index a74a86f..9717d3b 100644 --- a/utils/MessageWebImporter.php +++ b/utils/MessageWebImporter.php @@ -427,10 +427,10 @@ /** * @throws MWException * @param Title $title - * @param $message - * @param $summary + * @param string $message + * @param string $summary * @param User $user - * @param $editFlags + * @param int $editFlags * @return array */ public static function doImport( $title, $message, $summary, $user = null, $editFlags = 0 ) { @@ -452,9 +452,9 @@ /** * @param Title $title - * @param $message - * @param $comment - * @param $user + * @param string $message + * @param string $comment + * @param User $user * @param int $editFlags * @return array|String */ diff --git a/utils/ResourceLoader.php b/utils/ResourceLoader.php index 9c9e171..459a882 100644 --- a/utils/ResourceLoader.php +++ b/utils/ResourceLoader.php @@ -13,8 +13,8 @@ class PHPVariableLoader { /** * Returns a global variable from PHP file by executing the file. - * @param $_filename \string Path to the file. - * @param $_variable \string Name of the variable. + * @param \string $_filename Path to the file. + * @param \string $_variable Name of the variable. * @return \mixed The variable contents or null. */ public static function loadVariableFromPHPFile( $_filename, $_variable ) { diff --git a/utils/RevTag.php b/utils/RevTag.php index b9d24bf..032f4ac 100644 --- a/utils/RevTag.php +++ b/utils/RevTag.php @@ -22,7 +22,7 @@ /** * Converts rt_type field back to the tag name. - * @param $tag int rt_type value + * @param int $tag rt_type value * @return string */ public static function typeToTag( $tag ) { diff --git a/utils/ToolBox.php b/utils/ToolBox.php index d24bef5..3388a65 100644 --- a/utils/ToolBox.php +++ b/utils/ToolBox.php @@ -18,7 +18,7 @@ * available translations for a message. Only shown when it * actually is a translatable/translated message. * - * @param $quickTemplate QuickTemplate + * @param QuickTemplate &$quickTemplate * * @return bool */ diff --git a/utils/TranslateMetadata.php b/utils/TranslateMetadata.php index 7028a5d..cb0d6f3 100644 --- a/utils/TranslateMetadata.php +++ b/utils/TranslateMetadata.php @@ -15,8 +15,8 @@ /** * Get a metadata value for the given group and key. - * @param $group string The group name - * @param $key string Metadata key + * @param string $group The group name + * @param string $key Metadata key * @return string|bool */ public static function get( $group, $key ) { @@ -38,9 +38,9 @@ /** * Set a metadata value for the given group and metadata key. Updates the * value if already existing. - * @param $group string The group id - * @param $key string Metadata key - * @param $value string Metadata value + * @param string $group The group id + * @param string $key Metadata key + * @param string $value Metadata value */ public static function set( $group, $key, $value ) { $dbw = wfGetDB( DB_MASTER ); diff --git a/utils/TranslateSandbox.php b/utils/TranslateSandbox.php index 7751d10..f67234e 100644 --- a/utils/TranslateSandbox.php +++ b/utils/TranslateSandbox.php @@ -238,7 +238,12 @@ return false; } - /// Hook: UserGetRights + /** + * Hook: UserGetRights + * @param User $user + * @param array &$rights + * @return true + */ public static function enforcePermissions( User $user, array &$rights ) { global $wgTranslateUseSandbox; @@ -283,6 +288,10 @@ /** * Whitelisting for certain API modules. See also enforcePermissions. * Hook: ApiCheckCanExecute + * @param ApiBase $module + * @param User $user + * @param string &$message + * @return bool */ public static function onApiCheckCanExecute( ApiBase $module, User $user, &$message ) { $whitelist = [ diff --git a/utils/TranslateYaml.php b/utils/TranslateYaml.php index 824d0b2..004df05 100644 --- a/utils/TranslateYaml.php +++ b/utils/TranslateYaml.php @@ -15,7 +15,7 @@ */ class TranslateYaml { /** - * @param $text string + * @param string $text * @return array * @throws MWException */ @@ -46,7 +46,7 @@ } /** - * @param $yaml array + * @param array &$yaml * @return array */ public static function fixSyckBooleans( &$yaml ) { @@ -62,7 +62,7 @@ } /** - * @param $yaml array + * @param array &$yaml * @return array */ public static function fixSpycSpaces( &$yaml ) { diff --git a/utils/TranslationEditPage.php b/utils/TranslationEditPage.php index 0ba0e26..bb6a53c 100644 --- a/utils/TranslationEditPage.php +++ b/utils/TranslationEditPage.php @@ -19,7 +19,7 @@ /** * Constructor. - * @param $title Title A title object + * @param Title $title A title object */ public function __construct( Title $title ) { $this->setTitle( $title ); @@ -28,7 +28,7 @@ /** * Constructs a page from WebRequest. * This interface is a big klunky. - * @param $request WebRequest + * @param WebRequest $request * @return TranslationEditPage */ public static function newFromRequest( WebRequest $request ) { @@ -46,7 +46,7 @@ /** * Change the title of the page we are working on. - * @param $title Title + * @param Title $title */ public function setTitle( Title $title ) { $this->title = $title; @@ -224,10 +224,10 @@ * Returns link attributes that enable javascript translation dialog. * Will degrade gracefully if user does not have permissions or JavaScript * is not enabled. - * @param $title Title Title object for the translatable message. - * @param $group \string The group in which this message belongs to. + * @param Title $title Title object for the translatable message. + * @param \string $group The group in which this message belongs to. * Optional, but avoids a lookup later if provided. - * @param $type \string Force the type of editor to be used. Use dialog + * @param \string $type Force the type of editor to be used. Use dialog * where embedded editor is no applicable. * @return \array */ diff --git a/utils/TranslationHelpers.php b/utils/TranslationHelpers.php index 0650b10..441e981 100644 --- a/utils/TranslationHelpers.php +++ b/utils/TranslationHelpers.php @@ -149,6 +149,7 @@ /** * Gets the linguistically correct language code for translation + * @return string */ public function getTargetLanguage() { global $wgLanguageCode, $wgTranslateDocumentationLanguageCode; diff --git a/utils/TranslationStats.php b/utils/TranslationStats.php index ded1fe5..6c5ead0 100644 --- a/utils/TranslationStats.php +++ b/utils/TranslationStats.php @@ -19,11 +19,11 @@ * Returns translated percentage for message group in given * languages * - * @param $group \string Unique key identifying the group - * @param $languages \array List of language codes + * @param \string $group Unique key identifying the group + * @param \array $languages List of language codes * @param bool|int $threshold \int Minimum required percentage translated to * return. Other given language codes will not be returned. - * @param $simple \bool Return only codes or code/pecentage pairs + * @param \bool $simple Return only codes or code/pecentage pairs * * @return \array Array of key value pairs code (string)/percentage * (float) or array of codes, depending on $simple diff --git a/utils/UserToggles.php b/utils/UserToggles.php index 84cd75b..8e6f531 100644 --- a/utils/UserToggles.php +++ b/utils/UserToggles.php @@ -17,6 +17,9 @@ * Add 'translate-pref-nonewsletter' preference. * This is most probably specific to translatewiki.net. Can be enabled * with $wgTranslateNewsletterPreference. + * @param User $user + * @param array &$preferences + * @return bool */ public static function onGetPreferences( User $user, array &$preferences ) { global $wgTranslateNewsletterPreference; diff --git a/webservices/TranslationWebService.php b/webservices/TranslationWebService.php index 4989fd7..0d57419 100644 --- a/webservices/TranslationWebService.php +++ b/webservices/TranslationWebService.php @@ -208,7 +208,8 @@ } /** - * @see doPairs + * @see self::doPairs + * @return array * @throws TranslationWebServiceConfigurationException */ protected function getSupportedLanguagePairs() { -- To view, visit https://gerrit.wikimedia.org/r/384290 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie653d3b538daacbb50d354c6865faa1f78b1bf55 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Translate Gerrit-Branch: master Gerrit-Owner: Umherirrender <umherirrender_de...@web.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits