Fix whitespace issues around parentheses

Fix issues found by MediaWiki.WhiteSpace.SpaceyParenthesis sniff.

Bug: T102617
Change-Id: Iec7f71e64081659fba373ec20d9d2006306a98f4
This commit is contained in:
Vivek Ghaisas 2015-06-16 22:06:19 +03:00
parent a4ff1c14bf
commit 9f5b6f5aeb
53 changed files with 98 additions and 98 deletions

View file

@ -1,5 +1,5 @@
<?php
die("Not a valid entry point\n");
die( "Not a valid entry point\n" );
/**
* This file does not hold any code. It is only there so we can generate
* the doxygen documentation main page.

View file

@ -166,12 +166,12 @@ class AjaxResponse {
HttpStatus::header( $n );
}
header ( "Content-Type: " . $this->mContentType );
header( "Content-Type: " . $this->mContentType );
if ( $this->mLastModified ) {
header ( "Last-Modified: " . $this->mLastModified );
header( "Last-Modified: " . $this->mLastModified );
} else {
header ( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" );
header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" );
}
if ( $this->mCacheDuration ) {
@ -193,20 +193,20 @@ class AjaxResponse {
} else {
# Let the client do the caching. Cache is not purged.
header ( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $this->mCacheDuration ) . " GMT" );
header ( "Cache-Control: s-maxage={$this->mCacheDuration}," .
header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $this->mCacheDuration ) . " GMT" );
header( "Cache-Control: s-maxage={$this->mCacheDuration}," .
"public,max-age={$this->mCacheDuration}" );
}
} else {
# always expired, always modified
header ( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); // Date in the past
header ( "Cache-Control: no-cache, must-revalidate" ); // HTTP/1.1
header ( "Pragma: no-cache" ); // HTTP/1.0
header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); // Date in the past
header( "Cache-Control: no-cache, must-revalidate" ); // HTTP/1.1
header( "Pragma: no-cache" ); // HTTP/1.0
}
if ( $this->mVary ) {
header ( "Vary: " . $this->mVary );
header( "Vary: " . $this->mVary );
}
}

View file

@ -1109,7 +1109,7 @@ class Block {
$blocks = array();
foreach ( $rows as $row ) {
$block = self::newFromRow( $row );
if ( !$block->deleteIfExpired() ) {
if ( !$block->deleteIfExpired() ) {
$blocks[] = $block;
}
}

View file

@ -329,7 +329,7 @@ class CategoryViewer extends ContextSource {
'category' => array( 'LEFT JOIN', array(
'cat_title = page_title',
'page_namespace' => NS_CATEGORY
))
) )
)
);

View file

@ -1756,7 +1756,7 @@ function wfMsgExt( $key, $options ) {
}
if ( in_array( 'escape', $options, true ) ) {
$string = htmlspecialchars ( $string );
$string = htmlspecialchars( $string );
} elseif ( in_array( 'escapenoentities', $options, true ) ) {
$string = Sanitizer::escapeHtmlAllowEntities( $string );
}
@ -2758,7 +2758,7 @@ function wfShellExec( $cmd, &$retval = null, $environ = array(),
$useLogPipe = false;
if ( is_executable( '/bin/bash' ) ) {
$time = intval ( isset( $limits['time'] ) ? $limits['time'] : $wgMaxShellTime );
$time = intval( isset( $limits['time'] ) ? $limits['time'] : $wgMaxShellTime );
if ( isset( $limits['walltime'] ) ) {
$wallTime = intval( $limits['walltime'] );
} elseif ( isset( $limits['time'] ) ) {
@ -2766,8 +2766,8 @@ function wfShellExec( $cmd, &$retval = null, $environ = array(),
} else {
$wallTime = intval( $wgMaxShellWallClockTime );
}
$mem = intval ( isset( $limits['memory'] ) ? $limits['memory'] : $wgMaxShellMemory );
$filesize = intval ( isset( $limits['filesize'] ) ? $limits['filesize'] : $wgMaxShellFileSize );
$mem = intval( isset( $limits['memory'] ) ? $limits['memory'] : $wgMaxShellMemory );
$filesize = intval( isset( $limits['filesize'] ) ? $limits['filesize'] : $wgMaxShellFileSize );
if ( $time > 0 || $mem > 0 || $filesize > 0 || $wallTime > 0 ) {
$cmd = '/bin/bash ' . escapeshellarg( "$IP/includes/limit.sh" ) . ' ' .

View file

@ -369,7 +369,7 @@ if ( $wgResourceLoaderMaxQueryLength === false ) {
} else {
$wgResourceLoaderMaxQueryLength = 2000;
}
unset($suhosinMaxValueLength);
unset( $suhosinMaxValueLength );
}
/**
@ -429,7 +429,7 @@ if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) {
}
// Blacklisted file extensions shouldn't appear on the "allowed" list
$wgFileExtensions = array_values( array_diff ( $wgFileExtensions, $wgFileBlacklist ) );
$wgFileExtensions = array_values( array_diff( $wgFileExtensions, $wgFileBlacklist ) );
if ( $wgInvalidateCacheOnLocalSettingsChange ) {
MediaWiki\suppressWarnings();

View file

@ -78,7 +78,7 @@ class StreamFile {
) {
if ( !is_array( $info ) ) {
if ( $sendErrors ) {
HttpStatus::header( 404 );
HttpStatus::header( 404 );
header( 'Cache-Control: no-cache' );
header( 'Content-Type: text/html; charset=utf-8' );
$encFile = htmlspecialchars( $path );

View file

@ -246,7 +246,7 @@ class ApiEditPage extends ApiBase {
$titleObj->getNextRevisionID( $undoafterRev->getID() ) == $params['undo']
) {
$params['summary'] = wfMessage( 'undo-summary' )
->params ( $params['undo'], $undoRev->getUserText() )->inContentLanguage()->text();
->params( $params['undo'], $undoRev->getUserText() )->inContentLanguage()->text();
}
}

View file

@ -162,7 +162,7 @@ class ApiExpandTemplates extends ApiBase {
!isset( $prop['jsconfigvars'] ) && !isset( $prop['encodedjsconfigvars'] ) ) {
$this->setWarning( "Property 'modules' was set but not 'jsconfigvars' " .
"or 'encodedjsconfigvars'. Configuration variables are necessary " .
"for proper module usage.");
"for proper module usage." );
}
}
}

View file

@ -376,7 +376,7 @@ class ApiParse extends ApiBase {
!isset( $prop['jsconfigvars'] ) && !isset( $prop['encodedjsconfigvars'] ) ) {
$this->setWarning( "Property 'modules' was set but not 'jsconfigvars' " .
"or 'encodedjsconfigvars'. Configuration variables are necessary " .
"for proper module usage.");
"for proper module usage." );
}
if ( isset( $prop['indicators'] ) ) {

View file

@ -238,7 +238,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
// Add item to results and see whether it fits
$fit = $apiResult->addValue(
array( 'query', 'interwiki' . $this->getModuleName(), $result->getInterwikiPrefix() ),
array( 'query', 'interwiki' . $this->getModuleName(), $result->getInterwikiPrefix() ),
null,
$vals
);

View file

@ -181,7 +181,7 @@ class LegacyLogger extends AbstractLogger {
} elseif ( $channel === 'profileoutput' ) {
// Legacy wfLogProfilingData formatitng
$forward = '';
if ( isset( $context['forwarded_for'] )) {
if ( isset( $context['forwarded_for'] ) ) {
$forward = " forwarded for {$context['forwarded_for']}";
}
if ( isset( $context['client_ip'] ) ) {

View file

@ -1040,7 +1040,7 @@ class DifferenceEngine extends ContextSource {
$key = $title->quickUserCan( 'edit', $user ) ? 'editold' : 'viewsourceold';
$msg = $this->msg( $key )->escaped();
$editLink = $this->msg( 'parentheses' )->rawParams(
Linker::linkKnown( $title, $msg, array( ), $editQuery ) )->escaped();
Linker::linkKnown( $title, $msg, array(), $editQuery ) )->escaped();
$header .= ' ' . Html::rawElement(
'span',
array( 'class' => 'mw-diff-edit' ),

View file

@ -41,7 +41,7 @@ class MssqlUpdater extends DatabaseUpdater {
array( 'addField', 'mwuser', 'user_password_expires', 'patch-user_password_expires.sql' ),
// 1.24
array( 'addField', 'page', 'page_lang', 'patch-page-page_lang.sql'),
array( 'addField', 'page', 'page_lang', 'patch-page-page_lang.sql' ),
// 1.25
array( 'dropTable', 'hitcounter' ),

View file

@ -380,7 +380,7 @@ class FormatJson {
$inComment = false;
$multiline = false;
for ($idx = 0; $idx < $maxLen; $idx++) {
for ( $idx = 0; $idx < $maxLen; $idx++ ) {
switch ( $str[$idx] ) {
case '"':
$lookBehind = ( $idx - 1 >= 0 ) ? $str[$idx - 1] : '';

View file

@ -415,7 +415,7 @@ class XMPReader implements LoggerAwareInterface {
$len = unpack( 'Nlength/Noffset', substr( $content, 32, 8 ) );
if ( !$len || $len['length'] < 4 || $len['offset'] < 0 || $len['offset'] > $len['length'] ) {
$this->logger->info( __METHOD__ . 'Error reading extended XMP block, invalid length or offset.' );
$this->logger->info( __METHOD__ . 'Error reading extended XMP block, invalid length or offset.' );
return false;
}

View file

@ -1438,7 +1438,7 @@ class Parser {
'-' => '',
' ' => '',
'x' => 'X',
));
) );
$titleObj = SpecialPage::getTitleFor( 'Booksources', $num );
return '<a href="' .
htmlspecialchars( $titleObj->getLocalURL() ) .
@ -1481,7 +1481,7 @@ class Parser {
# Don't break a trailing HTML entity by moving the ; into $trail
# This is in hot code, so use substr_compare to avoid having to
# create a new string object for the comparison
if ( $numSepChars && substr_compare( $url, ";", -$numSepChars, 1 ) === 0) {
if ( $numSepChars && substr_compare( $url, ";", -$numSepChars, 1 ) === 0 ) {
# more optimization: instead of running preg_match with a $
# anchor, which can be slow, do the match on the reversed
# string starting at the desired offset.

View file

@ -32,7 +32,7 @@
function wfGetRusage() {
if ( !function_exists( 'getrusage' ) ) {
return false;
} elseif ( defined ( 'HHVM_VERSION' ) ) {
} elseif ( defined( 'HHVM_VERSION' ) ) {
return getrusage( 2 /* RUSAGE_THREAD */ );
} else {
return getrusage( 0 /* RUSAGE_SELF */ );

View file

@ -218,7 +218,7 @@ class SearchHighlighter {
}
// calc by how much to extend existing snippets
$targetchars = intval( ( $contextchars * $contextlines ) / count ( $snippets ) );
$targetchars = intval( ( $contextchars * $contextlines ) / count( $snippets ) );
}
foreach ( $snippets as $index => $line ) {

View file

@ -70,7 +70,7 @@ abstract class QueryPage extends SpecialPage {
array( 'DeadendPagesPage', 'Deadendpages' ),
array( 'DoubleRedirectsPage', 'DoubleRedirects' ),
array( 'FileDuplicateSearchPage', 'FileDuplicateSearch' ),
array( 'ListDuplicatedFilesPage', 'ListDuplicatedFiles'),
array( 'ListDuplicatedFilesPage', 'ListDuplicatedFiles' ),
array( 'LinkSearchPage', 'LinkSearch' ),
array( 'ListredirectsPage', 'Listredirects' ),
array( 'LonelyPagesPage', 'Lonelypages' ),

View file

@ -229,7 +229,7 @@ HTML;
// writes a script tag (the one loading mediawiki.js). Script tags are synchronous, block
// each other, and run in order. But they don't nest. The code appended after the startup
// module runs before the added script tag is parsed and executed.
echo Xml::encodeJsCall( 'document.write', array( Html::inlineScript( $code ) ) );
echo Xml::encodeJsCall( 'document.write', array( Html::inlineScript( $code ) ) );
}
private function plainQUnit() {

View file

@ -236,7 +236,7 @@ class MediaStatisticsPage extends QueryPage {
'mw-mediastats-table-' . strtolower( $mediaType ),
'sortable',
'wikitable'
))
) )
)
);
$this->getOutput()->addHTML( $this->getTableHeaderRow() );
@ -275,7 +275,7 @@ class MediaStatisticsPage extends QueryPage {
array( 'class' => array(
'mw-mediastats-mediatype',
'mw-mediastats-mediatype-' . strtolower( $mediaType )
)),
) ),
// for grep
// mediastatistics-header-unknown, mediastatistics-header-bitmap,
// mediastatistics-header-drawing, mediastatistics-header-audio,

