Fix issues found by MediaWiki.WhiteSpace.SpaceyParenthesis sniff.
Bug: T102617
Change-Id: Iec7f71e64081659fba373ec20d9d2006306a98f4
53 files changed:
-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.
/**
* This file does not hold any code. It is only there so we can generate
* the doxygen documentation main page.
HttpStatus::header( $n );
}
HttpStatus::header( $n );
}
- header ( "Content-Type: " . $this->mContentType );
+ header( "Content-Type: " . $this->mContentType );
if ( $this->mLastModified ) {
if ( $this->mLastModified ) {
- header ( "Last-Modified: " . $this->mLastModified );
+ header( "Last-Modified: " . $this->mLastModified );
- 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 ) {
}
if ( $this->mCacheDuration ) {
} else {
# Let the client do the caching. Cache is not purged.
} 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
"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
- header ( "Vary: " . $this->mVary );
+ header( "Vary: " . $this->mVary );
$blocks = array();
foreach ( $rows as $row ) {
$block = self::newFromRow( $row );
$blocks = array();
foreach ( $rows as $row ) {
$block = self::newFromRow( $row );
- if ( !$block->deleteIfExpired() ) {
+ if ( !$block->deleteIfExpired() ) {
'category' => array( 'LEFT JOIN', array(
'cat_title = page_title',
'page_namespace' => NS_CATEGORY
'category' => array( 'LEFT JOIN', array(
'cat_title = page_title',
'page_namespace' => NS_CATEGORY
}
if ( in_array( 'escape', $options, true ) ) {
}
if ( in_array( 'escape', $options, true ) ) {
- $string = htmlspecialchars ( $string );
+ $string = htmlspecialchars( $string );
} elseif ( in_array( 'escapenoentities', $options, true ) ) {
$string = Sanitizer::escapeHtmlAllowEntities( $string );
}
} elseif ( in_array( 'escapenoentities', $options, true ) ) {
$string = Sanitizer::escapeHtmlAllowEntities( $string );
}
$useLogPipe = false;
if ( is_executable( '/bin/bash' ) ) {
$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'] ) ) {
if ( isset( $limits['walltime'] ) ) {
$wallTime = intval( $limits['walltime'] );
} elseif ( isset( $limits['time'] ) ) {
} else {
$wallTime = intval( $wgMaxShellWallClockTime );
}
} 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" ) . ' ' .
if ( $time > 0 || $mem > 0 || $filesize > 0 || $wallTime > 0 ) {
$cmd = '/bin/bash ' . escapeshellarg( "$IP/includes/limit.sh" ) . ' ' .
} else {
$wgResourceLoaderMaxQueryLength = 2000;
}
} else {
$wgResourceLoaderMaxQueryLength = 2000;
}
- unset($suhosinMaxValueLength);
+ unset( $suhosinMaxValueLength );
}
// Blacklisted file extensions shouldn't appear on the "allowed" list
}
// 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();
if ( $wgInvalidateCacheOnLocalSettingsChange ) {
MediaWiki\suppressWarnings();
) {
if ( !is_array( $info ) ) {
if ( $sendErrors ) {
) {
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 );
header( 'Cache-Control: no-cache' );
header( 'Content-Type: text/html; charset=utf-8' );
$encFile = htmlspecialchars( $path );
$titleObj->getNextRevisionID( $undoafterRev->getID() ) == $params['undo']
) {
$params['summary'] = wfMessage( 'undo-summary' )
$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();
!isset( $prop['jsconfigvars'] ) && !isset( $prop['encodedjsconfigvars'] ) ) {
$this->setWarning( "Property 'modules' was set but not 'jsconfigvars' " .
"or 'encodedjsconfigvars'. Configuration variables are necessary " .
!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." );
!isset( $prop['jsconfigvars'] ) && !isset( $prop['encodedjsconfigvars'] ) ) {
$this->setWarning( "Property 'modules' was set but not 'jsconfigvars' " .
"or 'encodedjsconfigvars'. Configuration variables are necessary " .
!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'] ) ) {
}
if ( isset( $prop['indicators'] ) ) {
// Add item to results and see whether it fits
$fit = $apiResult->addValue(
// 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() ),
} elseif ( $channel === 'profileoutput' ) {
// Legacy wfLogProfilingData formatitng
$forward = '';
} 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'] ) ) {
$forward = " forwarded for {$context['forwarded_for']}";
}
if ( isset( $context['client_ip'] ) ) {
$key = $title->quickUserCan( 'edit', $user ) ? 'editold' : 'viewsourceold';
$msg = $this->msg( $key )->escaped();
$editLink = $this->msg( 'parentheses' )->rawParams(
$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' ),
$header .= ' ' . Html::rawElement(
'span',
array( 'class' => 'mw-diff-edit' ),
array( 'addField', 'mwuser', 'user_password_expires', 'patch-user_password_expires.sql' ),
// 1.24
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' ),
// 1.25
array( 'dropTable', 'hitcounter' ),
$inComment = false;
$multiline = false;
$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] : '';
switch ( $str[$idx] ) {
case '"':
$lookBehind = ( $idx - 1 >= 0 ) ? $str[$idx - 1] : '';
$len = unpack( 'Nlength/Noffset', substr( $content, 32, 8 ) );
if ( !$len || $len['length'] < 4 || $len['offset'] < 0 || $len['offset'] > $len['length'] ) {
$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.' );
'-' => '',
' ' => '',
'x' => 'X',
'-' => '',
' ' => '',
'x' => 'X',
$titleObj = SpecialPage::getTitleFor( 'Booksources', $num );
return '<a href="' .
htmlspecialchars( $titleObj->getLocalURL() ) .
$titleObj = SpecialPage::getTitleFor( 'Booksources', $num );
return '<a href="' .
htmlspecialchars( $titleObj->getLocalURL() ) .
# 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
# 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.
# 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.
function wfGetRusage() {
if ( !function_exists( 'getrusage' ) ) {
return false;
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 */ );
return getrusage( 2 /* RUSAGE_THREAD */ );
} else {
return getrusage( 0 /* RUSAGE_SELF */ );
}
// calc by how much to extend existing snippets
}
// 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 ) {
}
foreach ( $snippets as $index => $line ) {
array( 'DeadendPagesPage', 'Deadendpages' ),
array( 'DoubleRedirectsPage', 'DoubleRedirects' ),
array( 'FileDuplicateSearchPage', 'FileDuplicateSearch' ),
array( 'DeadendPagesPage', 'Deadendpages' ),
array( 'DoubleRedirectsPage', 'DoubleRedirects' ),
array( 'FileDuplicateSearchPage', 'FileDuplicateSearch' ),
- array( 'ListDuplicatedFilesPage', 'ListDuplicatedFiles'),
+ array( 'ListDuplicatedFilesPage', 'ListDuplicatedFiles' ),
array( 'LinkSearchPage', 'LinkSearch' ),
array( 'ListredirectsPage', 'Listredirects' ),
array( 'LonelyPagesPage', 'Lonelypages' ),
array( 'LinkSearchPage', 'LinkSearch' ),
array( 'ListredirectsPage', 'Listredirects' ),
array( 'LonelyPagesPage', 'Lonelypages' ),
// 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.
// 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() {
}
private function plainQUnit() {
'mw-mediastats-table-' . strtolower( $mediaType ),
'sortable',
'wikitable'
'mw-mediastats-table-' . strtolower( $mediaType ),
'sortable',
'wikitable'
)
);
$this->getOutput()->addHTML( $this->getTableHeaderRow() );
)
);
$this->getOutput()->addHTML( $this->getTableHeaderRow() );
array( 'class' => array(
'mw-mediastats-mediatype',
'mw-mediastats-mediatype-' . strtolower( $mediaType )
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,
// for grep
// mediastatistics-header-unknown, mediastatistics-header-bitmap,
// mediastatistics-header-drawing, mediastatistics-header-audio,
if ( $remove ) {
foreach ( $remove as $index => $group ) {
if ( !$user->removeGroup( $group ) ) {
if ( $remove ) {
foreach ( $remove as $index => $group ) {
if ( !$user->removeGroup( $group ) ) {
- unset($remove[$index]);
+ unset( $remove[$index] );
}
}
$newGroups = array_diff( $newGroups, $remove );
}
}
$newGroups = array_diff( $newGroups, $remove );
if ( $add ) {
foreach ( $add as $index => $group ) {
if ( !$user->addGroup( $group ) ) {
if ( $add ) {
foreach ( $add as $index => $group ) {
if ( !$user->addGroup( $group ) ) {
}
}
$newGroups = array_merge( $newGroups, $add );
}
}
$newGroups = array_merge( $newGroups, $add );
case 'xmn':
$usedHijriMonth = true;
if ( !$hijri ) {
case 'xmn':
$usedHijriMonth = true;
if ( !$hijri ) {
- $hijri = self::tsToHijri ( $ts );
+ $hijri = self::tsToHijri( $ts );
}
$num = $hijri[1];
break;
}
$num = $hijri[1];
break;
// the string does not have any number part. Eg: .12345
return $sign . $groupedNumber;
}
// 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 );
while ( $start > 0 ) {
$match = $matches[0][$numMatches - 1];
$matchLen = strlen( $match );
*/
function iconv( $in, $out, $string ) {
if ( strcasecmp( $in, 'x' ) == 0 && strcasecmp( $out, 'utf-8' ) == 0 ) {
*/
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 ) {
'/([cghjsu]x?)((?:xx)*)(?!x)/i',
array( $this, 'strrtxuCallback' ), $string );
} elseif ( strcasecmp( $in, 'UTF-8' ) == 0 && strcasecmp( $out, 'x' ) == 0 ) {
- $tokens = explode ( ' ', $str );
+ $tokens = explode( ' ', $str );
foreach ( $tokens as $item ) {
if ( !is_numeric( $item ) ) {
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;
list( $yyyy, $mm, $dd ) = explode( '-', $item );
$final .= ' ' . $this->date( "{$yyyy}{$mm}{$dd}000000" );
continue;
function convertGrammar( $word, $case ) {
$lord = strtolower( $word );
$gender = 'm'; // Nuutnaarel // default
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] ) ) {
$gender = 'n'; // Dat xyz-wiki
}
if ( isset( self::$familygender[$lord] ) ) {
$this->json[$realName] = $out;
}
$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 );
$keys = array_keys( $value );
$this->json['type'] = $keys[0];
$values = array_values( $value );
$this->error( "$path is not a valid JSON file.", 1 );
}
if ( !isset( $data->manifest_version ) ) {
$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;
}
// For backwards-compatability assume 1
$data->manifest_version = 1;
}
. ExtensionRegistry::MANIFEST_VERSION . "\n" );
}
$retriever = new JsonSchema\Uri\UriRetriever();
. 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 );
$validator = new JsonSchema\Validator();
$validator->check( $data, $schema );
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( '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( '',
array( null, 'http://*.test.com', 'http://www.test.com' ),
array( 'mailto:', 'name@mail.test123.com', 'mailto:name@mail.test123.com' ),
array( '',
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( '', '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
//
// The following only work in PHP >= 5.3.7, due to a bug in parse_url which eats
array( 'http://*.test.*' ),
array( 'http://*test.com' ),
array( 'https://*' ),
array( 'http://*.test.*' ),
array( 'http://*test.com' ),
array( 'https://*' ),
- array( '*://test.com'),
+ array( '*://test.com' ),
array( 'mailto:name:pass@t*est.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=*' ),
);
array( 'test.com/*/index' ),
array( 'test.com/dir/index?arg=*' ),
);
WikiPage::factory( $oldTitle )->getRevision()
);
$this->assertNotNull(
WikiPage::factory( $oldTitle )->getRevision()
);
$this->assertNotNull(
- WikiPage::factory( $newTitle)->getRevision()
+ WikiPage::factory( $newTitle )->getRevision()
'test.foo' => new ResourceLoaderTestModule( array(
'script' => 'mw.test.foo( { a: true } );',
'styles' => '.mw-test-foo { content: "style"; }',
'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.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.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.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.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.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.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',
'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
) );
$links = $method->invokeArgs( $out, $args );
// Strip comments to avoid variation due to wgDBname in WikiID and cache key
* MessageBlobStore that doesn't do anything
*/
class NullMessageBlobStore extends MessageBlobStore {
* MessageBlobStore that doesn't do anything
*/
class NullMessageBlobStore extends MessageBlobStore {
- public function get ( ResourceLoader $resourceLoader, $modules, $lang ) {
+ public function get( ResourceLoader $resourceLoader, $modules, $lang ) {
- public function insertMessageBlob ( $name, ResourceLoaderModule $module, $lang ) {
+ public function insertMessageBlob( $name, ResourceLoaderModule $module, $lang ) {
- public function updateModule ( $name, ResourceLoaderModule $module, $lang ) {
+ public function updateModule( $name, ResourceLoaderModule $module, $lang ) {
- public function updateMessage ( $key ) {
+ public function updateMessage( $key ) {
}
public function clear() {
}
}
public function clear() {
}
);
$status = new Status();
);
$status = new Status();
- $status->warning( new Message( 'fooBar!', array( 'foo', 'bar' ) ) );
+ $status->warning( new Message( 'fooBar!', array( 'foo', 'bar' ) ) );
$testCases['1MessageWarning'] = array(
$status,
"<fooBar!>",
$testCases['1MessageWarning'] = array(
$status,
"<fooBar!>",
// );
$status = new Status();
// );
$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' ),
$testCases['1MessageWarning'] = array(
$status,
array( 'foo', 'bar' ),
* @expectedException UsageException
* @expectedExceptionMessage The token parameter must be set
*/
* @expectedException UsageException
* @expectedExceptionMessage The token parameter must be set
*/
- public function testBlockingActionWithNoToken( ) {
+ public function testBlockingActionWithNoToken() {
$this->doApiRequest(
array(
'action' => 'block',
$this->doApiRequest(
array(
'action' => 'block',
'section' => 'new',
'text' => 'test',
'summary' => 'header',
'section' => 'new',
'text' => 'test',
'summary' => 'header',
$this->assertEquals( 'Success', $re['edit']['result'] );
// Check the page text is correct
$this->assertEquals( 'Success', $re['edit']['result'] );
// Check the page text is correct
'section' => 'new',
'text' => 'test',
'summary' => 'header',
'section' => 'new',
'text' => 'test',
'summary' => 'header',
$this->assertEquals( 'Success', $re2['edit']['result'] );
$text = WikiPage::factory( Title::newFromText( $name ) )
$this->assertEquals( 'Success', $re2['edit']['result'] );
$text = WikiPage::factory( Title::newFromText( $name ) )
/**
* @expectedException UsageException
*/
/**
* @expectedException UsageException
*/
- public function testWithNoToken( ) {
+ public function testWithNoToken() {
$this->doApiRequest(
array(
'action' => 'unblock',
$this->doApiRequest(
array(
'action' => 'unblock',
public function testGet() {
$conf = new HashConfig( array(
'one' => '1',
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' );
$this->assertEquals( '1', $conf->get( 'one' ) );
$this->setExpectedException( 'ConfigException', 'HashConfig::get: undefined option' );
$conf->get( 'two' );
'<tr><th>0</th><td class="value">"bar"</td></tr></tbody></table>'
),
array(
'<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">"' .
'<script>alert("evil!")</script>"' .
'</td></tr></tbody></table>',
'<table class="mw-json"><tbody><tr><th>0</th><td class="value">"' .
'<script>alert("evil!")</script>"' .
'</td></tr></tbody></table>',
array( 'Tables_in_' => 'view2' ),
array( 'Tables_in_' => 'myview' ),
false # no more rows
array( 'Tables_in_' => 'view2' ),
array( 'Tables_in_' => 'myview' ),
false # no more rows
$otherTestCases = array();
$otherTestCases[] = array(
$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(
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 ),
array(
array( 'action' => 'add', 'new' => 'a1', 'newline' => 1 ),
array( 'action' => 'add', 'new' => 'a2', 'newline' => 2 ),
$this->setMwGlobals( array( 'wgLogExceptionBacktrace' => true ) );
$json = json_decode(
$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'"
);
$this->assertObjectHasAttribute( $key, $json,
"JSON serialized exception is missing key '$key'"
array(),
array( 1 => 1 ),
array( 1 ),
array(),
array( 1 => 1 ),
array( 1 ),
*/
protected function getXhprofFixture( array $opts = array() ) {
$xhprof = new Xhprof( $opts );
*/
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,
),
'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,
),
'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,
),
'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,
),
'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,
),
'ct' => 1,
'wt' => 8,
'cpu' => 10,
'mu' => 768,
'pmu' => 392,
),
'ct' => 1,
'wt' => 353,
'cpu' => 351,
'ct' => 1,
'wt' => 353,
'cpu' => 351,
*/
protected function assertArrayStructure( $struct, $actual, $label = null ) {
$this->assertInternalType( 'array', $actual, $label );
*/
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] );
foreach ( $struct as $key => $type ) {
$this->assertArrayHasKey( $key, $actual );
$this->assertInternalType( $type, $actual[$key] );
$key = wfRandomString();
for ( $i=0; $i<3; ++$i ) {
$value = wfRandomString();
$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 );
}
$this->assertEquals( $this->cache->get( $key ), $value );
}
* @covers ResourceLoaderFileModule::getStyles
* @covers ResourceLoaderFileModule::getStyleFiles
*/
* @covers ResourceLoaderFileModule::getStyles
* @covers ResourceLoaderFileModule::getStyleFiles
*/
- public function testMixedCssAnnotations( ) {
+ public function testMixedCssAnnotations() {
$basePath = __DIR__ . '/../../data/css';
$testModule = new ResourceLoaderFileModule( array(
'localBasePath' => $basePath,
$basePath = __DIR__ . '/../../data/css';
$testModule = new ResourceLoaderFileModule( array(
'localBasePath' => $basePath,
},
),
'wgResourceLoaderLESSImportPaths' => array(
},
),
'wgResourceLoaderLESSImportPaths' => array(
- dirname( dirname( __DIR__ ) ) . '/data/less/common',
+ dirname( dirname( __DIR__ ) ) . '/data/less/common',
),
'wgResourceLoaderLESSVars' => array(
'foo' => '2px',
),
'wgResourceLoaderLESSVars' => array(
'foo' => '2px',
$this->assertEquals( $expectedText, $title->getText() );
}
$this->assertEquals( $expectedText, $title->getText() );
}
- public function testUnknownNamespaceCheck( ) {
+ public function testUnknownNamespaceCheck() {
$title = new ForeignTitle( null, 'this', 'that' );
$this->assertEquals( false, $title->isNamespaceIdKnown() );
$title = new ForeignTitle( null, 'this', 'that' );
$this->assertEquals( false, $title->isNamespaceIdKnown() );
$this->assertEquals( 'that', $title->getText() );
}
$this->assertEquals( 'that', $title->getText() );
}
- public function testUnknownNamespaceError( ) {
+ public function testUnknownNamespaceError() {
$this->setExpectedException( 'MWException' );
$title = new ForeignTitle( null, 'this', 'that' );
$title->getNamespaceId();
$this->setExpectedException( 'MWException' );
$title = new ForeignTitle( null, 'this', 'that' );
$title->getNamespaceId();
function ( TitleValue $title ) {
return str_replace( '_', ' ', "$title" );
}
function ( TitleValue $title ) {
return str_replace( '_', ' ', "$title" );
}
$renderer = new MediaWikiPageLinkRenderer( $formatter, '/' );
$actual = $renderer->renderWikitextLink( $title, $text );
$renderer = new MediaWikiPageLinkRenderer( $formatter, '/' );
$actual = $renderer->renderWikitextLink( $title, $text );
public static function provideNumber() {
return array(
public static function provideNumber() {
return array(
- array( '1.234.567', '1234567'),
+ array( '1.234.567', '1234567' ),
array( '-12,89', -12.89 ),
);
}
array( '-12,89', -12.89 ),
);
}
*/
function testBufferSizeSetting( $expected, $size, $msg ) {
$dumper = new TextPassDumperAccessor( array( "--buffersize=" . $size ) );
*/
function testBufferSizeSetting( $expected, $size, $msg ) {
$dumper = new TextPassDumperAccessor( array( "--buffersize=" . $size ) );
- $this->assertEquals( $expected, $dumper->getBufferSize(), $msg);
+ $this->assertEquals( $expected, $dumper->getBufferSize(), $msg );
* @throws MWException
*/
public function unleash( &$parserTest ) {
* @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" );
}
throw new MWException( __METHOD__ . " must be passed an instance of ParserTest or "
. "NewParserTest classes\n" );
}
$imsUnix = strtotime( $imsString );
MediaWiki\restoreWarnings();
if ( wfTimestamp( TS_UNIX, $img->getTimestamp() ) <= $imsUnix ) {
$imsUnix = strtotime( $imsString );
MediaWiki\restoreWarnings();
if ( wfTimestamp( TS_UNIX, $img->getTimestamp() ) <= $imsUnix ) {
- HttpStatus::header( 304 );
+ HttpStatus::header( 304 );