Fix phpcs issues from LanguageConverter patches
authorReedy <reedy@wikimedia.org>
Wed, 15 Nov 2017 03:37:27 +0000 (03:37 +0000)
committerReedy <reedy@wikimedia.org>
Wed, 15 Nov 2017 03:37:27 +0000 (03:37 +0000)
Change-Id: I34e57c90ffd40fbd9f8afe3c57dd73fa7f655841

languages/LanguageConverter.php
tests/phpunit/languages/LanguageConverterTest.php

index f9610fa..8e98abd 100644 (file)
@@ -412,11 +412,11 @@ class LanguageConverter {
                                $log = LoggerFactory::getInstance( 'languageconverter' );
                                $log->error( "Hit pcre.backtrack_limit in " . __METHOD__
                                        . ". Disabling language conversion for this page.",
-                                       array(
+                                       [
                                                "method" => __METHOD__,
                                                "variant" => $toVariant,
                                                "startOfText" => substr( $text, 0, 500 )
-                                       )
+                                       ]
                                );
                                return $text;
                        }
@@ -665,7 +665,9 @@ class LanguageConverter {
 
                $noScript = '<script.*?>.*?<\/script>(*SKIP)(*FAIL)';
                $noStyle = '<style.*?>.*?<\/style>(*SKIP)(*FAIL)';
+               // @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong
                $noHtml = '<(?:[^>=]*+(?>[^>=]*+=\s*+(?:"[^"]*"|\'[^\']*\'|[^\'">\s]*+))*+[^>=]*+>|.*+)(*SKIP)(*FAIL)';
+               // @codingStandardsIgnoreEnd
                while ( $startPos < $length && $continue ) {
                        $continue = preg_match(
                                // Only match -{ outside of html.
index 331368e..fc2ed33 100644 (file)
@@ -167,7 +167,7 @@ class LanguageConverterTest extends MediaWikiLangTestCase {
                        $testString .= 'xxx xxx xxx';
                }
                $testString .= "\n<big id='в'></big>";
-               $old = ini_set('pcre.backtrack_limit', 200 );
+               $old = ini_set( 'pcre.backtrack_limit', 200 );
                $result = $this->lc->autoConvert( $testString, 'tg-latn' );
                ini_set( 'pcre.backtrack_limit', $old );
                // The в in the id attribute should not get converted to a v