Amire80 has uploaded a new change for review.
https://gerrit.wikimedia.org/r/243385
Change subject: Fix Generic.Files.LineLength phpcs failure in 11 files under
includes/
......................................................................
Fix Generic.Files.LineLength phpcs failure in 11 files under includes/
Bug: T102614
Change-Id: I0d759be6ef568c2c6f28606d3002484ad77a1830
---
M includes/HttpFunctions.php
M includes/MWTimestamp.php
M includes/PHPVersionCheck.php
M includes/Revision.php
M includes/api/ApiBlock.php
M includes/api/ApiQueryAllMessages.php
M includes/parser/Parser.php
M includes/poolcounter/PoolCounterRedis.php
M includes/specials/SpecialAllMessages.php
M includes/specials/SpecialMergeHistory.php
M includes/upload/UploadBase.php
11 files changed, 57 insertions(+), 18 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/85/243385/1
diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php
index 578b535..bbf3de6 100644
--- a/includes/HttpFunctions.php
+++ b/includes/HttpFunctions.php
@@ -250,7 +250,9 @@
* @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 @@
}
/**
- * 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 @@
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 @@
}
/**
- * 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 ) {
diff --git a/includes/MWTimestamp.php b/includes/MWTimestamp.php
index 102be80..639403d 100644
--- a/includes/MWTimestamp.php
+++ b/includes/MWTimestamp.php
@@ -203,11 +203,15 @@
* @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();
}
diff --git a/includes/PHPVersionCheck.php b/includes/PHPVersionCheck.php
index 4b2ff8c..f7e14a1 100644
--- a/includes/PHPVersionCheck.php
+++ b/includes/PHPVersionCheck.php
@@ -189,10 +189,10 @@
. "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 );
diff --git a/includes/Revision.php b/includes/Revision.php
index 90d6265..a7a87e8 100644
--- a/includes/Revision.php
+++ b/includes/Revision.php
@@ -1466,7 +1466,8 @@
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();
diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php
index 6adfc1a..636baa7 100644
--- a/includes/api/ApiBlock.php
+++ b/includes/api/ApiBlock.php
@@ -162,12 +162,14 @@
}
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() {
diff --git a/includes/api/ApiQueryAllMessages.php
b/includes/api/ApiQueryAllMessages.php
index 152711f..d8a71ca 100644
--- a/includes/api/ApiQueryAllMessages.php
+++ b/includes/api/ApiQueryAllMessages.php
@@ -116,7 +116,13 @@
$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';
}
diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index bbee9d4..efad151 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -91,8 +91,10 @@
# 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| |&\#0*160;|&\#[Xx]0*[Aa]0;|\p{Zs})';
diff --git a/includes/poolcounter/PoolCounterRedis.php
b/includes/poolcounter/PoolCounterRedis.php
index d7357cf..6dd0b35 100644
--- a/includes/poolcounter/PoolCounterRedis.php
+++ b/includes/poolcounter/PoolCounterRedis.php
@@ -149,6 +149,7 @@
}
$conn = $status->value;
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
static $script =
<<<LUA
local kSlots,kSlotsNextRelease,kWakeup,kWaiting = unpack(KEYS)
@@ -186,6 +187,8 @@
end
return 1
LUA;
+ // @codingStandardsIgnoreEnd
+
try {
$conn->luaEval( $script,
array(
diff --git a/includes/specials/SpecialAllMessages.php
b/includes/specials/SpecialAllMessages.php
index 762658c..ed1c903 100644
--- a/includes/specials/SpecialAllMessages.php
+++ b/includes/specials/SpecialAllMessages.php
@@ -445,7 +445,11 @@
} 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
+ );
}
}
diff --git a/includes/specials/SpecialMergeHistory.php
b/includes/specials/SpecialMergeHistory.php
index 7b75480..ef1fd73 100644
--- a/includes/specials/SpecialMergeHistory.php
+++ b/includes/specials/SpecialMergeHistory.php
@@ -476,7 +476,12 @@
$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 )
diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php
index 508f62e..5193a7f 100644
--- a/includes/upload/UploadBase.php
+++ b/includes/upload/UploadBase.php
@@ -1399,7 +1399,10 @@
# 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" );
--
To view, visit https://gerrit.wikimedia.org/r/243385
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d759be6ef568c2c6f28606d3002484ad77a1830
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Amire80 <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits