From: umherirrender Date: Fri, 11 Mar 2016 17:41:26 +0000 (+0100) Subject: Change remaining places to use short array syntax X-Git-Tag: 1.31.0-rc.0~7630^2 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=8678e32b8db50b57178a173ac60e4da3fd89f57c;p=lhc%2Fweb%2Fwiklou.git Change remaining places to use short array syntax Change-Id: I0785c73a239c11188ad7411c5cd8ed09a2dbc9b3 --- diff --git a/includes/GitInfo.php b/includes/GitInfo.php index 14f3cc14af..29516ab7cd 100644 --- a/includes/GitInfo.php +++ b/includes/GitInfo.php @@ -43,7 +43,7 @@ class GitInfo { /** * Cached git information. */ - protected $cache = array(); + protected $cache = []; /** * Map of repo URLs to viewer URLs. Access via static method getViewers(). @@ -215,7 +215,7 @@ class GitInfo { is_executable( $wgGitBin ) && $this->getHead() !== false ) { - $environment = array( "GIT_DIR" => $this->basedir ); + $environment = [ "GIT_DIR" => $this->basedir ]; $cmd = wfEscapeShellArg( $wgGitBin ) . " show -s --format=format:%ct HEAD"; $retc = false; @@ -265,11 +265,11 @@ class GitInfo { if ( preg_match( $pattern, $url, $matches ) ) { $viewerUrl = preg_replace( $pattern, $viewer, $url ); $headSHA1 = $this->getHeadSHA1(); - $replacements = array( + $replacements = [ '%h' => substr( $headSHA1, 0, 7 ), '%H' => $headSHA1, '%r' => urlencode( $matches[1] ), - ); + ]; return strtr( $viewerUrl, $replacements ); } } @@ -396,7 +396,7 @@ class GitInfo { if ( self::$viewers === false ) { self::$viewers = $wgGitRepositoryViewers; - Hooks::run( 'GitViewers', array( &self::$viewers ) ); + Hooks::run( 'GitViewers', [ &self::$viewers ] ); } return self::$viewers; diff --git a/includes/changetags/ChangeTagsLogItem.php b/includes/changetags/ChangeTagsLogItem.php index 24bded7498..2dc953c360 100644 --- a/includes/changetags/ChangeTagsLogItem.php +++ b/includes/changetags/ChangeTagsLogItem.php @@ -73,8 +73,8 @@ class ChangeTagsLogItem extends RevisionItemBase { $loglink = Linker::link( SpecialPage::getTitleFor( 'Log' ), $this->list->msg( 'log' )->escaped(), - array(), - array( 'page' => $title->getPrefixedText() ) + [], + [ 'page' => $title->getPrefixedText() ] ); $loglink = $this->list->msg( 'parentheses' )->rawParams( $loglink )->escaped(); // User links and action text @@ -88,7 +88,7 @@ class ChangeTagsLogItem extends RevisionItemBase { } $content = "$loglink $date $action $comment"; - $attribs = array(); + $attribs = []; $tags = $this->getTags(); if ( $tags ) { list( $tagSummary, $classes ) = ChangeTags::formatSummaryRow( diff --git a/includes/content/TextContentHandler.php b/includes/content/TextContentHandler.php index f5e87830ca..ad40cd9077 100644 --- a/includes/content/TextContentHandler.php +++ b/includes/content/TextContentHandler.php @@ -32,7 +32,7 @@ class TextContentHandler extends ContentHandler { // @codingStandardsIgnoreStart bug 57585 public function __construct( $modelId = CONTENT_MODEL_TEXT, - $formats = array( CONTENT_FORMAT_TEXT ) ) { + $formats = [ CONTENT_FORMAT_TEXT ] ) { parent::__construct( $modelId, $formats ); } // @codingStandardsIgnoreEnd diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index a1a1bb0497..44e6a245c3 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -573,7 +573,7 @@ class DifferenceEngine extends ContextSource {

{$revHeader}

\n" ); # Page content may be handled by a hooked call instead... # @codingStandardsIgnoreStart Ignoring long lines. - if ( Hooks::run( 'ArticleContentOnDiff', array( $this, $out ) ) ) { + if ( Hooks::run( 'ArticleContentOnDiff', [ $this, $out ] ) ) { $this->loadNewText(); $out->setRevisionId( $this->mNewid ); $out->setRevisionTimestamp( $this->mNewRev->getTimestamp() ); @@ -584,7 +584,7 @@ class DifferenceEngine extends ContextSource { // This needs to be synchronised with Article::showCssOrJsPage(), which sucks // Give hooks a chance to customise the output // @todo standardize this crap into one function - if ( ContentHandler::runLegacyHooks( 'ShowRawCssJs', array( $this->mNewContent, $this->mNewPage, $out ) ) ) { + if ( ContentHandler::runLegacyHooks( 'ShowRawCssJs', [ $this->mNewContent, $this->mNewPage, $out ] ) ) { // NOTE: deprecated hook, B/C only // use the content object's own rendering $cnt = $this->mNewRev->getContent(); @@ -593,9 +593,9 @@ class DifferenceEngine extends ContextSource { $out->addParserOutputContent( $po ); } } - } elseif ( !Hooks::run( 'ArticleContentViewCustom', array( $this->mNewContent, $this->mNewPage, $out ) ) ) { + } elseif ( !Hooks::run( 'ArticleContentViewCustom', [ $this->mNewContent, $this->mNewPage, $out ] ) ) { // Handled by extension - } elseif ( !ContentHandler::runLegacyHooks( 'ArticleViewCustom', array( $this->mNewContent, $this->mNewPage, $out ) ) ) { + } elseif ( !ContentHandler::runLegacyHooks( 'ArticleViewCustom', [ $this->mNewContent, $this->mNewPage, $out ] ) ) { // NOTE: deprecated hook, B/C only // Handled by extension } else { diff --git a/includes/revisiondelete/RevDelLogItem.php b/includes/revisiondelete/RevDelLogItem.php index 65b0309742..1ea72715a5 100644 --- a/includes/revisiondelete/RevDelLogItem.php +++ b/includes/revisiondelete/RevDelLogItem.php @@ -55,11 +55,11 @@ class RevDelLogItem extends RevDelItem { $dbw = wfGetDB( DB_MASTER ); $dbw->update( 'logging', - array( 'log_deleted' => $bits ), - array( + [ 'log_deleted' => $bits ], + [ 'log_id' => $this->row->log_id, 'log_deleted' => $this->getBits() // cas - ), + ], __METHOD__ ); @@ -69,14 +69,14 @@ class RevDelLogItem extends RevDelItem { } $dbw->update( 'recentchanges', - array( + [ 'rc_deleted' => $bits, 'rc_patrolled' => 1 - ), - array( + ], + [ 'rc_logid' => $this->row->log_id, 'rc_timestamp' => $this->row->log_timestamp // index - ), + ], __METHOD__ ); @@ -95,8 +95,8 @@ class RevDelLogItem extends RevDelItem { $loglink = Linker::link( SpecialPage::getTitleFor( 'Log' ), $this->list->msg( 'log' )->escaped(), - array(), - array( 'page' => $title->getPrefixedText() ) + [], + [ 'page' => $title->getPrefixedText() ] ); $loglink = $this->list->msg( 'parentheses' )->rawParams( $loglink )->escaped(); // User links and action text @@ -115,34 +115,34 @@ class RevDelLogItem extends RevDelItem { public function getApiData( ApiResult $result ) { $logEntry = DatabaseLogEntry::newFromRow( $this->row ); $user = $this->list->getUser(); - $ret = array( + $ret = [ 'id' => $logEntry->getId(), 'type' => $logEntry->getType(), 'action' => $logEntry->getSubtype(), - ); + ]; $ret += $logEntry->isDeleted( LogPage::DELETED_USER ) - ? array( 'userhidden' => '' ) - : array(); + ? [ 'userhidden' => '' ] + : []; $ret += $logEntry->isDeleted( LogPage::DELETED_COMMENT ) - ? array( 'commenthidden' => '' ) - : array(); + ? [ 'commenthidden' => '' ] + : []; $ret += $logEntry->isDeleted( LogPage::DELETED_ACTION ) - ? array( 'actionhidden' => '' ) - : array(); + ? [ 'actionhidden' => '' ] + : []; if ( LogEventsList::userCan( $this->row, LogPage::DELETED_ACTION, $user ) ) { $ret['params'] = LogFormatter::newFromEntry( $logEntry )->formatParametersForApi(); } if ( LogEventsList::userCan( $this->row, LogPage::DELETED_USER, $user ) ) { - $ret += array( + $ret += [ 'userid' => $this->row->log_user, 'user' => $this->row->log_user_text, - ); + ]; } if ( LogEventsList::userCan( $this->row, LogPage::DELETED_COMMENT, $user ) ) { - $ret += array( + $ret += [ 'comment' => $this->row->log_comment, - ); + ]; } return $ret; diff --git a/includes/templates/Usercreate.php b/includes/templates/Usercreate.php index a39690a72c..3824be1251 100644 --- a/includes/templates/Usercreate.php +++ b/includes/templates/Usercreate.php @@ -28,13 +28,13 @@ class UsercreateTemplate extends BaseTemplate { * UserCreateForm hook to add checkboxes to the create account form. */ function addInputItem( $name, $value, $type, $msg, $helptext = false ) { - $this->data['extraInput'][] = array( + $this->data['extraInput'][] = [ 'name' => $name, 'value' => $value, 'type' => $type, 'msg' => $msg, 'helptext' => $helptext, - ); + ]; } function execute() { @@ -84,7 +84,7 @@ class UsercreateTemplate extends BaseTemplate { getMsg( 'createacct-helpusername' )->parse(); ?> data['name'], 'text', array( + echo Html::input( 'wpName', $this->data['name'], 'text', [ 'class' => 'mw-ui-input loginText', 'id' => 'wpName2', 'tabindex' => '1', @@ -92,7 +92,7 @@ class UsercreateTemplate extends BaseTemplate { 'required', 'placeholder' => $this->getMsg( $this->data['loggedin'] ? 'createacct-another-username-ph' : 'userlogin-yourname-ph' )->text(), - ) ); + ] ); ?> @@ -113,14 +113,14 @@ class UsercreateTemplate extends BaseTemplate {
'mw-ui-input loginPassword', 'id' => 'wpPassword2', 'tabindex' => '3', 'size' => '20', 'required', 'placeholder' => $this->getMsg( 'createacct-yourpassword-ph' )->text() - ) + User::passwordChangeInputAttribs() ); + ] + User::passwordChangeInputAttribs() ); ?>
@@ -143,14 +143,14 @@ class UsercreateTemplate extends BaseTemplate {
'mw-ui-input loginPassword', 'id' => 'wpRetype', 'tabindex' => '5', 'size' => '20', 'required', 'placeholder' => $this->getMsg( 'createacct-yourpasswordagain-ph' )->text() - ) + User::passwordChangeInputAttribs() ); + ] + User::passwordChangeInputAttribs() ); ?>
@@ -165,7 +165,7 @@ class UsercreateTemplate extends BaseTemplate { ?> data['email'], 'email', array( + echo Html::input( 'wpEmail', $this->data['email'], 'email', [ 'class' => 'mw-ui-input loginText', 'id' => 'wpEmail', 'tabindex' => '6', @@ -173,7 +173,7 @@ class UsercreateTemplate extends BaseTemplate { 'required' => $this->data['emailrequired'], 'placeholder' => $this->getMsg( $this->data['loggedin'] ? 'createacct-another-email-ph' : 'createacct-email-ph' )->text() - ) ); + ] ); ?> @@ -193,13 +193,13 @@ class UsercreateTemplate extends BaseTemplate { data['usereason'] ) { ?>
- data['reason'], 'text', array( + data['reason'], 'text', [ 'class' => 'mw-ui-input loginText', 'id' => 'wpReason', 'tabindex' => '8', 'size' => '20', 'placeholder' => $this->getMsg( 'createacct-reason-ph' )->text() - ) ); ?> + ] ); ?>
@@ -265,15 +265,15 @@ class UsercreateTemplate extends BaseTemplate { getMsg( $this->data['loggedin'] ? 'createacct-another-submit' : 'createacct-submit' ), - array( + [ 'id' => 'wpCreateaccount', 'name' => 'wpCreateaccount', 'tabindex' => $tabIndex++ - ), - array( + ], + [ 'mw-ui-block', 'mw-ui-constructive', - ) + ] ); ?> diff --git a/includes/templates/Userlogin.php b/includes/templates/Userlogin.php index f19c0f2b75..c2b2df6f2f 100644 --- a/includes/templates/Userlogin.php +++ b/includes/templates/Userlogin.php @@ -67,15 +67,15 @@ class UserloginTemplate extends BaseTemplate { $this->msg( 'userlogin-yourname' ); if ( $this->data['secureLoginUrl'] ) { - echo Html::element( 'a', array( + echo Html::element( 'a', [ 'href' => $this->data['secureLoginUrl'], 'class' => 'mw-ui-flush-right mw-secure', - ), $this->getMsg( 'userlogin-signwithsecure' )->text() ); + ], $this->getMsg( 'userlogin-signwithsecure' )->text() ); } ?> data['name'], 'text', array( + echo Html::input( 'wpName', $this->data['name'], 'text', [ 'class' => 'loginText mw-ui-input', 'id' => 'wpName1', 'tabindex' => '1', @@ -85,7 +85,7 @@ class UserloginTemplate extends BaseTemplate { // Set focus to this field if it's blank. 'autofocus' => !$this->data['name'], 'placeholder' => $this->getMsg( 'userlogin-yourname-ph' )->text() - ) ); + ] ); ?> @@ -96,14 +96,14 @@ class UserloginTemplate extends BaseTemplate { ?> 'loginPassword mw-ui-input', 'id' => 'wpPassword1', 'tabindex' => '2', // Set focus to this field if username is filled in. 'autofocus' => (bool)$this->data['name'], 'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text() - ) ); + ] ); ?> @@ -142,14 +142,14 @@ class UserloginTemplate extends BaseTemplate {
'wpLoginAttempt', 'name' => 'wpLoginAttempt', 'tabindex' => '6', - ); - $modifiers = array( + ]; + $modifiers = [ 'mw-ui-progressive', - ); + ]; echo Html::submitButton( $this->getMsg( 'pt-login-button' )->text(), $attrs, $modifiers ); ?>
@@ -158,11 +158,11 @@ class UserloginTemplate extends BaseTemplate { Skin::makeInternalOrExternalUrl( wfMessage( 'helplogin-url' )->inContentLanguage()->text() ), - ), + ], $this->getMsg( 'userlogin-helplink2' )->text() ); ?> @@ -172,9 +172,9 @@ class UserloginTemplate extends BaseTemplate { if ( $this->data['useemail'] && $this->data['canreset'] && $this->data['resetlink'] === true ) { echo Html::rawElement( 'div', - array( + [ 'class' => 'mw-ui-vform-field mw-form-related-link-container', - ), + ], Linker::link( SpecialPage::getTitleFor( 'PasswordReset' ), $this->getMsg( 'userlogin-resetpassword-link' )->escaped() diff --git a/maintenance/benchmarks/bench_utf8_title_check.php b/maintenance/benchmarks/bench_utf8_title_check.php index bdb197fc11..62bb0fa114 100644 --- a/maintenance/benchmarks/bench_utf8_title_check.php +++ b/maintenance/benchmarks/bench_utf8_title_check.php @@ -38,7 +38,7 @@ class BenchUtf8TitleCheck extends Benchmarker { parent::__construct(); // @codingStandardsIgnoreStart Ignore long line warnings. - $this->data = array( + $this->data = [ "", "United States of America", // 7bit ASCII "S%C3%A9rie%20t%C3%A9l%C3%A9vis%C3%A9e", @@ -58,7 +58,7 @@ class BenchUtf8TitleCheck extends Benchmarker { . "Saison%207%20des%20Experts%7CSaison%208%20des%20Experts%7CSaison%209%20des%20Experts%7C" . "Sara%20Sidle%7CSofia%20Curtis%7CS%C3%A9rie%20t%C3%A9l%C3%A9vis%C3%A9e%7CWallace%20Langham%7C" . "Warrick%20Brown%7CWendy%20Simms%7C%C3%89tats-Unis" - ); + ]; // @codingStandardsIgnoreEnd $this->canRun = function_exists( 'mb_check_encoding' );