View file

@ -249,7 +249,7 @@ class UserrightsPage extends SpecialPage {
if ( $remove ) {
foreach ( $remove as $index => $group ) {
if ( !$user->removeGroup( $group ) ) {
unset($remove[$index]);
unset( $remove[$index] );
}
}
$newGroups = array_diff( $newGroups, $remove );
@ -257,7 +257,7 @@ class UserrightsPage extends SpecialPage {
if ( $add ) {
foreach ( $add as $index => $group ) {
if ( !$user->addGroup( $group ) ) {
unset($add[$index]);
unset( $add[$index] );
}
}
$newGroups = array_merge( $newGroups, $add );

View file

@ -1336,7 +1336,7 @@ class Language {
case 'xmn':
$usedHijriMonth = true;
if ( !$hijri ) {
$hijri = self::tsToHijri ( $ts );
$hijri = self::tsToHijri( $ts );
}
$num = $hijri[1];
break;
@ -3444,7 +3444,7 @@ class Language {
// the string does not have any number part. Eg: .12345
return $sign . $groupedNumber;
}
$start = $end = ($integerPart) ? strlen( $integerPart[0] ) : 0;
$start = $end = ( $integerPart ) ? strlen( $integerPart[0] ) : 0;
while ( $start > 0 ) {
$match = $matches[0][$numMatches - 1];
$matchLen = strlen( $match );

View file

@ -61,7 +61,7 @@ class LanguageEo extends Language {
*/
function iconv( $in, $out, $string ) {
if ( strcasecmp( $in, 'x' ) == 0 && strcasecmp( $out, 'utf-8' ) == 0 ) {
return preg_replace_callback (
return preg_replace_callback(
'/([cghjsu]x?)((?:xx)*)(?!x)/i',
array( $this, 'strrtxuCallback' ), $string );
} elseif ( strcasecmp( $in, 'UTF-8' ) == 0 && strcasecmp( $out, 'x' ) == 0 ) {

View file

@ -149,10 +149,10 @@ class LanguageFi extends Language {
);
$final = '';
$tokens = explode ( ' ', $str );
$tokens = explode( ' ', $str );
foreach ( $tokens as $item ) {
if ( !is_numeric( $item ) ) {
if ( count ( explode( '-', $item ) ) == 3 && strlen( $item ) == 10 ) {
if ( count( explode( '-', $item ) ) == 3 && strlen( $item ) == 10 ) {
list( $yyyy, $mm, $dd ) = explode( '-', $item );
$final .= ' ' . $this->date( "{$yyyy}{$mm}{$dd}000000" );
continue;

View file

@ -91,7 +91,7 @@ class LanguageKsh extends Language {
function convertGrammar( $word, $case ) {
$lord = strtolower( $word );
$gender = 'm'; // Nuutnaarel // default
if ( preg_match ( '/wiki$/', $lord ) ) {
if ( preg_match( '/wiki$/', $lord ) ) {
$gender = 'n'; // Dat xyz-wiki
}
if ( isset( self::$familygender[$lord] ) ) {

View file

@ -182,7 +182,7 @@ class ConvertExtensionToRegistration extends Maintenance {
$this->json[$realName] = $out;
}
protected function handleCredits( $realName, $value) {
protected function handleCredits( $realName, $value ) {
$keys = array_keys( $value );
$this->json['type'] = $keys[0];
$values = array_values( $value );

View file

@ -18,7 +18,7 @@ class ValidateRegistrationFile extends Maintenance {
$this->error( "$path is not a valid JSON file.", 1 );
}
if ( !isset( $data->manifest_version ) ) {
$this->output("Warning: No manifest_version set, assuming 1.\n" );
$this->output( "Warning: No manifest_version set, assuming 1.\n" );
// For backwards-compatability assume 1
$data->manifest_version = 1;
}
@ -39,7 +39,7 @@ class ValidateRegistrationFile extends Maintenance {
. ExtensionRegistry::MANIFEST_VERSION . "\n" );
}
$retriever = new JsonSchema\Uri\UriRetriever();
$schema = $retriever->retrieve('file://' . $schemaPath );
$schema = $retriever->retrieve( 'file://' . $schemaPath );
$validator = new JsonSchema\Validator();
$validator->check( $data, $schema );

View file

@ -76,7 +76,7 @@ class LinkFilterTest extends MediaWikiLangTestCase {
array( 'https://', '*.com', 'https://name:pass@secure.com/index.html' ),
array( 'http://', 'name:pass@test.com', 'http://test.com' ),
array( 'http://', 'test.com', 'http://name:pass@test.com' ),
array( 'http://', '*.test.com', 'http://a.b.c.test.com/dir/dir/file?a=6'),
array( 'http://', '*.test.com', 'http://a.b.c.test.com/dir/dir/file?a=6' ),
array( null, 'http://*.test.com', 'http://www.test.com' ),
array( 'mailto:', 'name@mail.test123.com', 'mailto:name@mail.test123.com' ),
array( '',
@ -122,8 +122,8 @@ class LinkFilterTest extends MediaWikiLangTestCase {
array( '', 'git://github.com/prwef/abc-def.git', 'git://github.com/prwef/abc-def.git' ),
array( 'git://', 'github.com/', 'git://github.com/prwef/abc-def.git' ),
array( 'git://', '*.github.com/', 'git://a.b.c.d.e.f.github.com/prwef/abc-def.git' ),
array( '', 'gopher://*.test.com/', 'gopher://gopher.test.com/0/v2/vstat'),
array( 'telnet://', '*.test.com', 'telnet://shell.test.com/~home/'),
array( '', 'gopher://*.test.com/', 'gopher://gopher.test.com/0/v2/vstat' ),
array( 'telnet://', '*.test.com', 'telnet://shell.test.com/~home/' ),
//
// The following only work in PHP >= 5.3.7, due to a bug in parse_url which eats
@ -243,10 +243,10 @@ class LinkFilterTest extends MediaWikiLangTestCase {
array( 'http://*.test.*' ),
array( 'http://*test.com' ),
array( 'https://*' ),
array( '*://test.com'),
array( '*://test.com' ),
array( 'mailto:name:pass@t*est.com' ),
array( 'http://*:888/'),
array( '*http://'),
array( 'http://*:888/' ),
array( '*http://' ),
array( 'test.com/*/index' ),
array( 'test.com/dir/index?arg=*' ),
);

View file

@ -57,7 +57,7 @@ class MovePageTest extends MediaWikiTestCase {
WikiPage::factory( $oldTitle )->getRevision()
);
$this->assertNotNull(
WikiPage::factory( $newTitle)->getRevision()
WikiPage::factory( $newTitle )->getRevision()
);
}
}

View file

@ -244,36 +244,36 @@ document.write("\u003Cscript src=\"http://127.0.0.1:8080/w/load.php?debug=false\
'test.foo' => new ResourceLoaderTestModule( array(
'script' => 'mw.test.foo( { a: true } );',
'styles' => '.mw-test-foo { content: "style"; }',
)),
) ),
'test.bar' => new ResourceLoaderTestModule( array(
'script' => 'mw.test.bar( { a: true } );',
'styles' => '.mw-test-bar { content: "style"; }',
)),
) ),
'test.baz' => new ResourceLoaderTestModule( array(
'script' => 'mw.test.baz( { a: true } );',
'styles' => '.mw-test-baz { content: "style"; }',
)),
) ),
'test.quux' => new ResourceLoaderTestModule( array(
'script' => 'mw.test.baz( { token: 123 } );',
'styles' => '/* pref-animate=off */ .mw-icon { transition: none; }',
'group' => 'private',
)),
) ),
'test.raw' => new ResourceLoaderTestModule( array(
'script' => 'mw.test.baz( { token: 123 } );',
'isRaw' => true,
)),
) ),
'test.noscript' => new ResourceLoaderTestModule( array(
'styles' => '.mw-test-noscript { content: "style"; }',
'group' => 'noscript',
)),
) ),
'test.group.bar' => new ResourceLoaderTestModule( array(
'styles' => '.mw-group-bar { content: "style"; }',
'group' => 'bar',
)),
) ),
'test.group.foo' => new ResourceLoaderTestModule( array(
'styles' => '.mw-group-foo { content: "style"; }',
'group' => 'foo',
)),
) ),
) );
$links = $method->invokeArgs( $out, $args );
// Strip comments to avoid variation due to wgDBname in WikiID and cache key
@ -286,19 +286,19 @@ document.write("\u003Cscript src=\"http://127.0.0.1:8080/w/load.php?debug=false\
* MessageBlobStore that doesn't do anything
*/
class NullMessageBlobStore extends MessageBlobStore {
public function get ( ResourceLoader $resourceLoader, $modules, $lang ) {
public function get( ResourceLoader $resourceLoader, $modules, $lang ) {
return array();
}
public function insertMessageBlob ( $name, ResourceLoaderModule $module, $lang ) {
public function insertMessageBlob( $name, ResourceLoaderModule $module, $lang ) {
return false;
}
public function updateModule ( $name, ResourceLoaderModule $module, $lang ) {
public function updateModule( $name, ResourceLoaderModule $module, $lang ) {
return;
}
public function updateMessage ( $key ) {
public function updateMessage( $key ) {
}
public function clear() {
}

View file

@ -372,7 +372,7 @@ class StatusTest extends MediaWikiLangTestCase {
);
$status = new Status();
$status->warning( new Message( 'fooBar!', array( 'foo', 'bar' ) ) );
$status->warning( new Message( 'fooBar!', array( 'foo', 'bar' ) ) );
$testCases['1MessageWarning'] = array(
$status,
"<fooBar!>",
@ -449,7 +449,7 @@ class StatusTest extends MediaWikiLangTestCase {
// );
$status = new Status();
$status->warning( new Message( 'fooBar!', array( 'foo', 'bar' ) ) );
$status->warning( new Message( 'fooBar!', array( 'foo', 'bar' ) ) );
$testCases['1MessageWarning'] = array(
$status,
array( 'foo', 'bar' ),

View file

@ -145,7 +145,7 @@ class TitleTest extends MediaWikiTestCase {
}
)
)
));
) );
}
/**

View file

@ -68,7 +68,7 @@ class ApiBlockTest extends ApiTestCase {
* @expectedException UsageException
* @expectedExceptionMessage The token parameter must be set
*/
public function testBlockingActionWithNoToken( ) {
public function testBlockingActionWithNoToken() {
$this->doApiRequest(
array(
'action' => 'block',

View file

@ -218,7 +218,7 @@ class ApiEditPageTest extends ApiTestCase {
'section' => 'new',
'text' => 'test',
'summary' => 'header',
));
) );
$this->assertEquals( 'Success', $re['edit']['result'] );
// Check the page text is correct
@ -235,7 +235,7 @@ class ApiEditPageTest extends ApiTestCase {
'section' => 'new',
'text' => 'test',
'summary' => 'header',
));
) );
$this->assertEquals( 'Success', $re2['edit']['result'] );
$text = WikiPage::factory( Title::newFromText( $name ) )

View file

@ -16,7 +16,7 @@ class ApiUnblockTest extends ApiTestCase {
/**
* @expectedException UsageException
*/
public function testWithNoToken( ) {
public function testWithNoToken() {
$this->doApiRequest(
array(
'action' => 'unblock',

View file

@ -30,7 +30,7 @@ class HashConfigTest extends MediaWikiTestCase {
public function testGet() {
$conf = new HashConfig( array(
'one' => '1',
));
) );
$this->assertEquals( '1', $conf->get( 'one' ) );
$this->setExpectedException( 'ConfigException', 'HashConfig::get: undefined option' );
$conf->get( 'two' );

View file

@ -138,7 +138,7 @@ class JsonContentTest extends MediaWikiLangTestCase {
'<tr><th>0</th><td class="value">"bar"</td></tr></tbody></table>'
),
array(
(object)array( '<script>alert("evil!")</script>'),
(object)array( '<script>alert("evil!")</script>' ),
'<table class="mw-json"><tbody><tr><th>0</th><td class="value">"' .
'&lt;script>alert("evil!")&lt;/script>"' .
'</td></tr></tbody></table>',

View file

@ -181,7 +181,7 @@ class DatabaseMysqlBaseTest extends MediaWikiTestCase {
array( 'Tables_in_' => 'view2' ),
array( 'Tables_in_' => 'myview' ),
false # no more rows
));
) );
return $db;
}
/**

View file

@ -69,11 +69,11 @@ class ArrayDiffFormatterTest extends MediaWikiTestCase {
$otherTestCases = array();
$otherTestCases[] = array(
$this->getMockDiff( array( $this->getMockDiffOp( 'add', array( ), array( 'a1' ) ) ) ),
$this->getMockDiff( array( $this->getMockDiffOp( 'add', array(), array( 'a1' ) ) ) ),
array( array( 'action' => 'add', 'new' => 'a1', 'newline' => 1 ) ),
);
$otherTestCases[] = array(
$this->getMockDiff( array( $this->getMockDiffOp( 'add', array( ), array( 'a1', 'a2' ) ) ) ),
$this->getMockDiff( array( $this->getMockDiffOp( 'add', array(), array( 'a1', 'a2' ) ) ) ),
array(
array( 'action' => 'add', 'new' => 'a1', 'newline' => 1 ),
array( 'action' => 'add', 'new' => 'a2', 'newline' => 2 ),

View file

@ -178,7 +178,7 @@ class MWExceptionTest extends MediaWikiTestCase {
$this->setMwGlobals( array( 'wgLogExceptionBacktrace' => true ) );
$json = json_decode(
MWExceptionHandler::jsonSerializeException( new $exClass())
MWExceptionHandler::jsonSerializeException( new $exClass() )
);
$this->assertObjectHasAttribute( $key, $json,
"JSON serialized exception is missing key '$key'"

View file

@ -212,7 +212,7 @@ class ArrayUtilsTest extends PHPUnit_Framework_TestCase {
array(),
array( 1 => 1 ),
array( 1 ),
array( 1 => 1),
array( 1 => 1 ),
),
array(
array(),

View file

@ -255,43 +255,43 @@ class XhprofTest extends PHPUnit_Framework_TestCase {
*/
protected function getXhprofFixture( array $opts = array() ) {
$xhprof = new Xhprof( $opts );
$xhprof->loadRawData( array (
'foo==>bar' => array (
$xhprof->loadRawData( array(
'foo==>bar' => array(
'ct' => 2,
'wt' => 57,
'cpu' => 92,
'mu' => 1896,
'pmu' => 0,
),
'foo==>strlen' => array (
'foo==>strlen' => array(
'ct' => 2,
'wt' => 21,
'cpu' => 141,
'mu' => 752,
'pmu' => 0,
),
'bar==>bar@1' => array (
'bar==>bar@1' => array(
'ct' => 1,
'wt' => 18,
'cpu' => 19,
'mu' => 752,
'pmu' => 0,
),
'main()==>foo' => array (
'main()==>foo' => array(
'ct' => 1,
'wt' => 304,
'cpu' => 307,
'mu' => 4008,
'pmu' => 0,
),
'main()==>xhprof_disable' => array (
'main()==>xhprof_disable' => array(
'ct' => 1,
'wt' => 8,
'cpu' => 10,
'mu' => 768,
'pmu' => 392,
),
'main()' => array (
'main()' => array(
'ct' => 1,
'wt' => 353,
'cpu' => 351,
@ -311,7 +311,7 @@ class XhprofTest extends PHPUnit_Framework_TestCase {
*/
protected function assertArrayStructure( $struct, $actual, $label = null ) {
$this->assertInternalType( 'array', $actual, $label );
$this->assertCount( count($struct), $actual, $label );
$this->assertCount( count( $struct ), $actual, $label );
foreach ( $struct as $key => $type ) {
$this->assertArrayHasKey( $key, $actual );
$this->assertInternalType( $type, $actual[$key] );

View file

@ -68,7 +68,7 @@ class WANObjectCacheTest extends MediaWikiTestCase {
$key = wfRandomString();
for ( $i=0; $i<3; ++$i ) {
$value = wfRandomString();
$this->cache->set($key, $value, 3);
$this->cache->set( $key, $value, 3 );
$this->assertEquals( $this->cache->get( $key ), $value );
}

View file

@ -158,7 +158,7 @@ class ResourceLoaderFileModuleTest extends ResourceLoaderTestCase {
* @covers ResourceLoaderFileModule::getStyles
* @covers ResourceLoaderFileModule::getStyleFiles
*/
public function testMixedCssAnnotations( ) {
public function testMixedCssAnnotations() {
$basePath = __DIR__ . '/../../data/css';
$testModule = new ResourceLoaderFileModule( array(
'localBasePath' => $basePath,

View file

@ -16,7 +16,7 @@ class ResourceLoaderTest extends ResourceLoaderTestCase {
},
),
'wgResourceLoaderLESSImportPaths' => array(
dirname( dirname( __DIR__ ) ) . '/data/less/common',
dirname( dirname( __DIR__ ) ) . '/data/less/common',
),
'wgResourceLoaderLESSVars' => array(
'foo' => '2px',

View file

@ -59,7 +59,7 @@ class ForeignTitleTest extends MediaWikiTestCase {
$this->assertEquals( $expectedText, $title->getText() );
}
public function testUnknownNamespaceCheck( ) {
public function testUnknownNamespaceCheck() {
$title = new ForeignTitle( null, 'this', 'that' );
$this->assertEquals( false, $title->isNamespaceIdKnown() );
@ -67,7 +67,7 @@ class ForeignTitleTest extends MediaWikiTestCase {
$this->assertEquals( 'that', $title->getText() );
}
public function testUnknownNamespaceError( ) {
public function testUnknownNamespaceError() {
$this->setExpectedException( 'MWException' );
$title = new ForeignTitle( null, 'this', 'that' );
$title->getNamespaceId();

View file

@ -158,7 +158,7 @@ class MediaWikiPageLinkRendererTest extends MediaWikiTestCase {
function ( TitleValue $title ) {
return str_replace( '_', ' ', "$title" );
}
));
) );
$renderer = new MediaWikiPageLinkRenderer( $formatter, '/' );
$actual = $renderer->renderWikitextLink( $title, $text );

View file

@ -18,7 +18,7 @@ class LanguageArqTest extends LanguageClassesTestCase {
public static function provideNumber() {
return array(
array( '1.234.567', '1234567'),
array( '1.234.567', '1234567' ),
array( '-12,89', -12.89 ),
);
}

View file

@ -633,7 +633,7 @@ class TextPassDumperDatabaselessTest extends MediaWikiLangTestCase {
*/
function testBufferSizeSetting( $expected, $size, $msg ) {
$dumper = new TextPassDumperAccessor( array( "--buffersize=" . $size ) );
$this->assertEquals( $expected, $dumper->getBufferSize(), $msg);
$this->assertEquals( $expected, $dumper->getBufferSize(), $msg );
}
/**

View file

@ -695,7 +695,7 @@ class DelayedParserTest {
* @throws MWException
*/
public function unleash( &$parserTest ) {
if ( !( $parserTest instanceof ParserTest || $parserTest instanceof NewParserTest ) ) {
if ( !( $parserTest instanceof ParserTest || $parserTest instanceof NewParserTest ) ) {
throw new MWException( __METHOD__ . " must be passed an instance of ParserTest or "
. "NewParserTest classes\n" );
}

View file

@ -235,7 +235,7 @@ function wfStreamThumb( array $params ) {
$imsUnix = strtotime( $imsString );
MediaWiki\restoreWarnings();
if ( wfTimestamp( TS_UNIX, $img->getTimestamp() ) <= $imsUnix ) {
HttpStatus::header( 304 );
HttpStatus::header( 304 );
return;
}
}