Simplify strings in PHP code

Change-Id: I481810ade68b0c5a5be21d22e2a107646d5813e6
This commit is contained in:
Fomafix 2019-03-01 22:15:22 +01:00
parent 9f9f8536e2
commit 204126e7c7
10 changed files with 15 additions and 15 deletions

View file

@ -213,7 +213,7 @@ class Html {
// Silly XML.
return substr( $start, 0, -1 ) . '/>';
} else {
return "$start$contents" . self::closeElement( $element );
return $start . $contents . self::closeElement( $element );
}
}
@ -973,7 +973,7 @@ class Html {
if ( $isXHTML ) { // XHTML5
// XML MIME-typed markup should have an xml header.
// However a DOCTYPE is not needed.
$ret .= "<?xml version=\"1.0\" encoding=\"UTF-8\" ?" . ">\n";
$ret .= "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
// Add the standard xmlns
$attribs['xmlns'] = 'http://www.w3.org/1999/xhtml';

View file

@ -116,7 +116,7 @@ class RawAction extends FormlessAction {
$elevatedText = $elevated ? 'by elevated ' : '';
$log = LoggerFactory::getInstance( "security" );
$log->warning(
"Unsafe JS/CSS/Json $elevatedText" . "load - {user} loaded {title} with {ctype}",
"Unsafe JS/CSS/Json {$elevatedText}load - {user} loaded {title} with {ctype}",
[
'user' => $this->getUser()->getName(),
'title' => $title->getPrefixedDBKey(),

View file

@ -1184,8 +1184,8 @@ abstract class Installer {
public function dirIsExecutable( $dir, $url ) {
$scriptTypes = [
'php' => [
"<?php echo 'ex' . 'ec';",
"#!/var/env php\n<?php echo 'ex' . 'ec';",
"<?php echo 'exec';",
"#!/var/env php\n<?php echo 'exec';",
],
];

View file

@ -1029,7 +1029,7 @@ class Parser {
$matches = [];
$taglist = implode( '|', $elements );
$start = "/<($taglist)(\\s+[^>]*?|\\s*?)(\/?" . ">)|<(!--)/i";
$start = "/<($taglist)(\\s+[^>]*?|\\s*?)(\/?>)|<(!--)/i";
while ( $text != '' ) {
$p = preg_split( $start, $text, 2, PREG_SPLIT_DELIM_CAPTURE );

View file

@ -530,14 +530,14 @@ abstract class Skin extends ContextSource {
$colon = $this->msg( 'colon-separator' )->escaped();
if ( !empty( $allCats['normal'] ) ) {
$t = $embed . implode( "{$pop}{$embed}", $allCats['normal'] ) . $pop;
$t = $embed . implode( $pop . $embed, $allCats['normal'] ) . $pop;
$msg = $this->msg( 'pagecategories' )->numParams( count( $allCats['normal'] ) )->escaped();
$linkPage = $this->msg( 'pagecategorieslink' )->inContentLanguage()->text();
$title = Title::newFromText( $linkPage );
$link = $title ? Linker::link( $title, $msg ) : $msg;
$s .= '<div id="mw-normal-catlinks" class="mw-normal-catlinks">' .
$link . $colon . '<ul>' . $t . '</ul>' . '</div>';
$link . $colon . '<ul>' . $t . '</ul></div>';
}
# Hidden categories
@ -552,7 +552,7 @@ abstract class Skin extends ContextSource {
$s .= "<div id=\"mw-hidden-catlinks\" class=\"mw-hidden-catlinks$class\">" .
$this->msg( 'hidden-categories' )->numParams( count( $allCats['hidden'] ) )->escaped() .
$colon . '<ul>' . $embed . implode( "{$pop}{$embed}", $allCats['hidden'] ) . $pop . '</ul>' .
$colon . '<ul>' . $embed . implode( $pop . $embed, $allCats['hidden'] ) . $pop . '</ul>' .
'</div>';
}

View file

@ -185,7 +185,7 @@ if ( $queue ) {
fwrite( STDERR, "\n" );
$s =
"<" . "?php\n" .
"<?php\n" .
"## This file is generated by mergeMessageFileList.php. Do not edit it directly.\n\n" .
"if ( defined( 'MW_NO_EXTENSION_MESSAGES' ) ) return;\n\n" .
'$wgExtensionMessagesFiles = ' . var_export( $wgExtensionMessagesFiles, true ) . ";\n\n" .

View file

@ -78,7 +78,7 @@ class JobTest extends MediaWikiTestCase {
'{"file":"db1023-bin.001288","pos":"308257743","asOfTime":' .
// Embed dynamically because TestSetup sets serialize_precision=17
// which, in PHP 7.1 and 7.2, produces 1457521464.3814001 instead
json_encode( 1457521464.3814 ) . '} ' . 'triggeredRecursive=1 ' .
json_encode( 1457521464.3814 ) . '} triggeredRecursive=1 ' .
$requestId
],
];

View file

@ -1853,7 +1853,7 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
} catch ( DBUnexpectedError $ex ) {
$this->assertSame(
'Invalid atomic section ended (got ' . __METHOD__ . ' but expected ' .
__METHOD__ . 'X' . ').',
__METHOD__ . 'X).',
$ex->getMessage()
);
}

View file

@ -31,7 +31,7 @@ class PrefixingStatsdDataFactoryProxyTest extends PHPUnit\Framework\TestCase {
);
$innerFactory->expects( $this->once() )
->method( $method )
->with( 'testprefix.' . 'metricname' );
->with( 'testprefix.metricname' );
$proxy = new PrefixingStatsdDataFactoryProxy( $innerFactory, 'testprefix' );
// 1,2,3,4 simply makes sure we provide enough parameters, without caring what they are
@ -48,7 +48,7 @@ class PrefixingStatsdDataFactoryProxyTest extends PHPUnit\Framework\TestCase {
);
$innerFactory->expects( $this->once() )
->method( $method )
->with( 'testprefix.' . 'metricname' );
->with( 'testprefix.metricname' );
$proxy = new PrefixingStatsdDataFactoryProxy( $innerFactory, 'testprefix...' );
// 1,2,3,4 simply makes sure we provide enough parameters, without caring what they are

View file

@ -51,7 +51,7 @@ class LinkRendererTest extends MediaWikiLangTestCase {
// Query added
$this->assertEquals(
'<a href="/w/index.php?title=Foobar&amp;foo=bar" ' . 'title="Foobar">Foobar</a>',
'<a href="/w/index.php?title=Foobar&amp;foo=bar" title="Foobar">Foobar</a>',
$linkRenderer->makeKnownLink( $target, null, [], [ 'foo' => 'bar' ] )
);