Re-enable Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
authorReedy <reedy@wikimedia.org>
Sat, 26 Sep 2015 16:45:29 +0000 (17:45 +0100)
committerReedy <reedy@wikimedia.org>
Sat, 26 Sep 2015 16:45:29 +0000 (17:45 +0100)
Change-Id: I07b4043163e5d00709f72dbbb3e2a46b17414d1c

includes/api/ApiBase.php
phpcs.xml

index d53797b..7743384 100644 (file)
@@ -206,7 +206,8 @@ abstract class ApiBase extends ContextSource {
                                // Fix up the ugly "even numbered elements are description, odd
                                // numbered elemts are the link" format (see doc for self::getExamples)
                                $tmp = array();
-                               for ( $i = 0; $i < count( $examples ); $i += 2 ) {
+                               $examplesCount = count( $examples );
+                               for ( $i = 0; $i < $examplesCount; $i += 2 ) {
                                        $tmp[$examples[$i + 1]] = $examples[$i];
                                }
                                $examples = $tmp;
index d1453e3..df0f1fb 100644 (file)
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -7,7 +7,6 @@
                <exclude name="MediaWiki.NamingConventions.PrefixedGlobalFunctions.wfPrefix"/>
                <exclude name="MediaWiki.WhiteSpace.SpaceyParenthesis.SingleSpaceBeforeCloseParenthesis"/>
                <exclude name="Squiz.Classes.ValidClassName.NotCamelCaps"/>
-               <exclude name="Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed"/>
                <exclude name="MediaWiki.WhiteSpace.SpaceAfterControlStructure.Incorrect"/>
                <exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed"/>
                <exclude name="Squiz.WhiteSpace.SemicolonSpacing.Incorrect"/>