Jarry1250 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/156059

Change subject: Documentation updates (move to newer format)
......................................................................

Documentation updates (move to newer format)

Change-Id: Ic21317e903526015d98f8884d9e59936535c1b73
---
M SVGFormatWriter.php
M SVGMessageGroup.php
M TranslateSvgHooks.php
M tests/phpunit/TranslateSvgTestCase.php
4 files changed, 88 insertions(+), 77 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TranslateSvg 
refs/changes/59/156059/1

diff --git a/SVGFormatWriter.php b/SVGFormatWriter.php
index d77bb5d..795c139 100644
--- a/SVGFormatWriter.php
+++ b/SVGFormatWriter.php
@@ -13,6 +13,9 @@
  */
 class SVGFormatWriter {
 
+       /**
+        * @var SVGMessageGroup
+        */
        protected $group;
        protected $url;
 
@@ -26,8 +29,8 @@
        /**
         * Constructor
         *
-        * @param $group \SVGMessageGroup Message group to write to file
-        * @param $overrides \array Possible array of overriddes (unsaved 
translations that should take preference over saved ones), format: 
[id][langcode][property name]
+        * @param SVGMessageGroup $group Message group to write to file
+        * @param array $inProgressTranslations Possible array of overriddes 
(unsaved translations that should take preference over saved ones), format: 
[id][langcode][property name]
         */
        public function __construct( SVGMessageGroup $group, $overrides = 
array() ) {
                $this->group = $group;
@@ -38,12 +41,12 @@
 
        /**
         * Returns a thumbnail of an SVG translated into the language provided.
-        * The thumbnail will include all translations, including overrides and
+        * The thumbnail will include all translations, including in progress 
and
         * onwiki translations, rather than just those uploaded.
         *
-        * @param $language \string|\bool Code of the language to translate into
-        * @param $size \int The length (in px) of one side of a bounding box 
square: aspect ratio will always be preserved. Default 275.
-        * @return \array Array with keys 'success'=>true|false and 
'message'=>/web/friendly/path/to/the/new/thumbnail.png|error output
+        * @param string|bool $language Code of the language to translate into
+        * @param int $size The length (in px) of one side of a bounding box 
square: aspect ratio will always be preserved. Default 275.
+        * @return array Array with keys 'success'=>true|false and 
'message'=>/web/friendly/path/to/the/new/thumbnail.png|error output
         */
        public function thumbnailExport( $language, $size = 275 ) {
                global $wgTranslateSvgDirectory, $wgTranslateSvgPath,
@@ -129,8 +132,8 @@
        /*
         * Handles the actual upload process for a given SVG in DOMDocument form
         *
-        * @param $svg \DOMDocument The object representing the SVG to be 
uploaded
-        * @return \mixed{\bool,\string} True on success, error message on 
failure
+        * @param User $user The user to use for the upload
+        * @return bool|string True on success, error message on failure
         */
        public function exportToSVG( User $user ) {
                global $wgTranslateSvgBotName, $wgContLang, $wgOut;
@@ -197,8 +200,8 @@
         * Provides output to the user for a result of UploadBase::verifyUpload
         * Copied from SpecialUpload (c) Authors
         *
-        * @param $details \array Result of UploadBase::verifyUpload
-        * @return \Message
+        * @param array $details Result of UploadBase::verifyUpload
+        * @return Message
         */
        protected function processVerificationError( $details ) {
                switch ( $details['status'] ) {
diff --git a/SVGMessageGroup.php b/SVGMessageGroup.php
index 430c05e..dda0561 100644
--- a/SVGMessageGroup.php
+++ b/SVGMessageGroup.php
@@ -20,7 +20,7 @@
        /**
         * Constructor.
         *
-        * @param $filename \string Name of the file to be translated (no 
namespace)
+        * @param string $filename Name of the file to be translated (no 
namespace)
         * @throws MWException if file not found
         */
        public function __construct( $filename ) {
@@ -102,9 +102,9 @@
        /**
         * Returns the $code-language translation of a message specified by $key
         *
-        * @param $key \string Key of the message.
-        * @param $code \string Language code.
-        * @return \types{\string,\null} The translation or null if it doesn't 
exists.
+        * @param string $key Key of the message.
+        * @param string $code Language code.
+        * @return string|null The translation or null if it doesn't exists.
         */
        public function getMessage( $key, $code ) {
                $title = Title::makeTitleSafe( $this->getNamespace(), 
"$key/$code" );
@@ -121,9 +121,9 @@
        /**
         * Returns the associated properties of the message specified by $key
         *
-        * @param $key \string Key of the message.
-        * @param $code \string Language code.
-        * @return \types{\string,\null} The translation or null if it doesn't 
exists.
+        * @param string $key Key of the message.
+        * @param string $code Language code.
+        * @return string|null The translation or null if it doesn't exists.
         */
        public function getProperties( $key, $code ) {
                $title = Title::makeTitleSafe( $this->getNamespace(), 
"$key/$code" );
@@ -136,10 +136,10 @@
                return $properties;
        }
 
-       /*
+       /**
         * Import translations from the file, onto the wiki
         *
-        * return \bool True on success, false on failure
+        * @return bool True on success, false on failure
         */
        public function importTranslations() {
                global $wgTranslateSvgBotName;
@@ -185,7 +185,7 @@
         * the TranslateMetadata framework, or 'en' (English) if none set.
         * Overrides parent method
         *
-        * @return \string Language code
+        * @return string Language code
         */
        public function getSourceLanguage() {
                if ( !isset( $this->sourceLanguage ) ) {
@@ -199,8 +199,8 @@
         * Sets the source language code of this message group by using
         * the TranslateMetadata framework.
         *
-        * @param \string $srcLang The source language code
-        * @return \null
+        * @param string $srcLang The source language code
+        * @return null
         */
        public function setSourceLanguage( $srcLang ) {
                $this->sourceLanguage = $srcLang;
diff --git a/TranslateSvgHooks.php b/TranslateSvgHooks.php
index 92bae4b..e585a1b 100644
--- a/TranslateSvgHooks.php
+++ b/TranslateSvgHooks.php
@@ -15,10 +15,10 @@
        /**
         * Function used to add a translation helper box via the 
TranslateGetBoxes hook
         *
-        * @param $group \MessageGroup The MessageGroup of the page being 
translated
-        * @param $handle \MessageHandle The MessageHandle of the page being 
translated
-        * @param $boxes \array The array to which the thumbnail helper is added
-        * @return \bool True
+        * @param MessageGroup $group The MessageGroup of the page being 
translated
+        * @param MessageHandle $handle The MessageHandle of the page being 
translated
+        * @param array $boxes The array to which the thumbnail helper is added
+        * @return bool True
         */
        public static function addThumbnail( MessageGroup $group, MessageHandle 
$handle, &$boxes ) {
                global $wgLang;
@@ -42,10 +42,10 @@
         * Function used to remove the QQQ (documentation) translation helper 
box via
         * the TranslateGetBoxes hook
         *
-        * @param $group \MessageGroup The message group to which the message 
being translated belongs
-        * @param $handle \MessageHandle The MessageHandle of the message being 
translated
-        * @param $boxes \array The array from which the thumbnail helper is 
removed
-        * @return \bool True
+        * @param MessageGroup $group The message group to which the message 
being translated belongs
+        * @param MessageHandle $handle The MessageHandle of the message being 
translated
+        * @param array $boxes The array from which the thumbnail helper is 
removed
+        * @return bool True
         */
        public static function removeQQQ( MessageGroup $group, MessageHandle 
$handle, &$boxes ) {
                if ( !( $group instanceof SVGMessageGroup ) ) {
@@ -61,10 +61,10 @@
         * the TranslateGetBoxes hook
         *
         * @todo Replace this with a better helper rather than no helper
-        * @param $group \MessageGroup The message group to which the message 
being translated belongs
-        * @param $handle \MessageHandle The MessageHandle of the message being 
translated
-        * @param $boxes \array The array from which the thumbnail helper is 
removed
-        * @return \bool True
+        * @param MessageGroup $group The message group to which the message 
being translated belongs
+        * @param MessageHandle $handle The MessageHandle of the message being 
translated
+        * @param array $boxes The array from which the thumbnail helper is 
removed
+        * @return bool True
         */
        public static function removeSuggestions( MessageGroup $group, 
MessageHandle $handle, &$boxes ) {
                if ( !( $group instanceof SVGMessageGroup ) ) {
@@ -79,8 +79,8 @@
         * Function used to add modules to the ResourceLoader via the
         * TranslateBeforeAddModules hook
         *
-        * @param $modules \array The current array of modules
-        * @return \bool True
+        * @param array $modules The current array of modules
+        * @return bool True
         */
        public static function addModules( &$modules ) {
                $modules[] = 'ext.translatesvg';
@@ -90,9 +90,9 @@
        /**
         * Function used to preload properties via the 
TranslatePrefillTranslation hook
         *
-        * @param $properties \string To be filled with the preloaded property 
string
-        * @param $handle \MessageHandle $handle
-        * @return \bool True
+        * @param string $properties To be filled with the preloaded property 
string
+        * @param MessageHandle $handle $handle
+        * @return bool True
         */
        public static function getDefaultPropertiesFromGroup( &$properties, 
MessageHandle $handle ) {
                if ( !$handle->isValid() ) {
@@ -116,9 +116,9 @@
         * a series of HTML form elements (extraInputs). Used for the
         * TranslateGetExtraInputs hook.
         *
-        * @param $message \string Input/output translation string, passed by 
reference
-        * @param $extraInputs \string Extra form elements required
-        * @return \bool True
+        * @param string $message Input/output translation string, passed by 
reference
+        * @param string $extraInputs Extra form elements required
+        * @return bool True
         */
        public static function propertiesToExtraInputs( &$message, 
&$extraInputs ) {
                global $wgTranslateSvgTypefaces, $wgTranslateSvgColors;
@@ -208,12 +208,12 @@
         * Function that replaces a message with a no-property-string version.
         * Used for the TranslateFormatMessageBeforeTable hook
         *
-        * @param &$message \string Message which may or may not include a 
property string
-        * @param $m \ThinMessage The source message object
-        * @param $group \MessageGroup The source message group
-        * @param $targetLang \string The language for which translations are 
being shown
-        * @param &$attrs \array The set of attributes to apply to the row (not 
used)
-        * @return \bool True
+        * @param string &$message Message which may or may not include a 
property string
+        * @param ThinMessage $m The source message object
+        * @param MessageGroup $group The source message group
+        * @param string $targetLang The language for which translations are 
being shown
+        * @param array &$attrs The set of attributes to apply to the row (not 
used)
+        * @return bool True
         */
        public static function stripPropertyString( &$message, ThinMessage $m, 
MessageGroup $group, $targetLang, &$attrs ) {
                // TODO: mark as .justtranslated if not yet exported
@@ -229,9 +229,9 @@
         * Function used to expose the $wgTranslateSvgTemplateName global to
         * JavaScript via the MakeGlobalVariablesScript MediaWiki hook
         *
-        * @param &$vars \array of variables to be exposed to JavaScript
-        * @param $out \OutputPage Contextual OutputPage instance
-        * @return \bool True
+        * @param array &$vars of variables to be exposed to JavaScript
+        * @param OutputPage $out Contextual OutputPage instance
+        * @return bool True
         */
        public static function exposeTranslateSvgTemplateName( &$vars, 
OutputPage $out ) {
                global $wgTranslateSvgTemplateName;
@@ -245,9 +245,9 @@
         * Function used to make "export as SVG" the default export option for 
SVG files
         * Used with the TranslateGetSpecialTranslateOptions hook
         *
-        * @param $defaults \array Associative array of so-called "default" 
values supplied by Translate
-        * @param $nondefaults \array Associative array of so-called 
"non-default" values supplied by Translate
-        * @return \bool True
+        * @param array $defaults Associative array of so-called "default" 
values supplied by Translate
+        * @param array $nondefaults Associative array of so-called 
"non-default" values supplied by Translate
+        * @return bool True
         */
        public static function makeExportAsSvgOptionDefault( &$defaults, 
&$nondefaults ) {
                if ( isset( $nondefaults['group'] )
@@ -265,8 +265,8 @@
         * action=query&meta=messagegroups API queries.
         * Used with the TranslateGetAPIMessageGroupsPropertyDescs hook
         *
-        * @param \array $properties An associative array of properties (name 
=> details)
-        * @return \bool True
+        * @param array $properties An associative array of properties (name => 
details)
+        * @return bool True
         */
        public static function addAPIProperties( &$properties ) {
                $properties['thumbnail'] = ' thumbnail    - Include URL of 
up-to-date thumbnail (SVG message groups only)';
@@ -278,7 +278,7 @@
         * MediaWiki's 'LoadExtensionSchemaUpdates' hook.
         *
         * @param $updater DatabaseUpdater The MediaWiki-provided updater 
instance
-        * @return \bool True
+        * @return bool True
         */
        public static function schemaUpdates( $updater ) {
                $dir = __DIR__ . '/sql';
@@ -292,7 +292,7 @@
         * the file pages of SVG files via the BeforePageDisplay MediaWiki hook
         *
         * @param $out Contextual OutputPage instance
-        * @return \bool
+        * @return bool
         */
        public static function updateFileDescriptionPages( OutputPage $out ) {
                $title = $out->getTitle();
@@ -307,11 +307,11 @@
         * action=query&meta=messagegroups API queries.
         * Used with the TranslateProcessAPIMessageGroupsProperties hook
         *
-        * @param $a \array Associative array of the properties of $group that 
will be returned
-        * @param $props \array Associative array ($name => true) of properties 
the user has specifically requested
-        * @param $params \array Parameter input by the user (unprefixed name 
=> value)
-        * @param $g \MessageGroup The group in question
-        * @return \bool True
+        * @param array $a Associative array of the properties of $group that 
will be returned
+        * @param array $props Associative array ($name => true) of properties 
the user has specifically requested
+        * @param array $params Parameter input by the user (unprefixed name => 
value)
+        * @param MessageGroup $g The group in question
+        * @return bool True
         */
        public static function processAPIProperties( &$a, $props, $params, 
MessageGroup $g ) {
                if ( !( $g instanceof SVGMessageGroup ) ) {
@@ -338,8 +338,8 @@
         * action=query&meta=messagegroups API queries.
         * Used with the TranslateGetAPIMessageGroupsParameterList hook
         *
-        * @param $params \array An associative array of possible parameters 
(name => details)
-        * @return \bool True
+        * @param array $params An associative array of possible parameters 
(name => details)
+        * @return bool True
         */
        public static function addAPIParams( &$params ) {
                $params['overrides'] = array(
@@ -355,9 +355,9 @@
         * Document the mgoverrides and mglanguage parameters
         * Used with the TranslateGetAPIMessageGroupsParameterDescs hook
         *
-        * @param $paramDescs \array An associative array of parameters, name 
=> description.
-        * @param $p \string The prefix for action=query&meta=messagegroups 
(unused)
-        * @return \bool True
+        * @param array $paramDescs An associative array of parameters, name => 
description.
+        * @param string $p The prefix for action=query&meta=messagegroups 
(unused)
+        * @return bool True
         */
        public static function addAPIParamDescs( &$paramDescs, $p ) {
                $paramDescs['overrides'] =
@@ -372,10 +372,10 @@
         * Function used to load groups registered by TranslateSvg into the
         * lists generated by Translate. Uses the 'TranslatePostInitGroups' 
hook.
         *
-        * @param &$list \array Array of groups to append to.
-        * @param &$deps \array Not used at present.
-        * @param &$autoload \array Not used at present.
-        * @return \bool True
+        * @param array &$list Array of groups to append to.
+        * @param array &$deps Not used at present.
+        * @param array &$autoload Not used at present.
+        * @return bool True
         */
        public static function loadSVGGroups( &$list, &$deps, &$autoload ) {
                $dbr = wfGetDB( DB_MASTER );
@@ -398,9 +398,9 @@
         * JavaScript of the file description pages of SVG files
         * via the MakeGlobalVariablesScript MediaWiki hook.
         *
-        * @param &$vars \array Array of variables to be exposed to JavaScript
-        * @param $out \OutputPage Contextual OutputPage instance
-        * @return \bool True
+        * @param array &$vars Array of variables to be exposed to JavaScript
+        * @param OutputPage $out Contextual OutputPage instance
+        * @return bool True
         */
        public static function makeFilePageGlobalVariables( &$vars, OutputPage 
$out ) {
                $title = $out->getTitle();
@@ -454,8 +454,8 @@
        /**
         * Register our unit tests so Jenkins can run them
         *
-        * @param &$files \array Array of tests (test files) to be run
-        * @return \bool True
+        * @param array &$files Array of tests (test files) to be run
+        * @return bool True
         */
        public static function onUnitTestsList( &$files ) {
                $files = array_merge( $files, glob( __DIR__ . 
'/tests/phpunit/*Test.php' ) );
diff --git a/tests/phpunit/TranslateSvgTestCase.php 
b/tests/phpunit/TranslateSvgTestCase.php
index 005efca..4bf23f5 100644
--- a/tests/phpunit/TranslateSvgTestCase.php
+++ b/tests/phpunit/TranslateSvgTestCase.php
@@ -1,4 +1,12 @@
 <?php
+/**
+ * Unit test case to enable code sharing between unit test
+ *
+ * @file
+ * @author Harry Burt
+ * @copyright Copyright © 2014, Harry Burt
+ * @license GPL-2.0+
+ */
 
 class TranslateSvgUpload extends UploadBase {
        public function initializeFromRequest( &$request ) { }

-- 
To view, visit https://gerrit.wikimedia.org/r/156059
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic21317e903526015d98f8884d9e59936535c1b73
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TranslateSvg
Gerrit-Branch: master
Gerrit-Owner: Jarry1250 <jarry1...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to