Paladox has uploaded a new change for review.
https://gerrit.wikimedia.org/r/219027
Change subject: Fix phpcs warnings
......................................................................
Fix phpcs warnings
Change-Id: Iecea365f83bbb0c336b58f1cfdebfc9b1112087e
---
M includes/resourceloader/ResourceLoaderImage.php
M includes/resourceloader/ResourceLoaderImageModule.php
M includes/resourceloader/ResourceLoaderOOUIImageModule.php
M maintenance/convertExtensionToRegistration.php
M maintenance/exportSites.php
M maintenance/importSites.php
M resources/ResourcesOOUI.php
M tests/phpunit/includes/api/ApiResultTest.php
8 files changed, 63 insertions(+), 23 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/27/219027/1
diff --git a/includes/resourceloader/ResourceLoaderImage.php
b/includes/resourceloader/ResourceLoaderImage.php
index bf68fdd..7b76826 100644
--- a/includes/resourceloader/ResourceLoaderImage.php
+++ b/includes/resourceloader/ResourceLoaderImage.php
@@ -54,7 +54,8 @@
$this->variants = $variants;
// Expand shorthands:
- // array( "en,de,fr" => "foo.svg" ) → array( "en" => "foo.svg",
"de" => "foo.svg", "fr" => "foo.svg" )
+ // array( "en,de,fr" => "foo.svg" )
+ // → array( "en" => "foo.svg", "de" => "foo.svg", "fr" =>
"foo.svg" )
if ( is_array( $this->descriptor ) && isset(
$this->descriptor['lang'] ) ) {
foreach ( array_keys( $this->descriptor['lang'] ) as
$langList ) {
if ( strpos( $langList, ',' ) !== false ) {
@@ -75,11 +76,15 @@
} );
$extensions = array_unique( $extensions );
if ( count( $extensions ) !== 1 ) {
- throw new InvalidArgumentException( "File type for
different image files of '$name' not the same" );
+ throw new InvalidArgumentException(
+ "File type for different image files of '$name'
not the same"
+ );
}
$ext = $extensions[0];
if ( !isset( self::$fileTypes[$ext] ) ) {
- throw new InvalidArgumentException( "Invalid file type
for image files of '$name' (valid: svg, png, gif, jpg)" );
+ throw new InvalidArgumentException(
+ "Invalid file type for image files of '$name'
(valid: svg, png, gif, jpg)"
+ );
}
$this->extension = $ext;
}
diff --git a/includes/resourceloader/ResourceLoaderImageModule.php
b/includes/resourceloader/ResourceLoaderImageModule.php
index ccdb88f..cec9d6b 100644
--- a/includes/resourceloader/ResourceLoaderImageModule.php
+++ b/includes/resourceloader/ResourceLoaderImageModule.php
@@ -134,20 +134,30 @@
$prefix = isset( $options['prefix'] ) && $options['prefix'];
$selector = isset( $options['selector'] ) &&
$options['selector'];
- $selectorWithoutVariant = isset(
$options['selectorWithoutVariant'] ) && $options['selectorWithoutVariant'];
- $selectorWithVariant = isset( $options['selectorWithVariant'] )
&& $options['selectorWithVariant'];
+ $selectorWithoutVariant = isset(
$options['selectorWithoutVariant'] )
+ && $options['selectorWithoutVariant'];
+ $selectorWithVariant = isset( $options['selectorWithVariant'] )
+ && $options['selectorWithVariant'];
if ( $selectorWithoutVariant && !$selectorWithVariant ) {
- throw new InvalidArgumentException( "Given
'selectorWithoutVariant' but no 'selectorWithVariant'." );
+ throw new InvalidArgumentException(
+ "Given 'selectorWithoutVariant' but no
'selectorWithVariant'."
+ );
}
if ( $selectorWithVariant && !$selectorWithoutVariant ) {
- throw new InvalidArgumentException( "Given
'selectorWithVariant' but no 'selectorWithoutVariant'." );
+ throw new InvalidArgumentException(
+ "Given 'selectorWithVariant' but no
'selectorWithoutVariant'."
+ );
}
if ( $selector && $selectorWithVariant ) {
- throw new InvalidArgumentException( "Incompatible
'selector' and 'selectorWithVariant'+'selectorWithoutVariant' given." );
+ throw new InvalidArgumentException(
+ "Incompatible 'selector' and
'selectorWithVariant'+'selectorWithoutVariant' given."
+ );
}
if ( !$prefix && !$selector && !$selectorWithVariant ) {
- throw new InvalidArgumentException( "None of 'prefix',
'selector' or 'selectorWithVariant'+'selectorWithoutVariant' given." );
+ throw new InvalidArgumentException(
+ "None of 'prefix', 'selector' or
'selectorWithVariant'+'selectorWithoutVariant' given."
+ );
}
foreach ( $options as $member => $option ) {
diff --git a/includes/resourceloader/ResourceLoaderOOUIImageModule.php
b/includes/resourceloader/ResourceLoaderOOUIImageModule.php
index ebbeb01..12bb4ec 100644
--- a/includes/resourceloader/ResourceLoaderOOUIImageModule.php
+++ b/includes/resourceloader/ResourceLoaderOOUIImageModule.php
@@ -69,7 +69,9 @@
if ( !isset( $definition[$key]
) ) {
$definition[$key] =
$data[$key];
} elseif ( $definition[$key]
!== $data[$key] ) {
- throw new Exception(
"Mismatched OOUI theme definitions are not supported: trying to load $key of
$theme theme" );
+ throw new Exception(
+ "Mismatched
OOUI theme definitions are not supported: trying to load $key of $theme theme"
+ );
}
break;
}
diff --git a/maintenance/convertExtensionToRegistration.php
b/maintenance/convertExtensionToRegistration.php
index df67306..b7fe80b 100644
--- a/maintenance/convertExtensionToRegistration.php
+++ b/maintenance/convertExtensionToRegistration.php
@@ -56,7 +56,8 @@
public function __construct() {
parent::__construct();
$this->mDescription = 'Converts extension entry points to the
new JSON registration format';
- $this->addArg( 'path', 'Location to the PHP entry point you
wish to convert', /* $required = */ true );
+ $this->addArg( 'path', 'Location to the PHP entry point you
wish to convert',
+ /* $required = */ true );
$this->addOption( 'skin', 'Whether to write to skin.json',
false, false );
}
@@ -95,7 +96,8 @@
}
if ( isset( $this->custom[$realName] ) ) {
- call_user_func_array( array( $this,
$this->custom[$realName] ), array( $realName, $value, $vars ) );
+ call_user_func_array( array( $this,
$this->custom[$realName] ),
+ array( $realName, $value, $vars ) );
} elseif ( in_array( $realName, $globalSettings ) ) {
$this->json[$realName] = $value;
} elseif ( array_key_exists( $realName,
$this->noLongerSupportedGlobals ) ) {
@@ -133,7 +135,9 @@
protected function handleExtensionFunctions( $realName, $value ) {
foreach ( $value as $func ) {
if ( $func instanceof Closure ) {
- $this->error( "Error: Closures cannot be
converted to JSON. Please move your extension function somewhere else.", 1 );
+ $this->error( "Error: Closures cannot be
converted to JSON. " .
+ "Please move your extension function
somewhere else.", 1
+ );
}
}
@@ -197,7 +201,9 @@
foreach ( $value as $hookName => $handlers ) {
foreach ( $handlers as $func ) {
if ( $func instanceof Closure ) {
- $this->error( "Error: Closures cannot
be converted to JSON. Please move the handler for $hookName somewhere else.", 1
);
+ $this->error( "Error: Closures cannot
be converted to JSON. " .
+ "Please move the handler for
$hookName somewhere else.", 1
+ );
}
}
}
diff --git a/maintenance/exportSites.php b/maintenance/exportSites.php
index 1c71dc0..7eb114f 100644
--- a/maintenance/exportSites.php
+++ b/maintenance/exportSites.php
@@ -17,7 +17,9 @@
public function __construct() {
$this->mDescription = 'Exports site definitions the sites table
to XML file';
- $this->addArg( 'file', 'A file to write the XML to (see
docs/sitelist.txt). Use "php://stdout" to write to stdout.', true );
+ $this->addArg('file', 'A file to write the XML to (see
docs/sitelist.txt). ' .
+ 'Use "php://stdout" to write to stdout.', true
+ );
parent::__construct();
}
diff --git a/maintenance/importSites.php b/maintenance/importSites.php
index 7abb8d7..392018b 100644
--- a/maintenance/importSites.php
+++ b/maintenance/importSites.php
@@ -17,7 +17,9 @@
public function __construct() {
$this->mDescription = 'Imports site definitions from XML into
the sites table.';
- $this->addArg( 'file', 'An XML file containing site definitions
(see docs/sitelist.txt). Use "php://stdin" to read from stdin.', true );
+ $this->addArg( 'file', 'An XML file containing site definitions
(see docs/sitelist.txt). ' .
+ 'Use "php://stdin" to read from stdin.', true
+ );
parent::__construct();
}
diff --git a/resources/ResourcesOOUI.php b/resources/ResourcesOOUI.php
index 37203fb..1e1c92f 100644
--- a/resources/ResourcesOOUI.php
+++ b/resources/ResourcesOOUI.php
@@ -112,7 +112,10 @@
if ( substr( $name, 0, 5 ) === 'icons' ) {
$module['selectorWithoutVariant'] =
'.oo-ui-icon-{name}, .mw-ui-icon-{name}:before';
- $module['selectorWithVariant'] =
'.oo-ui-image-{variant} .oo-ui-icon-{name},
.oo-ui-image-{variant}.oo-ui-icon-{name}, .mw-ui-icon-{name}-{variant}:before,
.mw-ui-hovericon:hover .mw-ui-icon-{name}-{variant}-hover:before,
.mw-ui-hovericon.mw-ui-icon-{name}-{variant}-hover:hover:before';
+ $module['selectorWithVariant'] =
'.oo-ui-image-{variant} .oo-ui-icon-{name},
+ .oo-ui-image-{variant}.oo-ui-icon-{name},
.mw-ui-icon-{name}-{variant}:before,
+ .mw-ui-hovericon:hover
.mw-ui-icon-{name}-{variant}-hover:before,
+
.mw-ui-hovericon.mw-ui-icon-{name}-{variant}-hover:hover:before';
}
$modules[ "oojs-ui.styles.$name" ] = $module;
diff --git a/tests/phpunit/includes/api/ApiResultTest.php
b/tests/phpunit/includes/api/ApiResultTest.php
index 1ed571c..4131b01 100644
--- a/tests/phpunit/includes/api/ApiResultTest.php
+++ b/tests/phpunit/includes/api/ApiResultTest.php
@@ -871,8 +871,12 @@
array( 'Types' => array( 'AssocAsObject' =>
true ) ),
(object)array(
'defaultArray' => array( 'b', 'c', 'a',
ApiResult::META_TYPE => 'array' ),
- 'defaultAssoc' => (object)array( 'x' =>
'a', 1 => 'b', 0 => 'c', ApiResult::META_TYPE => 'assoc' ),
- 'defaultAssoc2' => (object)array( 2 =>
'a', 3 => 'b', 0 => 'c', ApiResult::META_TYPE => 'assoc' ),
+ 'defaultAssoc' => (object)array( 'x' =>
'a',
+ 1 => 'b', 0 => 'c',
ApiResult::META_TYPE => 'assoc'
+ ),
+ 'defaultAssoc2' => (object)array( 2 =>
'a', 3 => 'b',
+ 0 => 'c', ApiResult::META_TYPE
=> 'assoc'
+ ),
'array' => array( 'a', 'c', 'b',
ApiResult::META_TYPE => 'array' ),
'BCarray' => array( 'a', 'c', 'b',
ApiResult::META_TYPE => 'array' ),
'BCassoc' => (object)array( 'a', 'b',
'c', ApiResult::META_TYPE => 'assoc' ),
@@ -960,8 +964,12 @@
array( 'Types' => array( 'ArmorKVP' => 'name',
'AssocAsObject' => true ) ),
(object)array(
'defaultArray' => array( 'b', 'c', 'a',
ApiResult::META_TYPE => 'array' ),
- 'defaultAssoc' => (object)array( 'x' =>
'a', 1 => 'b', 0 => 'c', ApiResult::META_TYPE => 'assoc' ),
- 'defaultAssoc2' => (object)array( 2 =>
'a', 3 => 'b', 0 => 'c', ApiResult::META_TYPE => 'assoc' ),
+ 'defaultAssoc' => (object)array( 'x' =>
'a', 1 => 'b',
+ 0 => 'c', ApiResult::META_TYPE
=> 'assoc'
+ ),
+ 'defaultAssoc2' => (object)array( 2 =>
'a', 3 => 'b',
+ 0 => 'c', ApiResult::META_TYPE
=> 'assoc'
+ ),
'array' => array( 'a', 'c', 'b',
ApiResult::META_TYPE => 'array' ),
'BCarray' => array( 'a', 'c', 'b',
ApiResult::META_TYPE => 'array' ),
'BCassoc' => (object)array( 'a', 'b',
'c', ApiResult::META_TYPE => 'assoc' ),
@@ -1203,7 +1211,8 @@
if ( preg_match( '/Use of ApiResult::\S+ was deprecated
in MediaWiki \d+.\d+\./', $errstr ) ) {
return true;
}
- if ( preg_match( '/Use of ApiMain to
ApiResult::__construct was deprecated in MediaWiki \d+.\d+\./', $errstr ) ) {
+ if ( preg_match( '/Use of ApiMain to
ApiResult::__construct ' .
+ 'was deprecated in MediaWiki \d+.\d+\./',
$errstr ) ) {
return true;
}
return false;
@@ -1521,7 +1530,8 @@
$result = new ApiResult( 8388608 );
$result->setMainForContinuation( $main );
- $result->beginContinuation( '||mock2', array_slice(
$allModules, 0, 2 ), array( 'mock1', 'mock2' ) );
+ $result->beginContinuation( '||mock2', array_slice(
$allModules, 0, 2 ),
+ array( 'mock1', 'mock2' ) );
try {
$result->setContinueParam( $allModules[1],
'm2continue', 1 );
$this->fail( 'Expected exception not thrown' );
--
To view, visit https://gerrit.wikimedia.org/r/219027
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iecea365f83bbb0c336b58f1cfdebfc9b1112087e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Paladox <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits