Change remaining places to use short array syntax
authorumherirrender <umherirrender_de.wp@web.de>
Fri, 11 Mar 2016 17:41:26 +0000 (18:41 +0100)
committerumherirrender <umherirrender_de.wp@web.de>
Fri, 11 Mar 2016 17:41:26 +0000 (18:41 +0100)
Change-Id: I0785c73a239c11188ad7411c5cd8ed09a2dbc9b3

includes/GitInfo.php
includes/changetags/ChangeTagsLogItem.php
includes/content/TextContentHandler.php
includes/diff/DifferenceEngine.php
includes/revisiondelete/RevDelLogItem.php
includes/templates/Usercreate.php
includes/templates/Userlogin.php
maintenance/benchmarks/bench_utf8_title_check.php

index 14f3cc1..29516ab 100644 (file)
@@ -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;
index 24bded7..2dc953c 100644 (file)
@@ -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(
index f5e8783..ad40cd9 100644 (file)
@@ -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
index a1a1bb0..44e6a24 100644 (file)
@@ -573,7 +573,7 @@ class DifferenceEngine extends ContextSource {
                <h2 class='diff-currentversion-title'>{$revHeader}</h2>\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 {
index 65b0309..1ea7271 100644 (file)
@@ -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;
index a39690a..3824be1 100644 (file)
@@ -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 {
                                        <span class="mw-ui-flush-right"><?php echo $this->getMsg( 'createacct-helpusername' )->parse(); ?></span>
                                </label>
                                <?php
-                               echo Html::input( 'wpName', $this->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(),
-                               ) );
+                               ] );
                                ?>
                        </div>
 
@@ -113,14 +113,14 @@ class UsercreateTemplate extends BaseTemplate {
                        <div class="mw-ui-vform-field mw-row-password">
                                <label for='wpPassword2'><?php $this->msg( 'userlogin-yourpassword' ); ?></label>
                                <?php
-                               echo Html::input( 'wpPassword', null, 'password', array(
+                               echo Html::input( 'wpPassword', null, 'password', [
                                        'class' => 'mw-ui-input loginPassword',
                                        'id' => 'wpPassword2',
                                        'tabindex' => '3',
                                        'size' => '20',
                                        'required',
                                        'placeholder' => $this->getMsg( 'createacct-yourpassword-ph' )->text()
-                               ) + User::passwordChangeInputAttribs() );
+                               ] + User::passwordChangeInputAttribs() );
                                ?>
                        </div>
 
@@ -143,14 +143,14 @@ class UsercreateTemplate extends BaseTemplate {
                        <div class="mw-ui-vform-field mw-row-password">
                                <label for='wpRetype'><?php $this->msg( 'createacct-yourpasswordagain' ); ?></label>
                                <?php
-                               echo Html::input( 'wpRetype', null, 'password', array(
+                               echo Html::input( 'wpRetype', null, 'password', [
                                        'class' => 'mw-ui-input loginPassword',
                                        'id' => 'wpRetype',
                                        'tabindex' => '5',
                                        'size' => '20',
                                        'required',
                                        'placeholder' => $this->getMsg( 'createacct-yourpasswordagain-ph' )->text()
-                                       ) + User::passwordChangeInputAttribs() );
+                               ] + User::passwordChangeInputAttribs() );
                                ?>
                        </div>
 
@@ -165,7 +165,7 @@ class UsercreateTemplate extends BaseTemplate {
                                                ?>
                                        </label>
                                        <?php
-                                               echo Html::input( 'wpEmail', $this->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()
-                                               ) );
+                                               ] );
                                        ?>
                                <?php } ?>
                        </div>
@@ -193,13 +193,13 @@ class UsercreateTemplate extends BaseTemplate {
                        <?php if ( $this->data['usereason'] ) { ?>
                                <div class="mw-ui-vform-field">
                                        <label for='wpReason'><?php $this->msg( 'createacct-reason' ); ?></label>
-                                       <?php echo Html::input( 'wpReason', $this->data['reason'], 'text', array(
+                                       <?php echo Html::input( 'wpReason', $this->data['reason'], 'text', [
                                                'class' => 'mw-ui-input loginText',
                                                'id' => 'wpReason',
                                                'tabindex' => '8',
                                                'size' => '20',
                                                'placeholder' => $this->getMsg( 'createacct-reason-ph' )->text()
-                                       ) ); ?>
+                                       ] ); ?>
                                </div>
                        <?php } ?>
 
@@ -265,15 +265,15 @@ class UsercreateTemplate extends BaseTemplate {
                                <?php
                                echo Html::submitButton(
                                        $this->getMsg( $this->data['loggedin'] ? 'createacct-another-submit' : 'createacct-submit' ),
-                                       array(
+                                       [
                                                'id' => 'wpCreateaccount',
                                                'name' => 'wpCreateaccount',
                                                'tabindex' => $tabIndex++
-                                       ),
-                                       array(
+                                       ],
+                                       [
                                                'mw-ui-block',
                                                'mw-ui-constructive',
-                                       )
+                                       ]
                                );
                                ?>
                        </div>
index f19c0f2..c2b2df6 100644 (file)
@@ -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() );
                                        }
                                        ?>
                                </label>
                                <?php
-                               echo Html::input( 'wpName', $this->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()
-                               ) );
+                               ] );
                                ?>
                        </div>
 
@@ -96,14 +96,14 @@ class UserloginTemplate extends BaseTemplate {
                                        ?>
                                </label>
                                <?php
-                               echo Html::input( 'wpPassword', null, 'password', array(
+                               echo Html::input( 'wpPassword', null, 'password', [
                                        'class' => '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()
-                               ) );
+                               ] );
                                ?>
                        </div>
 
@@ -142,14 +142,14 @@ class UserloginTemplate extends BaseTemplate {
 
                        <div class="mw-ui-vform-field">
                                <?php
-                               $attrs = array(
+                               $attrs = [
                                        'id' => 'wpLoginAttempt',
                                        'name' => 'wpLoginAttempt',
                                        'tabindex' => '6',
-                               );
-                               $modifiers = array(
+                               ];
+                               $modifiers = [
                                        'mw-ui-progressive',
-                               );
+                               ];
                                echo Html::submitButton( $this->getMsg( 'pt-login-button' )->text(), $attrs, $modifiers );
                                ?>
                        </div>
@@ -158,11 +158,11 @@ class UserloginTemplate extends BaseTemplate {
                                <?php
                                echo Html::element(
                                        'a',
-                                       array(
+                                       [
                                                'href' => 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()
index bdb197f..62bb0fa 100644 (file)
@@ -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' );