Fix Generic.Files.LineLength phpcs failure in 11 files under includes/
authorAmir E. Aharoni <amir.aharoni@mail.huji.ac.il>
Sat, 3 Oct 2015 12:52:08 +0000 (15:52 +0300)
committerUmherirrender <umherirrender_de.wp@web.de>
Sat, 3 Oct 2015 17:08:26 +0000 (17:08 +0000)
Bug: T102614
Change-Id: I0d759be6ef568c2c6f28606d3002484ad77a1830

includes/HttpFunctions.php
includes/MWTimestamp.php
includes/PHPVersionCheck.php
includes/Revision.php
includes/api/ApiBlock.php
includes/api/ApiQueryAllMessages.php
includes/parser/Parser.php
includes/poolcounter/PoolCounterRedis.php
includes/specials/SpecialAllMessages.php
includes/specials/SpecialMergeHistory.php
includes/upload/UploadBase.php

index 578b535..bbf3de6 100644 (file)
@@ -250,7 +250,9 @@ class MWHttpRequest {
         * @param string $caller The method making this request, for profiling
         * @param Profiler $profiler An instance of the profiler for profiling, or null
         */
-       protected function __construct( $url, $options = array(), $caller = __METHOD__, $profiler = null ) {
+       protected function __construct(
+               $url, $options = array(), $caller = __METHOD__, $profiler = null
+       ) {
                global $wgHTTPTimeout, $wgHTTPConnectTimeout;
 
                $this->url = wfExpandUrl( $url, PROTO_HTTP );
@@ -870,8 +872,10 @@ class PhpHttpRequest extends MWHttpRequest {
        }
 
        /**
-        * Returns an array with a 'capath' or 'cafile' key that is suitable to be merged into the 'ssl' sub-array of a
-        * stream context options array. Uses the 'caInfo' option of the class if it is provided, otherwise uses the system
+        * Returns an array with a 'capath' or 'cafile' key
+        * that is suitable to be merged into the 'ssl' sub-array of
+        * a stream context options array.
+        * Uses the 'caInfo' option of the class if it is provided, otherwise uses the system
         * default CA bundle if PHP supports that, or searches a few standard locations.
         * @return array
         * @throws DomainException
@@ -882,10 +886,13 @@ class PhpHttpRequest extends MWHttpRequest {
                if ( $this->caInfo ) {
                        $certLocations = array( 'manual' => $this->caInfo );
                } elseif ( version_compare( PHP_VERSION, '5.6.0', '<' ) ) {
+                       // @codingStandardsIgnoreStart Generic.Files.LineLength
                        // Default locations, based on
                        // https://www.happyassassin.net/2015/01/12/a-note-about-ssltls-trusted-certificate-stores-and-platforms/
-                       // PHP 5.5 and older doesn't have any defaults, so we try to guess ourselves. PHP 5.6+ gets the CA location
-                       // from OpenSSL as long as it is not set manually, so we should leave capath/cafile empty there.
+                       // PHP 5.5 and older doesn't have any defaults, so we try to guess ourselves.
+                       // PHP 5.6+ gets the CA location from OpenSSL as long as it is not set manually,
+                       // so we should leave capath/cafile empty there.
+                       // @codingStandardsIgnoreEnd
                        $certLocations = array_filter( array(
                                getenv( 'SSL_CERT_DIR' ),
                                getenv( 'SSL_CERT_PATH' ),
@@ -914,8 +921,10 @@ class PhpHttpRequest extends MWHttpRequest {
        }
 
        /**
-        * Custom error handler for dealing with fopen() errors. fopen() tends to fire multiple errors in succession, and the last one
-        * is completely useless (something like "fopen: failed to open stream") so normal methods of handling errors programmatically
+        * Custom error handler for dealing with fopen() errors.
+        * fopen() tends to fire multiple errors in succession, and the last one
+        * is completely useless (something like "fopen: failed to open stream")
+        * so normal methods of handling errors programmatically
         * like get_last_error() don't work.
         */
        public function errorHandler( $errno, $errstr ) {
index 102be80..639403d 100644 (file)
@@ -203,11 +203,15 @@ class MWTimestamp {
         * @deprecated since 1.26 Use Language::getHumanTimestamp directly
         *
         * @param MWTimestamp|null $relativeTo The base timestamp to compare to (defaults to now)
-        * @param User|null $user User the timestamp is being generated for (or null to use main context's user)
-        * @param Language|null $lang Language to use to make the human timestamp (or null to use main context's language)
+        * @param User|null $user User the timestamp is being generated for
+        *  (or null to use main context's user)
+        * @param Language|null $lang Language to use to make the human timestamp
+        *  (or null to use main context's language)
         * @return string Formatted timestamp
         */
-       public function getHumanTimestamp( MWTimestamp $relativeTo = null, User $user = null, Language $lang = null ) {
+       public function getHumanTimestamp(
+               MWTimestamp $relativeTo = null, User $user = null, Language $lang = null
+       ) {
                if ( $lang === null ) {
                        $lang = RequestContext::getMain()->getLanguage();
                }
index 4b2ff8c..f7e14a1 100644 (file)
@@ -189,10 +189,10 @@ function wfMissingVendorError( $type, $mwVersion ) {
                . "for help on installing the required components.";
 
        $longHtml = <<<HTML
-                       MediaWiki now also has some external dependencies that need to be installed via
-                       composer or from a separate git repo. Please see
-                       <a href="https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries">mediawiki.org</a>
-                       for help on installing the required components.
+               MediaWiki now also has some external dependencies that need to be installed via
+               composer or from a separate git repo. Please see
+               <a href="https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries">mediawiki.org</a>
+               for help on installing the required components.
 HTML;
 
        wfGenericError( $type, $mwVersion, 'External dependencies', $shortText, $longText, $longHtml );
index 90d6265..a7a87e8 100644 (file)
@@ -1466,7 +1466,8 @@ class Revision implements IDBAccessObject {
        protected function checkContentModel() {
                global $wgContentHandlerUseDB;
 
-               $title = $this->getTitle(); // note: may return null for revisions that have not yet been inserted.
+               // Note: may return null for revisions that have not yet been inserted
+               $title = $this->getTitle();
 
                $model = $this->getContentModel();
                $format = $this->getContentFormat();
index 6adfc1a..636baa7 100644 (file)
@@ -162,12 +162,14 @@ class ApiBlock extends ApiBase {
        }
 
        protected function getExamplesMessages() {
+               // @codingStandardsIgnoreStart Generic.Files.LineLength
                return array(
                        'action=block&user=192.0.2.5&expiry=3%20days&reason=First%20strike&token=123ABC'
                                => 'apihelp-block-example-ip-simple',
                        'action=block&user=Vandal&expiry=never&reason=Vandalism&nocreate=&autoblock=&noemail=&token=123ABC'
                                => 'apihelp-block-example-user-complex',
                );
+               // @codingStandardsIgnoreEnd
        }
 
        public function getHelpUrls() {
index 152711f..d8a71ca 100644 (file)
@@ -116,7 +116,13 @@ class ApiQueryAllMessages extends ApiQueryBase {
                        $lang = $langObj->getCode();
 
                        $customisedMessages = AllMessagesTablePager::getCustomisedStatuses(
-                               array_map( array( $langObj, 'ucfirst' ), $messages_target ), $lang, $lang != $wgContLang->getCode() );
+                               array_map(
+                                       array( $langObj, 'ucfirst' ),
+                                       $messages_target
+                               ),
+                               $lang,
+                               $lang != $wgContLang->getCode()
+                       );
 
                        $customised = $params['customised'] === 'modified';
                }
index bbee9d4..efad151 100644 (file)
@@ -91,8 +91,10 @@ class Parser {
        # at least one character of a host name (embeds EXT_LINK_URL_CLASS)
        const EXT_LINK_ADDR = '(?:[0-9.]+|\\[(?i:[0-9a-f:.]+)\\]|[^][<>"\\x00-\\x20\\x7F\p{Zs}])';
        # RegExp to make image URLs (embeds IPv6 part of EXT_LINK_ADDR)
+       // @codingStandardsIgnoreStart Generic.Files.LineLength
        const EXT_IMAGE_REGEX = '/^(http:\/\/|https:\/\/)((?:\\[(?i:[0-9a-f:.]+)\\])?[^][<>"\\x00-\\x20\\x7F\p{Zs}]+)
                \\/([A-Za-z0-9_.,~%\\-+&;#*?!=()@\\x80-\\xFF]+)\\.((?i)gif|png|jpg|jpeg)$/Sxu';
+       // @codingStandardsIgnoreEnd
 
        # Regular expression for a non-newline space
        const SPACE_NOT_NL = '(?:\t|&nbsp;|&\#0*160;|&\#[Xx]0*[Aa]0;|\p{Zs})';
index d7357cf..6dd0b35 100644 (file)
@@ -149,6 +149,7 @@ class PoolCounterRedis extends PoolCounter {
                }
                $conn = $status->value;
 
+               // @codingStandardsIgnoreStart Generic.Files.LineLength
                static $script =
 <<<LUA
                local kSlots,kSlotsNextRelease,kWakeup,kWaiting = unpack(KEYS)
@@ -186,6 +187,8 @@ class PoolCounterRedis extends PoolCounter {
                end
                return 1
 LUA;
+               // @codingStandardsIgnoreEnd
+
                try {
                        $conn->luaEval( $script,
                                array(
index 762658c..ed1c903 100644 (file)
@@ -445,7 +445,11 @@ class AllMessagesTablePager extends TablePager {
                } elseif ( $field === 'am_title' ) {
                        return array( 'class' => $field );
                } else {
-                       return array( 'lang' => wfBCP47( $this->langcode ), 'dir' => $this->lang->getDir(), 'class' => $field );
+                       return array(
+                               'lang' => wfBCP47( $this->langcode ),
+                               'dir' => $this->lang->getDir(),
+                               'class' => $field
+                       );
                }
        }
 
index 7b75480..ef1fd73 100644 (file)
@@ -476,7 +476,12 @@ class SpecialMergeHistory extends SpecialPage {
                $logId = $logEntry->insert();
                $logEntry->publish( $logId );
 
-               $targetLink = Linker::link( $targetTitle, $targetTitle->getPrefixedText(), array(), array( 'redirect' => 'no' ) );
+               $targetLink = Linker::link(
+                       $targetTitle,
+                       $targetTitle->getPrefixedText(),
+                       array(),
+                       array( 'redirect' => 'no' )
+               );
 
                $this->getOutput()->addWikiMsg( $this->msg( 'mergehistory-done' )
                        ->rawParams( $targetLink )
index 508f62e..5193a7f 100644 (file)
@@ -1399,7 +1399,10 @@ abstract class UploadBase {
                        # image/svg, text/xml, application/xml, and text/html, which can contain scripts
                        if ( $stripped == 'href' && strncasecmp( 'data:', $value, 5 ) === 0 ) {
                                // rfc2397 parameters. This is only slightly slower than (;[\w;]+)*.
+                               // @codingStandardsIgnoreStart Generic.Files.LineLength
                                $parameters = '(?>;[a-zA-Z0-9\!#$&\'*+.^_`{|}~-]+=(?>[a-zA-Z0-9\!#$&\'*+.^_`{|}~-]+|"(?>[\0-\x0c\x0e-\x21\x23-\x5b\x5d-\x7f]+|\\\\[\0-\x7f])*"))*(?:;base64)?';
+                               // @codingStandardsIgnoreEnd
+
                                if ( !preg_match( "!^data:\s*image/(gif|jpeg|jpg|png)$parameters,!i", $value ) ) {
                                        wfDebug( __METHOD__ . ": Found href to unwhitelisted data: uri "
                                                . "\"<$strippedElement '$attrib'='$value'...\" in uploaded file.\n" );