From 861617ca24d04e7995cd7f8e79f2fb37db6885e8 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Mon, 4 Aug 2014 11:51:22 +0200 Subject: [PATCH] Fixed spacing - Removed spaces around array index - Changed else if to elseif - Added space after foreach/if/function - include_once is not a function Change-Id: I7745ae791d1b7e60cfebec6d268513a9cc071bdd --- includes/Cookie.php | 5 +++-- includes/Skin.php | 2 +- includes/media/SVG.php | 2 +- includes/resourceloader/ResourceLoader.php | 8 ++++---- tests/phpunit/phpunit.php | 18 +++++++++--------- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/includes/Cookie.php b/includes/Cookie.php index 8b5906a820..cb041904b8 100644 --- a/includes/Cookie.php +++ b/includes/Cookie.php @@ -94,8 +94,9 @@ class Cookie { // Don't allow a trailing dot or addresses without a or just a leading dot if ( substr( $domain, -1 ) == '.' || - count( $dc ) <= 1 || - count( $dc ) == 2 && $dc[0] === '' ) { + count( $dc ) <= 1 || + count( $dc ) == 2 && $dc[0] === '' + ) { return false; } diff --git a/includes/Skin.php b/includes/Skin.php index fd737c04d2..a59d5678a3 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -220,7 +220,7 @@ abstract class Skin extends ContextSource { # is no longer valid. wfDebug( "Skin class does not exist: $className\n" ); - $fallback = $skinNames[ Skin::normalizeKey( $wgFallbackSkin ) ]; + $fallback = $skinNames[Skin::normalizeKey( $wgFallbackSkin )]; $className = "Skin{$fallback}"; } } diff --git a/includes/media/SVG.php b/includes/media/SVG.php index 9245d423b5..a0ce8061df 100644 --- a/includes/media/SVG.php +++ b/includes/media/SVG.php @@ -202,7 +202,7 @@ class SvgHandler extends ImageHandler { $tmpDir = wfTempDir() . '/svg_' . wfRandomString( 24 ); $lnPath = "$tmpDir/" . basename( $srcPath ); $ok = mkdir( $tmpDir, 0771 ) && symlink( $srcPath, $lnPath ); - $cleaner = new ScopedCallback( function() use ( $tmpDir, $lnPath ) { + $cleaner = new ScopedCallback( function () use ( $tmpDir, $lnPath ) { wfSuppressWarnings(); unlink( $lnPath ); rmdir( $tmpDir ); diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index bcb3842530..d46f0a3a38 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -307,11 +307,11 @@ class ResourceLoader { // If $name is preceded with a '+', the defined style files will be added to 'default' // skinStyles, otherwise 'default' will be ignored as it normally would be. - if ( isset( $skinStyles[ $name ] ) ) { - $paths = (array)$skinStyles[ $name ]; + if ( isset( $skinStyles[$name] ) ) { + $paths = (array)$skinStyles[$name]; $styleFiles = array(); - } else if ( isset( $skinStyles[ '+' . $name ] ) ) { - $paths = (array)$skinStyles[ '+' . $name ]; + } elseif ( isset( $skinStyles['+' . $name] ) ) { + $paths = (array)$skinStyles['+' . $name]; $styleFiles = isset( $this->moduleInfos[$name]['skinStyles']['default'] ) ? $this->moduleInfos[$name]['skinStyles']['default'] : array(); diff --git a/tests/phpunit/phpunit.php b/tests/phpunit/phpunit.php index 63313cfbf8..1125504353 100755 --- a/tests/phpunit/phpunit.php +++ b/tests/phpunit/phpunit.php @@ -148,17 +148,17 @@ class PHPUnitMaintClass extends Maintenance { } $key = array_search( '--debug-tests', $_SERVER['argv'] ); - if( $key !== false && array_search( '--printer', $_SERVER['argv'] ) === false ) { + if ( $key !== false && array_search( '--printer', $_SERVER['argv'] ) === false ) { unset( $_SERVER['argv'][$key] ); array_splice( $_SERVER['argv'], 1, 0, 'MediaWikiPHPUnitTestListener' ); array_splice( $_SERVER['argv'], 1, 0, '--printer' ); } - foreach( self::$additionalOptions as $option => $default ) { + foreach ( self::$additionalOptions as $option => $default ) { $key = array_search( '--' . $option, $_SERVER['argv'] ); - if( $key !== false ) { + if ( $key !== false ) { unset( $_SERVER['argv'][$key] ); - if( $this->mParams[$option]['withArg'] ) { + if ( $this->mParams[$option]['withArg'] ) { self::$additionalOptions[$option] = $_SERVER['argv'][$key + 1]; unset( $_SERVER['argv'][$key + 1] ); } else { @@ -179,11 +179,11 @@ class PHPUnitMaintClass extends Maintenance { */ private function forceFormatServerArgv() { $argv = array(); - foreach( $_SERVER['argv'] as $key => $arg ) { - if( $key === 0 ) { + foreach ( $_SERVER['argv'] as $key => $arg ) { + if ( $key === 0 ) { $argv[0] = $arg; } elseif ( strstr( $arg, '=' ) ) { - foreach( explode( '=', $arg, 2 ) as $argPart ) { + foreach ( explode( '=', $arg, 2 ) as $argPart ) { $argv[] = $argPart; } } else { @@ -209,12 +209,12 @@ if ( version_compare( PHP_VERSION, '5.4.0', '<' ) ) { $ok = false; -foreach( array( +foreach ( array( stream_resolve_include_path( 'phpunit.phar' ), 'PHPUnit/Runner/Version.php', 'PHPUnit/Autoload.php' ) as $includePath ) { - @include_once( $includePath ); + @include_once $includePath; if ( class_exists( 'PHPUnit_TextUI_Command' ) ) { $ok = true; break; -- 2.20.1