jenkins-bot has submitted this change and it was merged.

Change subject: Fix Status::getMessage for the multiple errors, $shortContext 
only case
......................................................................


Fix Status::getMessage for the multiple errors, $shortContext only case

Remove $msgCount++ which does not seem to have any non-harmful purpose.

Also try to explain what the hell the method does.

Change-Id: Ibdf40ff13a4a9d294a6bc6f778a14fb2633c2f70
(cherry picked from commit 4d294bceab9669ee7169248e92fe747a3b5fce7c)
---
M includes/Status.php
1 file changed, 15 insertions(+), 9 deletions(-)

Approvals:
  Gergő Tisza: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Status.php b/includes/Status.php
index f8370e4..6e20577 100644
--- a/includes/Status.php
+++ b/includes/Status.php
@@ -250,12 +250,22 @@
        }
 
        /**
-        * Get the error list as a Message object
+        * Get a bullet list of the errors as a Message object.
         *
-        * @param string|string[] $shortContext A short enclosing context 
message name (or an array of
-        * message names), to be used when there is a single error.
-        * @param string|string[] $longContext A long enclosing context message 
name (or an array of
-        * message names), for a list.
+        * $shortContext and $longContext can be used to wrap the error list in 
some text.
+        * $shortContext will be preferred when there is a single error; 
$longContext will be
+        * preferred when there are multiple ones. In either case, $1 will be 
replaced with
+        * the list of errors.
+        *
+        * $shortContext is assumed to use $1 as an inline parameter: if there 
is a single item,
+        * it will not be made into a list; if there are multiple items, 
newlines will be inserted
+        * around the list.
+        * $longContext is assumed to use $1 as a standalone parameter; it will 
always receive a list.
+        *
+        * If both parameters are missing, and there is only one error, no 
bullet will be added.
+        *
+        * @param string|string[] $shortContext A message name or an array of 
message names.
+        * @param string|string[] $longContext A message name or an array of 
message names.
         * @param string|Language $lang Language to use for processing messages
         * @return Message
         */
@@ -285,10 +295,6 @@
                } else {
                        $msgs = $this->getErrorMessageArray( $rawErrors, $lang 
);
                        $msgCount = count( $msgs );
-
-                       if ( $shortContext ) {
-                               $msgCount++;
-                       }
 
                        $s = new RawMessage( '* $' . implode( "\n* \$", range( 
1, $msgCount ) ) );
                        $s->params( $msgs )->parse();

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibdf40ff13a4a9d294a6bc6f778a14fb2633c2f70
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_27
Gerrit-Owner: Gergő Tisza <gti...@wikimedia.org>
Gerrit-Reviewer: Gergő Tisza <gti...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to