Siebrand has uploaded a new change for review. https://gerrit.wikimedia.org/r/274888
Change subject: Safely use single quotes ...................................................................... Safely use single quotes Change-Id: I02fa1edca8b3ef76a69f44e8b42f64d5afc1a69b --- M Translate.php M api/ApiTranslateSandbox.php M ffs/MediaWikiComplexMessages.php M messagegroups/RecentMessageGroup.php M scripts/fallbacks-graph.php M scripts/groupStatistics.php M scripts/migrate-schema2.php M scripts/mwcore-export.php M scripts/plural-comparison.php M scripts/sync-group.php M scripts/ttmserver-export.php M scripts/yaml-tests.php M specials/SpecialPagePreparation.php M specials/SpecialTranslations.php M stringmangler/StringMatcher.php M tag/SpecialPageTranslation.php M tag/TranslateRenderJob.php M tests/phpunit/MessageGroupBaseTest.php M tests/phpunit/ResourcesOrderTest.php M tests/phpunit/ffs/AppleFFSTest.php M translationaids/GettextDocumentationAid.php M translationaids/InsertablesAid.php M translationaids/SupportAid.php M translationaids/UpdatedDefinitionAid.php M ttmserver/TTMServer.php M utils/JsSelectToInput.php M utils/MemProfile.php M utils/StatsTable.php M utils/TranslateSandbox.php M utils/TranslateYaml.php M webservices/ApertiumWebService.php 31 files changed, 81 insertions(+), 82 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate refs/changes/88/274888/1 diff --git a/Translate.php b/Translate.php index 52355cb..10a9e7a 100644 --- a/Translate.php +++ b/Translate.php @@ -50,11 +50,11 @@ * @cond file_level_code */ -$wgMessagesDirs['PageTranslation'] = __DIR__ . "/i18n/pagetranslation"; -$wgMessagesDirs['Translate'] = __DIR__ . "/i18n/core"; -$wgMessagesDirs['TranslateSearch'] = __DIR__ . "/i18n/search"; -$wgMessagesDirs['TranslateSandbox'] = __DIR__ . "/i18n/sandbox"; -$wgMessagesDirs['TranslateApi'] = __DIR__ . "/i18n/api"; +$wgMessagesDirs['PageTranslation'] = __DIR__ . '/i18n/pagetranslation'; +$wgMessagesDirs['Translate'] = __DIR__ . '/i18n/core'; +$wgMessagesDirs['TranslateSearch'] = __DIR__ . '/i18n/search'; +$wgMessagesDirs['TranslateSandbox'] = __DIR__ . '/i18n/sandbox'; +$wgMessagesDirs['TranslateApi'] = __DIR__ . '/i18n/api'; $wgExtensionMessagesFiles['TranslateAlias'] = "$dir/Translate.alias.php"; $wgExtensionMessagesFiles['TranslateMagic'] = "$dir/Translate.i18n.magic.php"; diff --git a/api/ApiTranslateSandbox.php b/api/ApiTranslateSandbox.php index 46cf168..fc75c75 100644 --- a/api/ApiTranslateSandbox.php +++ b/api/ApiTranslateSandbox.php @@ -47,22 +47,22 @@ $username = $params['username']; if ( User::getCanonicalName( $username, 'creatable' ) === false ) { - $this->dieUsage( "User name is not acceptable", 'invalidusername' ); + $this->dieUsage( 'User name is not acceptable', 'invalidusername' ); } $user = User::newFromName( $username ); if ( $user->getID() !== 0 ) { - $this->dieUsage( "User name is in use", 'nonfreeusername' ); + $this->dieUsage( 'User name is in use', 'nonfreeusername' ); } $password = $params['password']; if ( !$user->isValidPassword( $password ) ) { - $this->dieUsage( "Password is not acceptable", 'invalidpassword' ); + $this->dieUsage( 'Password is not acceptable', 'invalidpassword' ); } $email = $params['email']; if ( !Sanitizer::validateEmail( $email ) ) { - $this->dieUsage( "Email is not acceptable", 'invalidemail' ); + $this->dieUsage( 'Email is not acceptable', 'invalidemail' ); } $user = TranslateSandbox::addUser( $username, $email, $password ); diff --git a/ffs/MediaWikiComplexMessages.php b/ffs/MediaWikiComplexMessages.php index d10d69f..c7aced9 100644 --- a/ffs/MediaWikiComplexMessages.php +++ b/ffs/MediaWikiComplexMessages.php @@ -627,7 +627,7 @@ public function highlight( $key, $values ) { if ( count( $values ) ) { if ( !isset( $values[0] ) ) { - throw new MWException( "Something missing from values: " . + throw new MWException( 'Something missing from values: ' . print_r( $values, true ) ); } @@ -762,7 +762,7 @@ if ( count( $values ) > 1 ) { $link = Xml::element( 'a', array( 'href' => "#mw-sp-magic-$key" ), $key ); $errors[] = "Namespace $link can have only one translation. Replace the " . - "translation with a new one, and notify staff about the change."; + 'translation with a new one, and notify staff about the change.'; } } } diff --git a/messagegroups/RecentMessageGroup.php b/messagegroups/RecentMessageGroup.php index 0de662b..f3aaf46 100644 --- a/messagegroups/RecentMessageGroup.php +++ b/messagegroups/RecentMessageGroup.php @@ -87,7 +87,7 @@ public function getDefinitions() { if ( !$this->language ) { - throw new MWException( "Language not set" ); + throw new MWException( 'Language not set' ); } $db = wfGetDB( DB_SLAVE ); diff --git a/scripts/fallbacks-graph.php b/scripts/fallbacks-graph.php index 2af3bfc..25a617f 100644 --- a/scripts/fallbacks-graph.php +++ b/scripts/fallbacks-graph.php @@ -70,7 +70,7 @@ protected function createNode( $code ) { return Xml::openElement( 'node', array( 'id' => $code ) ) - . Xml::openElement( 'data', array( 'key' => "code" ) ) + . Xml::openElement( 'data', array( 'key' => 'code' ) ) . Xml::openElement( 'y:Shpapenode' ) . Xml::element( 'y:NodeLabel', array(), $code ) . Xml::closeElement( 'y:Shpapenode' ) diff --git a/scripts/groupStatistics.php b/scripts/groupStatistics.php index 657f471..e4fc760 100644 --- a/scripts/groupStatistics.php +++ b/scripts/groupStatistics.php @@ -630,9 +630,9 @@ $out->blockstart(); - $out->element( $l10n ? "{{int:translate-gs-continent}}" : 'Continent', true ); - $out->element( $l10n ? "{{int:translate-gs-count}}" : 'Count', true ); - $out->element( $l10n ? "{{int:translate-gs-avgscore}}" : 'Avg. score', true ); + $out->element( $l10n ? '{{int:translate-gs-continent}}' : 'Continent', true ); + $out->element( $l10n ? '{{int:translate-gs-count}}' : 'Count', true ); + $out->element( $l10n ? '{{int:translate-gs-avgscore}}' : 'Avg. score', true ); $out->blockend(); @@ -644,9 +644,9 @@ $out->blockstart(); if ( $key == 'multiple' ) { - $out->element( $l10n ? "{{int:translate-gs-multiple}}" : 'Multiple' ); + $out->element( $l10n ? '{{int:translate-gs-multiple}}' : 'Multiple' ); } else { - $out->element( $l10n ? "{{int:timezoneregion-" . $key . "}}" : ucfirst( $key ) ); + $out->element( $l10n ? '{{int:timezoneregion-' . $key . '}}' : ucfirst( $key ) ); } $out->element( $values[0] ); $out->element( number_format( $values[1] / $values[0] ) ); @@ -658,7 +658,7 @@ } $out->blockstart(); - $out->element( $l10n ? "{{int:translate-gs-total}}" : 'Total' ); + $out->element( $l10n ? '{{int:translate-gs-total}}' : 'Total' ); $out->element( $totals[0] ); $out->element( number_format( $totals[1] / $totals[0] ) ); $out->blockend(); diff --git a/scripts/migrate-schema2.php b/scripts/migrate-schema2.php index 02abd0b..f07b20b 100644 --- a/scripts/migrate-schema2.php +++ b/scripts/migrate-schema2.php @@ -40,7 +40,7 @@ } if ( $dbw->getType() !== 'mysql' ) { - $this->error( "This migration script only supports mysql. Please help " . + $this->error( 'This migration script only supports mysql. Please help ' . "us to write routine for {$dbw->getType()}.", 1 ); } diff --git a/scripts/mwcore-export.php b/scripts/mwcore-export.php index a857934..c879213 100644 --- a/scripts/mwcore-export.php +++ b/scripts/mwcore-export.php @@ -114,9 +114,9 @@ file_put_contents( $outFile, $data ); } else { $this->error( "Adding new entry to $outFile, please double check location." ); - $pos = strpos( $data, "*/" ); + $pos = strpos( $data, '*/' ); if ( $pos === false ) { - $this->error( ". FAILED! Totally new file? No header?" ); + $this->error( '. FAILED! Totally new file? No header?' ); } else { $pos += 3; } diff --git a/scripts/plural-comparison.php b/scripts/plural-comparison.php index 48aedcd..b9507ae 100644 --- a/scripts/plural-comparison.php +++ b/scripts/plural-comparison.php @@ -110,12 +110,12 @@ protected function loadPluralFile( $fileName ) { $doc = new DOMDocument; $doc->load( $fileName ); - $rulesets = $doc->getElementsByTagName( "pluralRules" ); + $rulesets = $doc->getElementsByTagName( 'pluralRules' ); $plurals = array(); foreach ( $rulesets as $ruleset ) { $codes = $ruleset->getAttribute( 'locales' ); $rules = array(); - $ruleElements = $ruleset->getElementsByTagName( "pluralRule" ); + $ruleElements = $ruleset->getElementsByTagName( 'pluralRule' ); foreach ( $ruleElements as $elt ) { $rules[] = $elt->nodeValue; } diff --git a/scripts/sync-group.php b/scripts/sync-group.php index 4fce997..33c8714 100644 --- a/scripts/sync-group.php +++ b/scripts/sync-group.php @@ -85,13 +85,13 @@ $groups = MessageGroups::getGroupsById( $groupIds ); if ( !count( $groups ) ) { - $this->error( "ESG2: No valid message groups identified.", 1 ); + $this->error( 'ESG2: No valid message groups identified.', 1 ); } $start = $this->getOption( 'start' ) ? strtotime( $this->getOption( 'start' ) ) : false; $end = $this->getOption( 'end' ) ? strtotime( $this->getOption( 'end' ) ) : false; - $this->output( "Conflict times: " . wfTimestamp( TS_ISO_8601, $start ) . " - " . + $this->output( 'Conflict times: ' . wfTimestamp( TS_ISO_8601, $start ) . ' - ' . wfTimestamp( TS_ISO_8601, $end ) . "\n" ); $codes = array_filter( array_map( 'trim', explode( ',', $this->getOption( 'lang' ) ) ) ); @@ -115,7 +115,7 @@ foreach ( $codes as $code ) { // No sync possible for unsupported language codes. if ( !in_array( $code, $supportedCodes ) ) { - $this->output( "Unsupported code " . $code . ": skipping.\n" ); + $this->output( 'Unsupported code ' . $code . ": skipping.\n" ); continue; } @@ -319,7 +319,7 @@ continue; } - $this->reportProgress( "Conflict in " . $this->color( 'bold', $page ) . "!", $page ); + $this->reportProgress( 'Conflict in ' . $this->color( 'bold', $page ) . '!', $page ); $iso = 'xnY-xnm-xnd"T"xnH:xni:xns'; $lang = RequestContext::getMain()->getLanguage(); @@ -350,10 +350,10 @@ if ( $changeTs ) { if ( $wikiTs > $startTs && $changeTs <= $endTs ) { - $this->reportProgress( " →Changed in wiki after export: IGNORE", $page ); + $this->reportProgress( ' →Changed in wiki after export: IGNORE', $page ); continue; } elseif ( !$wikiTs || ( $changeTs > $endTs && $wikiTs < $startTs ) ) { - $this->reportProgress( " →Changed in source after export: IMPORT", $page ); + $this->reportProgress( ' →Changed in source after export: IMPORT', $page ); $this->import( $title, $translation, @@ -367,14 +367,14 @@ continue; } - $this->reportProgress( " →Needs manual resolution", $page ); + $this->reportProgress( ' →Needs manual resolution', $page ); $this->reportProgress( "Source translation at $changeDate:", 'source' ); $this->reportProgress( $this->color( 'blue', $translation ), 'source' ); $this->reportProgress( "Wiki translation at $wikiDate:", 'translation' ); $this->reportProgress( $this->color( 'green', $current ), 'translation' ); do { - $this->reportProgress( "Resolution: [S]kip [I]mport [C]onflict: ", 'foo' ); + $this->reportProgress( 'Resolution: [S]kip [I]mport [C]onflict: ', 'foo' ); // @todo Find an elegant way to use Maintenance::readconsole(). $action = fgets( STDIN ); $action = strtoupper( trim( $action ) ); diff --git a/scripts/ttmserver-export.php b/scripts/ttmserver-export.php index cdec1e3..151ab37 100644 --- a/scripts/ttmserver-export.php +++ b/scripts/ttmserver-export.php @@ -51,9 +51,9 @@ } public function statusLine( $text, $channel = null ) { - $pid = sprintf( "%5s", getmypid() ); - $prefix = sprintf( "%6.2f", microtime( true ) - $this->start ); - $mem = sprintf( "%5.1fM", ( memory_get_usage( true ) / ( 1024 * 1024 ) ) ); + $pid = sprintf( '%5s', getmypid() ); + $prefix = sprintf( '%6.2f', microtime( true ) - $this->start ); + $mem = sprintf( '%5.1fM', ( memory_get_usage( true ) / ( 1024 * 1024 ) ) ); $this->output( "$pid $prefix $mem $text", $channel ); } @@ -63,7 +63,7 @@ // TTMServer is the id of the enabled-by-default instance $configKey = $this->getOption( 'ttmserver', 'TTMServer' ); if ( !isset( $wgTranslateTranslationServices[$configKey] ) ) { - $this->error( "Translation memory is not configured properly", 1 ); + $this->error( 'Translation memory is not configured properly', 1 ); } $config = $wgTranslateTranslationServices[$configKey]; diff --git a/scripts/yaml-tests.php b/scripts/yaml-tests.php index 905b8a7..ef72c06 100644 --- a/scripts/yaml-tests.php +++ b/scripts/yaml-tests.php @@ -67,7 +67,7 @@ $template = $document['TEMPLATE']; } else { if ( !isset( $document['BASIC']['id'] ) ) { - trigger_error( "No path ./BASIC/id (group id not defined) " . + trigger_error( 'No path ./BASIC/id (group id not defined) ' . "in yaml document located in $filename" ); continue; } diff --git a/specials/SpecialPagePreparation.php b/specials/SpecialPagePreparation.php index 4e91feb..fee092b 100644 --- a/specials/SpecialPagePreparation.php +++ b/specials/SpecialPagePreparation.php @@ -34,7 +34,7 @@ $out = ''; $diff = new DifferenceEngine( $this->getContext() ); - $diffHeader = $diff->addHeader( " ", $this->msg( 'pp-diff-old-header' )->escaped(), + $diffHeader = $diff->addHeader( ' ', $this->msg( 'pp-diff-old-header' )->escaped(), $this->msg( 'pp-diff-new-header' )->escaped() ); $out = <<<HTML diff --git a/specials/SpecialTranslations.php b/specials/SpecialTranslations.php index 80a7938..df787b3 100644 --- a/specials/SpecialTranslations.php +++ b/specials/SpecialTranslations.php @@ -120,8 +120,8 @@ <td class='mw-input'>" . $namespaces->getHTML() . ' ' . Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) . - "</td> - </tr>"; + '</td> + </tr>'; $out .= Xml::closeElement( 'table' ); $out .= Xml::closeElement( 'fieldset' ); $out .= Xml::closeElement( 'form' ); diff --git a/stringmangler/StringMatcher.php b/stringmangler/StringMatcher.php index 88c12c6..fb86e5d 100644 --- a/stringmangler/StringMatcher.php +++ b/stringmangler/StringMatcher.php @@ -118,7 +118,7 @@ } elseif ( $data === null ) { return $data; } else { - throw new MWException( __METHOD__ . ": Unsupported datatype" ); + throw new MWException( __METHOD__ . ': Unsupported datatype' ); } } @@ -130,7 +130,7 @@ } elseif ( $data === null ) { return $data; } else { - throw new MWException( __METHOD__ . ": Unsupported datatype" ); + throw new MWException( __METHOD__ . ': Unsupported datatype' ); } } diff --git a/tag/SpecialPageTranslation.php b/tag/SpecialPageTranslation.php index e471369..922b5ea 100644 --- a/tag/SpecialPageTranslation.php +++ b/tag/SpecialPageTranslation.php @@ -798,17 +798,17 @@ ); $this->getOutput()->addHTML( - "<table>" . - "<tr>" . + '<table>' . + '<tr>' . "<td class='mw-label'>$hLangs[0]</td>" . "<td class='mw-input'>$hLangs[1]$langSelector[1]</td>" . - "</tr>" . + '</tr>' . "<tr><td></td><td class='mw-inout'>$hForce</td></tr>" . - "<tr>" . + '<tr>' . "<td class='mw-label'>$hReason[0]</td>" . "<td class='mw-input'>$hReason[1]</td>" . - "</tr>" . - "</table>" + '</tr>' . + '</table>' ); } diff --git a/tag/TranslateRenderJob.php b/tag/TranslateRenderJob.php index 89736e7..d6295f3 100644 --- a/tag/TranslateRenderJob.php +++ b/tag/TranslateRenderJob.php @@ -43,7 +43,7 @@ if ( !$page ) { var_dump( $this->params ); var_dump( $title ); - throw new MWException( "Oops, this should not happen!" ); + throw new MWException( 'Oops, this should not happen!' ); } $group = $page->getMessageGroup(); diff --git a/tests/phpunit/MessageGroupBaseTest.php b/tests/phpunit/MessageGroupBaseTest.php index e7688ba..be2dfa5 100644 --- a/tests/phpunit/MessageGroupBaseTest.php +++ b/tests/phpunit/MessageGroupBaseTest.php @@ -31,7 +31,7 @@ $this->assertEquals( $this->groupConfiguration, $this->group->getConfiguration(), - "configuration should not change." + 'configuration should not change.' ); } @@ -39,7 +39,7 @@ $this->assertEquals( $this->groupConfiguration['BASIC']['id'], $this->group->getId(), - "id comes from config." + 'id comes from config.' ); } @@ -47,7 +47,7 @@ $this->assertEquals( 'en', $this->group->getSourceLanguage(), - "source language defaults to en." + 'source language defaults to en.' ); } @@ -55,7 +55,7 @@ $this->assertEquals( NS_MEDIAWIKI, $this->group->getNamespace(), - "should parse string namespace contant." + 'should parse string namespace contant.' ); } @@ -67,7 +67,7 @@ $this->assertEquals( NS_IMAGE, $this->group->getNamespace(), - "should parse integer namespace number." + 'should parse integer namespace number.' ); } @@ -79,7 +79,7 @@ $this->assertEquals( NS_IMAGE, $this->group->getNamespace(), - "should parse string namespace name." + 'should parse string namespace name.' ); } diff --git a/tests/phpunit/ResourcesOrderTest.php b/tests/phpunit/ResourcesOrderTest.php index cd7f3c2..0f26520 100644 --- a/tests/phpunit/ResourcesOrderTest.php +++ b/tests/phpunit/ResourcesOrderTest.php @@ -23,7 +23,7 @@ $this->assertEquals( array_keys( $sorted ), array_keys( $wgResourceModules ), - "Modules are defined in alphabetical order." + 'Modules are defined in alphabetical order.' ); } } diff --git a/tests/phpunit/ffs/AppleFFSTest.php b/tests/phpunit/ffs/AppleFFSTest.php index 6f5e7ea..778fde5 100644 --- a/tests/phpunit/ffs/AppleFFSTest.php +++ b/tests/phpunit/ffs/AppleFFSTest.php @@ -85,7 +85,7 @@ $reparsed = $ffs->readFromVariable( $outfile ); $this->assertSame( $parsed['MESSAGES'], $reparsed['MESSAGES'], - "Messages survive roundtrip through write and read" ); + 'Messages survive roundtrip through write and read' ); } public function rowValuesProvider() { diff --git a/translationaids/GettextDocumentationAid.php b/translationaids/GettextDocumentationAid.php index 08e0d09..3716dc0 100644 --- a/translationaids/GettextDocumentationAid.php +++ b/translationaids/GettextDocumentationAid.php @@ -21,12 +21,12 @@ // So $group can be different from $this->group $group = $this->handle->getGroup(); if ( !$group instanceof FileBasedMessageGroup ) { - throw new TranslationHelperException( "Not a Gettext group" ); + throw new TranslationHelperException( 'Not a Gettext group' ); } $ffs = $group->getFFS(); if ( !$ffs instanceof GettextFFS ) { - throw new TranslationHelperException( "Not a Gettext group" ); + throw new TranslationHelperException( 'Not a Gettext group' ); } global $wgContLang; diff --git a/translationaids/InsertablesAid.php b/translationaids/InsertablesAid.php index 65b36f8..3751ac3 100644 --- a/translationaids/InsertablesAid.php +++ b/translationaids/InsertablesAid.php @@ -25,14 +25,14 @@ // the message group class hierarche doesn't lend itself easily // to the user of interfaces for this purpose. if ( !method_exists( $group, 'getInsertablesSuggester' ) ) { - throw new TranslationHelperException( "Group does not have a suggester" ); + throw new TranslationHelperException( 'Group does not have a suggester' ); } $suggester = $group->getInsertablesSuggester(); // It is okay to return null suggester if ( !$suggester ) { - throw new TranslationHelperException( "Group does not have a suggester" ); + throw new TranslationHelperException( 'Group does not have a suggester' ); } $insertables = $suggester->getInsertables( $this->getDefinition() ); diff --git a/translationaids/SupportAid.php b/translationaids/SupportAid.php index 988fcf4..6c555b2 100644 --- a/translationaids/SupportAid.php +++ b/translationaids/SupportAid.php @@ -37,7 +37,7 @@ } elseif ( $wgTranslateSupportUrl ) { $config = $wgTranslateSupportUrl; } else { - throw new TranslationHelperException( "Support page not configured" ); + throw new TranslationHelperException( 'Support page not configured' ); } // Preprocess params @@ -54,12 +54,11 @@ } elseif ( isset( $config['page'] ) ) { $page = Title::newFromText( $config['page'] ); if ( !$page ) { - throw new TranslationHelperException( "Support page not configured properly" ); + throw new TranslationHelperException( 'Support page not configured properly' ); } return $page->getFullUrl( $params ); } else { - throw new TranslationHelperException( "Support page not configured properly" ); + throw new TranslationHelperException( 'Support page not configured properly' ); } } - } diff --git a/translationaids/UpdatedDefinitionAid.php b/translationaids/UpdatedDefinitionAid.php index 0b918f4..f146f15 100644 --- a/translationaids/UpdatedDefinitionAid.php +++ b/translationaids/UpdatedDefinitionAid.php @@ -28,7 +28,7 @@ $translationRevision = $db->selectField( 'revtag', 'rt_value', $conds, __METHOD__, $options ); if ( $translationRevision === false ) { - throw new TranslationHelperException( "No definition revision recorded" ); + throw new TranslationHelperException( 'No definition revision recorded' ); } $definitionTitle = Title::makeTitleSafe( @@ -37,20 +37,20 @@ ); if ( !$definitionTitle || !$definitionTitle->exists() ) { - throw new TranslationHelperException( "Definition page doesn't exist" ); + throw new TranslationHelperException( 'Definition page does not exist' ); } // Using newFromId instead of newFromTitle, because the page might have been renamed $oldrev = Revision::newFromId( $translationRevision ); if ( !$oldrev ) { - throw new TranslationHelperException( "Old definition version doesn't exist anymore" ); + throw new TranslationHelperException( 'Old definition version does not exist anymore' ); } $oldContent = $oldrev->getContent(); $newContent = $this->getDefinitionContent(); if ( !$oldContent ) { - throw new TranslationHelperException( "Old definition version doesn't exist anymore" ); + throw new TranslationHelperException( 'Old definition version does not exist anymore' ); } if ( !$oldContent instanceof WikitextContent || !$newContent instanceof WikitextContent ) { diff --git a/ttmserver/TTMServer.php b/ttmserver/TTMServer.php index d1cf443..f66a593 100644 --- a/ttmserver/TTMServer.php +++ b/ttmserver/TTMServer.php @@ -39,7 +39,7 @@ } } - throw new MWEXception( "TTMServer with no type" ); + throw new MWEXception( 'TTMServer with no type' ); } /** diff --git a/utils/JsSelectToInput.php b/utils/JsSelectToInput.php index 12bea5a..86c1e56 100644 --- a/utils/JsSelectToInput.php +++ b/utils/JsSelectToInput.php @@ -86,7 +86,7 @@ } if ( !$this->sourceId ) { - throw new MWException( "ID needs to be specified for the selector" ); + throw new MWException( 'ID needs to be specified for the selector' ); } } diff --git a/utils/MemProfile.php b/utils/MemProfile.php index 4d626d8..cc2aac3 100644 --- a/utils/MemProfile.php +++ b/utils/MemProfile.php @@ -31,7 +31,7 @@ $memF = $wgLang->formatNum( $mem ); $memRF = $wgLang->formatNum( $memR ); - $pad = str_repeat( ".", $wgMemStack ); + $pad = str_repeat( '.', $wgMemStack ); wfDebug( "$pad$a-IN: \t$memF\t\t$memRF\n" ); $wgMemStack++; } @@ -57,7 +57,7 @@ $memDF = $wgLang->formatNum( $memD ); $memRDF = $wgLang->formatNum( $memRD ); - $pad = str_repeat( ".", $wgMemStack - 1 ); + $pad = str_repeat( '.', $wgMemStack - 1 ); wfDebug( "$pad$a-OUT:\t$memF ($memDF)\t$memRF ($memRDF)\n" ); $wgMemStack--; } diff --git a/utils/StatsTable.php b/utils/StatsTable.php index a6d5a38..f95659b 100644 --- a/utils/StatsTable.php +++ b/utils/StatsTable.php @@ -62,7 +62,7 @@ } if ( $bgcolor ) { - $attributes['style'] = "background-color: #" . $bgcolor; + $attributes['style'] = 'background-color: #' . $bgcolor; $attributes['class'] = 'hover-color'; } @@ -147,7 +147,7 @@ // Create table header $out = Html::openElement( 'table', - array( 'class' => "statstable wikitable mw-sp-translate-table" ) + array( 'class' => 'statstable wikitable mw-sp-translate-table' ) ); $out .= "\n\t" . Html::openElement( 'thead' ); diff --git a/utils/TranslateSandbox.php b/utils/TranslateSandbox.php index 3c88a67..ec8f174 100644 --- a/utils/TranslateSandbox.php +++ b/utils/TranslateSandbox.php @@ -22,7 +22,7 @@ public static function addUser( $name, $email, $password ) { $user = User::newFromName( $name, 'creatable' ); if ( !$user instanceof User ) { - throw new MWException( "Invalid user name" ); + throw new MWException( 'Invalid user name' ); } $user->setEmail( $email ); @@ -55,7 +55,7 @@ $uid = $user->getId(); if ( $force !== 'force' && !self::isSandboxed( $user ) ) { - throw new MWException( "Not a sandboxed user" ); + throw new MWException( 'Not a sandboxed user' ); } // Delete from database @@ -109,7 +109,7 @@ global $wgTranslateSandboxPromotedGroup; if ( !self::isSandboxed( $user ) ) { - throw new MWException( "Not a sandboxed user" ); + throw new MWException( 'Not a sandboxed user' ); } $user->removeGroup( 'translate-sandboxed' ); diff --git a/utils/TranslateYaml.php b/utils/TranslateYaml.php index 2677cb0..2ef4a40 100644 --- a/utils/TranslateYaml.php +++ b/utils/TranslateYaml.php @@ -47,7 +47,7 @@ $ret = yaml_parse( $text ); if ( $ret === false ) { // Convert failures to exceptions - throw new InvalidArgumentException( "Invalid Yaml string" ); + throw new InvalidArgumentException( 'Invalid Yaml string' ); } return $ret; @@ -65,7 +65,7 @@ return self::fixSyckBooleans( $yaml ); default: - throw new MWException( "Unknown Yaml library" ); + throw new MWException( 'Unknown Yaml library' ); } } @@ -121,7 +121,7 @@ case 'syck': return self::syckDump( $text ); default: - throw new MWException( "Unknown Yaml library" ); + throw new MWException( 'Unknown Yaml library' ); } } diff --git a/webservices/ApertiumWebService.php b/webservices/ApertiumWebService.php index 9f90079..e40ae2a 100644 --- a/webservices/ApertiumWebService.php +++ b/webservices/ApertiumWebService.php @@ -57,7 +57,7 @@ $params = array( 'q' => $text, 'langpair' => "$from|$to", - 'x-application' => "Translate " . TRANSLATE_VERSION . ")", + 'x-application' => 'Translate ' . TRANSLATE_VERSION . ')', ); return TranslationQuery::factory( $this->config['url'] ) -- To view, visit https://gerrit.wikimedia.org/r/274888 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I02fa1edca8b3ef76a69f44e8b42f64d5afc1a69b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Translate Gerrit-Branch: master Gerrit-Owner: Siebrand <siebr...@kitano.nl> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits