From: Siebrand Mazeland Date: Tue, 8 Mar 2016 08:13:12 +0000 (+0100) Subject: Replace uses of join() by implode() X-Git-Tag: 1.31.0-rc.0~7700 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=5b119a0e442306d90198deead25f6a975513e65e Replace uses of join() by implode() All of core uses implode() consistently now. Change-Id: Iba50898c64c43f356d1caf8869f484e90d9ff651 --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index e48a399db5..3fa91fa700 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1738,7 +1738,7 @@ function wfEscapeWikiText( $text ) { $repl2[] = preg_quote( substr( $prot, 0, -1 ), '/' ); } } - $repl2 = $repl2 ? '/\b(' . join( '|', $repl2 ) . '):/i' : '/^(?!)/'; + $repl2 = $repl2 ? '/\b(' . implode( '|', $repl2 ) . '):/i' : '/^(?!)/'; } $text = substr( strtr( "\n$text", $repl ), 1 ); $text = preg_replace( $repl2, '$1:', $text ); diff --git a/includes/OutputPage.php b/includes/OutputPage.php index dfab03ab3e..11c23f090f 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2069,7 +2069,7 @@ class OutputPage extends ContextSource { foreach ( SessionManager::singleton()->getVaryHeaders() as $header => $options ) { $this->addVaryHeader( $header, $options ); } - return 'Vary: ' . join( ', ', array_keys( $this->mVaryHeader ) ); + return 'Vary: ' . implode( ', ', array_keys( $this->mVaryHeader ) ); } /** diff --git a/includes/Title.php b/includes/Title.php index 1a8a5f198e..0ac3e461a6 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -174,7 +174,7 @@ class Title implements LinkTarget { // make sure we are using the right one. To detect changes over the course // of a request, we remember a fingerprint of the config used to create the // codec singleton, and re-create it if the fingerprint doesn't match. - $fingerprint = spl_object_hash( $wgContLang ) . '|' . join( '+', $wgLocalInterwikis ); + $fingerprint = spl_object_hash( $wgContLang ) . '|' . implode( '+', $wgLocalInterwikis ); if ( $fingerprint !== $titleCodecFingerprint ) { $titleCodec = null; diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index fe85ddd3a3..85dee2bc60 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -302,7 +302,7 @@ abstract class ApiBase extends ContextSource { $qs = $k; $msg = self::escapeWikiText( $v ); if ( is_array( $msg ) ) { - $msg = join( ' ', $msg ); + $msg = implode( ' ', $msg ); } } @@ -547,13 +547,13 @@ abstract class ApiBase extends ContextSource { $parent = $module; $manager = $parent->getModuleManager(); if ( $manager === null ) { - $errorPath = join( '+', array_slice( $parts, 0, $i ) ); + $errorPath = implode( '+', array_slice( $parts, 0, $i ) ); $this->dieUsage( "The module \"$errorPath\" has no submodules", 'badmodule' ); } $module = $manager->getModule( $parts[$i] ); if ( $module === null ) { - $errorPath = $i ? join( '+', array_slice( $parts, 0, $i ) ) : $parent->getModuleName(); + $errorPath = $i ? implode( '+', array_slice( $parts, 0, $i ) ) : $parent->getModuleName(); $this->dieUsage( "The module \"$errorPath\" does not have a submodule \"{$parts[$i]}\"", 'badmodule' @@ -2223,7 +2223,7 @@ abstract class ApiBase extends ContextSource { Hooks::run( 'APIGetDescription', [ &$this, &$desc ] ); $desc = self::escapeWikiText( $desc ); if ( is_array( $desc ) ) { - $desc = join( "\n", $desc ); + $desc = implode( "\n", $desc ); } else { $desc = (string)$desc; } @@ -2309,7 +2309,7 @@ abstract class ApiBase extends ContextSource { } return $line; }, $d ); - $d = join( ' ', $d ); + $d = implode( ' ', $d ); } if ( isset( $settings[ApiBase::PARAM_HELP_MSG] ) ) { diff --git a/includes/api/ApiContinuationManager.php b/includes/api/ApiContinuationManager.php index 25407bfe96..8f1bd19191 100644 --- a/includes/api/ApiContinuationManager.php +++ b/includes/api/ApiContinuationManager.php @@ -137,7 +137,7 @@ class ApiContinuationManager { } $paramName = $module->encodeParamName( $paramName ); if ( is_array( $paramValue ) ) { - $paramValue = join( '|', $paramValue ); + $paramValue = implode( '|', $paramValue ); } $this->continuationData[$name][$paramName] = $paramValue; } @@ -152,7 +152,7 @@ class ApiContinuationManager { $name = $module->getModuleName(); $paramName = $module->encodeParamName( $paramName ); if ( is_array( $paramValue ) ) { - $paramValue = join( '|', $paramValue ); + $paramValue = implode( '|', $paramValue ); } $this->generatorContinuationData[$name][$paramName] = $paramValue; } @@ -193,7 +193,7 @@ class ApiContinuationManager { $data += $kvp; } $data += $this->generatorParams; - $generatorKeys = join( '|', array_keys( $this->generatorParams ) ); + $generatorKeys = implode( '|', array_keys( $this->generatorParams ) ); } elseif ( $this->generatorContinuationData ) { // All the generator-using modules are complete, but the // generator isn't. Continue the generator and restart the @@ -204,7 +204,7 @@ class ApiContinuationManager { } $data += $generatorParams; $finishedModules = array_diff( $finishedModules, $this->generatedModules ); - $generatorKeys = join( '|', array_keys( $generatorParams ) ); + $generatorKeys = implode( '|', array_keys( $generatorParams ) ); $batchcomplete = true; } else { // Generator and prop modules are all done. Mark it so. @@ -215,7 +215,7 @@ class ApiContinuationManager { // Set 'continue' if any continuation data is set or if the generator // still needs to run if ( $data || $generatorKeys !== '-' ) { - $data['continue'] = $generatorKeys . '||' . join( '|', $finishedModules ); + $data['continue'] = $generatorKeys . '||' . implode( '|', $finishedModules ); } return [ $data, $batchcomplete ]; diff --git a/includes/api/ApiHelp.php b/includes/api/ApiHelp.php index 349a34da92..f2d6329ee5 100644 --- a/includes/api/ApiHelp.php +++ b/includes/api/ApiHelp.php @@ -268,7 +268,7 @@ class ApiHelp extends ApiBase { 'level' => $level, 'anchor' => $anchor, 'line' => $header, - 'number' => join( '.', $tocnumber ), + 'number' => implode( '.', $tocnumber ), 'index' => false, ]; if ( empty( $options['noheader'] ) ) { @@ -618,7 +618,7 @@ class ApiHelp extends ApiBase { ->parse(); } if ( $extra ) { - $info[] = join( ' ', $extra ); + $info[] = implode( ' ', $extra ); } } } @@ -655,7 +655,7 @@ class ApiHelp extends ApiBase { } if ( $description ) { - $description = join( '', $description ); + $description = implode( '', $description ); $description = preg_replace( '!\s*\s*<\1>\s*!', "\n", $description ); $help['parameters'] .= Html::rawElement( 'dd', [ 'class' => 'description' ], $description ); @@ -744,7 +744,7 @@ class ApiHelp extends ApiBase { Hooks::run( 'APIHelpModifyOutput', [ $module, &$help, $suboptions, &$haveModules ] ); - $out .= join( "\n", $help ); + $out .= implode( "\n", $help ); } return $out; diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index d59151adfe..f09c6f29fb 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -1225,7 +1225,7 @@ class ApiMain extends ApiBase { // If a majority of slaves are too lagged then disallow writes $slaveCount = wfGetLB()->getServerCount() - 1; if ( $numLagged >= ceil( $slaveCount / 2 ) ) { - $laggedServers = join( ', ', $laggedServers ); + $laggedServers = implode( ', ', $laggedServers ); wfDebugLog( 'api-readonly', "Api request failed as read only because the following DBs are lagged: $laggedServers" @@ -1443,7 +1443,7 @@ class ApiMain extends ApiBase { $ret = $this->getRequest()->getVal( $name ); if ( $ret === null ) { if ( $this->getRequest()->getArray( $name ) !== null ) { - // See bug 10262 for why we don't just join( '|', ... ) the + // See bug 10262 for why we don't just implode( '|', ... ) the // array. $this->setWarning( "Parameter '$name' uses unsupported PHP array syntax" @@ -1637,7 +1637,7 @@ class ApiMain extends ApiBase { 'level' => $level, 'anchor' => 'main/datatypes', 'line' => $header, - 'number' => join( '.', $tocnumber ), + 'number' => implode( '.', $tocnumber ), 'index' => false, ]; } @@ -1656,7 +1656,7 @@ class ApiMain extends ApiBase { 'level' => $level, 'anchor' => 'main/credits', 'line' => $header, - 'number' => join( '.', $tocnumber ), + 'number' => implode( '.', $tocnumber ), 'index' => false, ]; } diff --git a/includes/api/ApiParamInfo.php b/includes/api/ApiParamInfo.php index 6e44f82e80..c3c9e2176c 100644 --- a/includes/api/ApiParamInfo.php +++ b/includes/api/ApiParamInfo.php @@ -137,7 +137,7 @@ class ApiParamInfo extends ApiBase { foreach ( $msgs as $m ) { $ret[] = $m->setContext( $this->context )->text(); } - $res[$key] = join( "\n\n", $ret ); + $res[$key] = implode( "\n\n", $ret ); if ( $joinLists ) { $res[$key] = preg_replace( '!^(([*#:;])[^\n]*)\n\n(?=\2)!m', "$1\n", $res[$key] ); } @@ -148,7 +148,7 @@ class ApiParamInfo extends ApiBase { foreach ( $msgs as $m ) { $ret[] = $m->setContext( $this->context )->parseAsBlock(); } - $ret = join( "\n", $ret ); + $ret = implode( "\n", $ret ); if ( $joinLists ) { $ret = preg_replace( '!\s*\s*<\1>\s*!', "\n", $ret ); } diff --git a/includes/api/ApiQueryAllLinks.php b/includes/api/ApiQueryAllLinks.php index 94707da21c..ac906056a3 100644 --- a/includes/api/ApiQueryAllLinks.php +++ b/includes/api/ApiQueryAllLinks.php @@ -117,7 +117,7 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase { if ( $matches ) { $p = $this->getModulePrefix(); $this->dieUsage( - "Cannot use {$p}prop=" . join( '|', array_keys( $matches ) ) . " with {$p}unique", + "Cannot use {$p}prop=" . implode( '|', array_keys( $matches ) ) . " with {$p}unique", 'params' ); } diff --git a/includes/api/ApiQueryBacklinks.php b/includes/api/ApiQueryBacklinks.php index 97b122accd..fb502e40e7 100644 --- a/includes/api/ApiQueryBacklinks.php +++ b/includes/api/ApiQueryBacklinks.php @@ -296,7 +296,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { // Note we must keep the parameters for the first query constant // This may be overridden at a later step $title = $row->{$this->bl_title}; - $this->continueStr = join( '|', array_slice( $this->cont, 0, 2 ) ) . + $this->continueStr = implode( '|', array_slice( $this->cont, 0, 2 ) ) . "|$ns|$title|{$row->from_ns}|{$row->page_id}"; break; } @@ -451,7 +451,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { [ 'query', $this->getModuleName() ], $idx, array_diff_key( $arr, [ 'redirlinks' => '' ] ) ); if ( !$fit ) { - $this->continueStr = join( '|', array_slice( $this->cont, 0, 6 ) ) . + $this->continueStr = implode( '|', array_slice( $this->cont, 0, 6 ) ) . "|$pageID"; break; } @@ -474,7 +474,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { [ 'query', $this->getModuleName(), $idx, 'redirlinks' ], null, $redir ); if ( !$fit ) { - $this->continueStr = join( '|', array_slice( $this->cont, 0, 6 ) ) . + $this->continueStr = implode( '|', array_slice( $this->cont, 0, 6 ) ) . "|$pageID|$key"; break; } diff --git a/includes/api/ApiQueryBacklinksprop.php b/includes/api/ApiQueryBacklinksprop.php index 5b55332e11..3810e90f13 100644 --- a/includes/api/ApiQueryBacklinksprop.php +++ b/includes/api/ApiQueryBacklinksprop.php @@ -313,7 +313,7 @@ class ApiQueryBacklinksprop extends ApiQueryGeneratorBase { foreach ( $sortby as $field => $v ) { $cont[] = $row->$field; } - $this->setContinueEnumParameter( 'continue', join( '|', $cont ) ); + $this->setContinueEnumParameter( 'continue', implode( '|', $cont ) ); } public function getCacheMode( $params ) { diff --git a/includes/api/ApiQueryFileRepoInfo.php b/includes/api/ApiQueryFileRepoInfo.php index 7848bc8dbc..c4912366c4 100644 --- a/includes/api/ApiQueryFileRepoInfo.php +++ b/includes/api/ApiQueryFileRepoInfo.php @@ -78,7 +78,7 @@ class ApiQueryFileRepoInfo extends ApiQueryBase { return [ 'prop' => [ - ApiBase::PARAM_DFLT => join( '|', $props ), + ApiBase::PARAM_DFLT => implode( '|', $props ), ApiBase::PARAM_ISMULTI => true, ApiBase::PARAM_TYPE => $props, ], diff --git a/includes/api/ApiResult.php b/includes/api/ApiResult.php index a5f22c3fc4..3436320133 100644 --- a/includes/api/ApiResult.php +++ b/includes/api/ApiResult.php @@ -312,7 +312,7 @@ class ApiResult implements ApiSerializable { if ( !$conflicts ) { $arr[$name] += $value; } else { - $keys = join( ', ', array_keys( $conflicts ) ); + $keys = implode( ', ', array_keys( $conflicts ) ); throw new RuntimeException( "Conflicting keys ($keys) when attempting to merge element $name" ); @@ -1132,12 +1132,12 @@ class ApiResult implements ApiSerializable { $tmp = []; return $tmp; default: - $fail = join( '.', array_slice( $path, 0, $i + 1 ) ); + $fail = implode( '.', array_slice( $path, 0, $i + 1 ) ); throw new InvalidArgumentException( "Path $fail does not exist" ); } } if ( !is_array( $ret[$k] ) ) { - $fail = join( '.', array_slice( $path, 0, $i + 1 ) ); + $fail = implode( '.', array_slice( $path, 0, $i + 1 ) ); throw new InvalidArgumentException( "Path $fail is not an array" ); } $ret = &$ret[$k]; diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index 0eecaa1cdb..326f8ba112 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -544,7 +544,7 @@ class ApiUpload extends ApiBase { $msg = 'Filetype not permitted: '; if ( isset( $verification['blacklistedExt'] ) ) { - $msg .= join( ', ', $verification['blacklistedExt'] ); + $msg .= implode( ', ', $verification['blacklistedExt'] ); $extradata['blacklisted'] = array_values( $verification['blacklistedExt'] ); ApiResult::setIndexedTagName( $extradata['blacklisted'], 'ext' ); } else { diff --git a/includes/content/JsonContent.php b/includes/content/JsonContent.php index b9215fce85..40d9277470 100644 --- a/includes/content/JsonContent.php +++ b/includes/content/JsonContent.php @@ -161,7 +161,7 @@ class JsonContent extends TextContent { ); } return Html::rawElement( 'table', [ 'class' => 'mw-json' ], - Html::rawElement( 'tbody', [], join( '', $rows ) ) + Html::rawElement( 'tbody', [], implode( '', $rows ) ) ); } @@ -200,7 +200,7 @@ class JsonContent extends TextContent { ); } return Html::rawElement( 'table', [ 'class' => 'mw-json' ], - Html::rawElement( 'tbody', [], join( "\n", $rows ) ) + Html::rawElement( 'tbody', [], implode( "\n", $rows ) ) ); } diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index 9b301a9440..9e53653a76 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -618,7 +618,7 @@ class DatabaseOracle extends Database { $table = $this->tableName( $table ); // "INSERT INTO tables (a, b, c)" - $sql = "INSERT INTO " . $table . " (" . join( ',', array_keys( $row ) ) . ')'; + $sql = "INSERT INTO " . $table . " (" . implode( ',', array_keys( $row ) ) . ')'; $sql .= " VALUES ("; // for each value, append ":key" diff --git a/includes/filerepo/ForeignAPIRepo.php b/includes/filerepo/ForeignAPIRepo.php index d29cd7d7d2..cc9099c6c0 100644 --- a/includes/filerepo/ForeignAPIRepo.php +++ b/includes/filerepo/ForeignAPIRepo.php @@ -537,7 +537,7 @@ class ForeignAPIRepo extends FileRepo { * @since 1.23 */ protected static function getIIProps() { - return join( '|', self::$imageInfoProps ); + return implode( '|', self::$imageInfoProps ); } /** diff --git a/includes/installer/MysqlUpdater.php b/includes/installer/MysqlUpdater.php index 57eaffed26..154f7c3498 100644 --- a/includes/installer/MysqlUpdater.php +++ b/includes/installer/MysqlUpdater.php @@ -516,7 +516,7 @@ class MysqlUpdater extends DatabaseUpdater { $prev_title = $row->cur_title; $prev_namespace = $row->cur_namespace; } - $sql = "DELETE FROM $cur WHERE cur_id IN ( " . join( ',', $deleteId ) . ')'; + $sql = "DELETE FROM $cur WHERE cur_id IN ( " . implode( ',', $deleteId ) . ')'; $this->db->query( $sql, __METHOD__ ); $this->output( wfTimestamp( TS_DB ) ); $this->output( "......Deleted " . $this->db->affectedRows() . " records.\n" ); diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index d65e8be59f..d7ba266fea 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -4636,7 +4636,7 @@ class Parser { $anchor = $safeHeadline; $legacyAnchor = $legacyHeadline; if ( isset( $refers[$arrayKey] ) ) { - // @codingStandardsIgnoreStart + // @codingStandardsIgnoreStart for ( $i = 2; isset( $refers["${arrayKey}_$i"] ); ++$i ); // @codingStandardsIgnoreEnd $anchor .= "_$i"; @@ -4645,7 +4645,7 @@ class Parser { $refers[$arrayKey] = true; } if ( $legacyHeadline !== false && isset( $refers[$legacyArrayKey] ) ) { - // @codingStandardsIgnoreStart + // @codingStandardsIgnoreStart for ( $i = 2; isset( $refers["${legacyArrayKey}_$i"] ); ++$i ); // @codingStandardsIgnoreEnd $legacyAnchor .= "_$i"; @@ -4793,7 +4793,7 @@ class Parser { $sections[0] = $sections[0] . $toc . "\n"; } - $full .= join( '', $sections ); + $full .= implode( '', $sections ); if ( $this->mForceTocPosition ) { return str_replace( '', $toc, $full ); diff --git a/includes/search/SearchMssql.php b/includes/search/SearchMssql.php index 598702d1ed..5e8fb044b6 100644 --- a/includes/search/SearchMssql.php +++ b/includes/search/SearchMssql.php @@ -160,7 +160,7 @@ class SearchMssql extends SearchDatabase { } } - $searchon = $this->db->addQuotes( join( ',', $q ) ); + $searchon = $this->db->addQuotes( implode( ',', $q ) ); $field = $this->getIndexField( $fulltext ); return "$field, $searchon"; } diff --git a/includes/session/BotPasswordSessionProvider.php b/includes/session/BotPasswordSessionProvider.php index 70c771dc31..bbdfdc3f26 100644 --- a/includes/session/BotPasswordSessionProvider.php +++ b/includes/session/BotPasswordSessionProvider.php @@ -120,7 +120,7 @@ class BotPasswordSessionProvider extends ImmutableSessionProviderWithCookie { if ( $missingKeys ) { $this->logger->info( 'Session "{session}": Missing metadata: {missing}', [ 'session' => $info, - 'missing' => join( ', ', $missingKeys ), + 'missing' => implode( ', ', $missingKeys ), ] ); return false; } diff --git a/includes/session/Session.php b/includes/session/Session.php index 21db609090..0fd8fa8a31 100644 --- a/includes/session/Session.php +++ b/includes/session/Session.php @@ -352,7 +352,7 @@ final class Session implements \Countable, \Iterator, \ArrayAccess { $new = true; } if ( is_array( $salt ) ) { - $salt = join( '|', $salt ); + $salt = implode( '|', $salt ); } return new Token( $secret, (string)$salt, $new ); } diff --git a/includes/session/SessionManager.php b/includes/session/SessionManager.php index d31e2f157c..efa3445bdf 100644 --- a/includes/session/SessionManager.php +++ b/includes/session/SessionManager.php @@ -287,7 +287,7 @@ final class SessionManager implements SessionManagerInterface { // Make sure there's exactly one if ( count( $infos ) > 1 ) { throw new \UnexpectedValueException( - 'Multiple empty sessions tied for top priority: ' . join( ', ', $infos ) + 'Multiple empty sessions tied for top priority: ' . implode( ', ', $infos ) ); } elseif ( count( $infos ) < 1 ) { throw new \UnexpectedValueException( 'No provider could provide an empty session!' ); @@ -677,7 +677,7 @@ final class SessionManager implements SessionManagerInterface { if ( count( $retInfos ) > 1 ) { $ex = new \OverflowException( - 'Multiple sessions for this request tied for top priority: ' . join( ', ', $retInfos ) + 'Multiple sessions for this request tied for top priority: ' . implode( ', ', $retInfos ) ); $ex->sessionInfos = $retInfos; throw $ex; diff --git a/includes/utils/MWRestrictions.php b/includes/utils/MWRestrictions.php index 521e3452b8..617e8f59fd 100644 --- a/includes/utils/MWRestrictions.php +++ b/includes/utils/MWRestrictions.php @@ -69,13 +69,13 @@ class MWRestrictions { $invalidKeys = array_diff( $keys, $validKeys ); if ( $invalidKeys ) { throw new InvalidArgumentException( - 'Array contains invalid keys: ' . join( ', ', $invalidKeys ) + 'Array contains invalid keys: ' . implode( ', ', $invalidKeys ) ); } $missingKeys = array_diff( $neededKeys, $keys ); if ( $missingKeys ) { throw new InvalidArgumentException( - 'Array is missing required keys: ' . join( ', ', $missingKeys ) + 'Array is missing required keys: ' . implode( ', ', $missingKeys ) ); } diff --git a/languages/classes/LanguageCu.php b/languages/classes/LanguageCu.php index b36f0809fc..89625c0567 100644 --- a/languages/classes/LanguageCu.php +++ b/languages/classes/LanguageCu.php @@ -52,11 +52,11 @@ class LanguageCu extends Language { if ( !preg_match( "/[a-zA-Z_]/us", $word ) ) { switch ( $case ) { case 'genitive': # родительный падеж - if ( ( join( '', array_slice( $ar[0], -4 ) ) == 'вики' ) - || ( join( '', array_slice( $ar[0], -4 ) ) == 'Вики' ) + if ( ( implode( '', array_slice( $ar[0], -4 ) ) == 'вики' ) + || ( implode( '', array_slice( $ar[0], -4 ) ) == 'Вики' ) ) { - } elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ї' ) { - $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'їѩ'; + } elseif ( implode( '', array_slice( $ar[0], -2 ) ) == 'ї' ) { + $word = implode( '', array_slice( $ar[0], 0, -2 ) ) . 'їѩ'; } break; case 'accusative': # винительный падеж diff --git a/languages/classes/LanguageHy.php b/languages/classes/LanguageHy.php index f6d5270676..05b0ebed04 100644 --- a/languages/classes/LanguageHy.php +++ b/languages/classes/LanguageHy.php @@ -52,12 +52,12 @@ class LanguageHy extends Language { if ( !preg_match( "/[a-zA-Z_]/us", $word ) ) { switch ( $case ) { case 'genitive': # սեռական հոլով - if ( join( '', array_slice( $ar[0], -1 ) ) == 'ա' ) { - $word = join( '', array_slice( $ar[0], 0, -1 ) ) . 'այի'; - } elseif ( join( '', array_slice( $ar[0], -1 ) ) == 'ո' ) { - $word = join( '', array_slice( $ar[0], 0, -1 ) ) . 'ոյի'; - } elseif ( join( '', array_slice( $ar[0], -4 ) ) == 'գիրք' ) { - $word = join( '', array_slice( $ar[0], 0, -4 ) ) . 'գրքի'; + if ( implode( '', array_slice( $ar[0], -1 ) ) == 'ա' ) { + $word = implode( '', array_slice( $ar[0], 0, -1 ) ) . 'այի'; + } elseif ( implode( '', array_slice( $ar[0], -1 ) ) == 'ո' ) { + $word = implode( '', array_slice( $ar[0], 0, -1 ) ) . 'ոյի'; + } elseif ( implode( '', array_slice( $ar[0], -4 ) ) == 'գիրք' ) { + $word = implode( '', array_slice( $ar[0], 0, -4 ) ) . 'գրքի'; } else { $word .= 'ի'; } diff --git a/languages/classes/LanguageUk.php b/languages/classes/LanguageUk.php index 6cc23e3050..72bde4007d 100644 --- a/languages/classes/LanguageUk.php +++ b/languages/classes/LanguageUk.php @@ -51,19 +51,19 @@ class LanguageUk extends Language { if ( !preg_match( "/[a-zA-Z_]/us", $word ) ) { switch ( $case ) { case 'genitive': # родовий відмінок - if ( join( '', array_slice( $ar[0], -2 ) ) === 'ія' ) { - $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'ії'; - } elseif ( join( '', array_slice( $ar[0], -2 ) ) === 'ти' ) { - $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'т'; - } elseif ( join( '', array_slice( $ar[0], -2 ) ) === 'ди' ) { - $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'дів'; - } elseif ( join( '', array_slice( $ar[0], -3 ) ) === 'ник' ) { - $word = join( '', array_slice( $ar[0], 0, -3 ) ) . 'ника'; + if ( implode( '', array_slice( $ar[0], -2 ) ) === 'ія' ) { + $word = implode( '', array_slice( $ar[0], 0, -2 ) ) . 'ії'; + } elseif ( implode( '', array_slice( $ar[0], -2 ) ) === 'ти' ) { + $word = implode( '', array_slice( $ar[0], 0, -2 ) ) . 'т'; + } elseif ( implode( '', array_slice( $ar[0], -2 ) ) === 'ди' ) { + $word = implode( '', array_slice( $ar[0], 0, -2 ) ) . 'дів'; + } elseif ( implode( '', array_slice( $ar[0], -3 ) ) === 'ник' ) { + $word = implode( '', array_slice( $ar[0], 0, -3 ) ) . 'ника'; } break; case 'accusative': # знахідний відмінок - if ( join( '', array_slice( $ar[0], -2 ) ) === 'ія' ) { - $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'ію'; + if ( implode( '', array_slice( $ar[0], -2 ) ) === 'ія' ) { + $word = implode( '', array_slice( $ar[0], 0, -2 ) ) . 'ію'; } break; } diff --git a/maintenance/benchmarks/Benchmarker.php b/maintenance/benchmarks/Benchmarker.php index 8651a6829c..5fab082334 100644 --- a/maintenance/benchmarks/Benchmarker.php +++ b/maintenance/benchmarks/Benchmarker.php @@ -87,7 +87,7 @@ abstract class Benchmarker extends Maintenance { $ret .= sprintf( "%s times: function %s(%s) :\n", $res['count'], $res['function'], - join( ', ', $res['arguments'] ) + implode( ', ', $res['arguments'] ) ); $ret .= sprintf( " %6.2fms (%6.2fms each)\n", $res['delta'] * 1000, diff --git a/maintenance/getConfiguration.php b/maintenance/getConfiguration.php index 6bc9a6a548..3c679e6e7a 100644 --- a/maintenance/getConfiguration.php +++ b/maintenance/getConfiguration.php @@ -53,7 +53,7 @@ class GetConfiguration extends Maintenance { $this->addOption( 'regex', 'regex to filter variables with', false, true ); $this->addOption( 'iregex', 'same as --regex but case insensitive', false, true ); $this->addOption( 'settings', 'Space-separated list of wg* variables', false, true ); - $this->addOption( 'format', join( ', ', self::$outFormats ), false, true ); + $this->addOption( 'format', implode( ', ', self::$outFormats ), false, true ); } protected function validateParamsAndArgs() { diff --git a/tests/phpunit/includes/api/RandomImageGenerator.php b/tests/phpunit/includes/api/RandomImageGenerator.php index 62e175b2ab..78cb7fb152 100644 --- a/tests/phpunit/includes/api/RandomImageGenerator.php +++ b/tests/phpunit/includes/api/RandomImageGenerator.php @@ -230,7 +230,7 @@ class RandomImageGenerator { $points[] = $point['x'] . ',' . $point['y']; } - return join( " ", $points ); + return implode( " ", $points ); } /** @@ -425,7 +425,7 @@ class RandomImageGenerator { $components[] = mt_rand( 0, 255 ); } - return 'rgb(' . join( ', ', $components ) . ')'; + return 'rgb(' . implode( ', ', $components ) . ')'; } /** diff --git a/tests/phpunit/includes/media/WebPTest.php b/tests/phpunit/includes/media/WebPTest.php index b50fe80827..dfa92f1f8a 100644 --- a/tests/phpunit/includes/media/WebPTest.php +++ b/tests/phpunit/includes/media/WebPTest.php @@ -137,5 +137,5 @@ class WebPHandlerTest extends MediaWikiTestCase { } /* Python code to extract a header and convert to PHP format: - * print '"%s"' % ''.join( '\\x%02X' % ord(c) for c in urllib.urlopen(url).read(36) ) + * print '"%s"' % ''.implode( '\\x%02X' % ord(c) for c in urllib.urlopen(url).read(36) ) */ diff --git a/tests/phpunit/includes/specialpage/SpecialPageFactoryTest.php b/tests/phpunit/includes/specialpage/SpecialPageFactoryTest.php index 998d2bb335..534cf9baf7 100644 --- a/tests/phpunit/includes/specialpage/SpecialPageFactoryTest.php +++ b/tests/phpunit/includes/specialpage/SpecialPageFactoryTest.php @@ -171,7 +171,7 @@ class SpecialPageFactoryTest extends MediaWikiTestCase { $gotWarnings = count( $warnings ); if ( $gotWarnings !== $expectWarnings ) { $this->fail( "Expected $expectWarnings warning(s), but got $gotWarnings:\n" . - join( "\n", $warnings ) + implode( "\n", $warnings ) ); } } diff --git a/tests/phpunit/structure/ApiDocumentationTest.php b/tests/phpunit/structure/ApiDocumentationTest.php index b9cb6c17e4..542420a9dc 100644 --- a/tests/phpunit/structure/ApiDocumentationTest.php +++ b/tests/phpunit/structure/ApiDocumentationTest.php @@ -153,7 +153,7 @@ class ApiDocumentationTest extends MediaWikiTestCase { foreach ( $globals as $k => $v ) { $g[] = "$k=" . var_export( $v, 1 ); } - $k = "Module $path with " . join( ', ', $g ); + $k = "Module $path with " . implode( ', ', $g ); $ret[$k] = [ $path, $globals ]; } } diff --git a/tests/qunit/data/generateJqueryMsgData.php b/tests/qunit/data/generateJqueryMsgData.php index 456787c7da..5a96dc3356 100644 --- a/tests/qunit/data/generateJqueryMsgData.php +++ b/tests/qunit/data/generateJqueryMsgData.php @@ -110,7 +110,7 @@ class GenerateJqueryMsgData extends Maintenance { $langKey = $languageCode . '_' . $key; $messages[$langKey] = $template; $tests[] = [ - 'name' => $languageCode . ' ' . $key . ' ' . join( ',', $args ), + 'name' => $languageCode . ' ' . $key . ' ' . implode( ',', $args ), 'key' => $langKey, 'args' => $args, 'result' => $result,