[MediaWiki-commits] [Gerrit] mediawiki...SecurePoll[master]: Use short array syntax
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/358075 ) Change subject: Use short array syntax .. Use short array syntax Done by phpcbf over composer fix Change-Id: I6ba21315abbe586ce4237be991daade483b259a4 --- M SecurePoll.i18n.php M api/ApiStrikeVote.php M includes/crypt/Crypt.php M includes/entities/Election.php M includes/entities/Entity.php M includes/entities/Option.php M includes/entities/Question.php M includes/htmlform/HTMLFormRadioRangeColumnLabels.php M includes/jobs/PopulateVoterListJob.php M includes/main/Context.php M includes/main/SecurePollContentHandler.php M includes/main/SpecialSecurePoll.php M includes/main/Store.php M phpcs.xml 14 files changed, 247 insertions(+), 248 deletions(-) Approvals: Huji: Looks good to me, approved jenkins-bot: Verified diff --git a/SecurePoll.i18n.php b/SecurePoll.i18n.php index e2af401..b627ebd 100644 --- a/SecurePoll.i18n.php +++ b/SecurePoll.i18n.php @@ -10,10 +10,10 @@ * * This shim maintains compatibility back to MediaWiki 1.17. */ -$messages = array(); +$messages = []; if ( !function_exists( 'wfJsonI18nShim310d2110c88636f7' ) ) { function wfJsonI18nShim310d2110c88636f7( $cache, $code, &$cachedData ) { - $codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] ); + $codeSequence = array_merge( [ $code ], $cachedData['fallbackSequence'] ); foreach ( $codeSequence as $csCode ) { $fileName = __DIR__ . "/i18n/$csCode.json"; if ( is_readable( $fileName ) ) { diff --git a/api/ApiStrikeVote.php b/api/ApiStrikeVote.php index efd9046..7e6cefc 100644 --- a/api/ApiStrikeVote.php +++ b/api/ApiStrikeVote.php @@ -44,7 +44,7 @@ // if not logged in: fail $user = $this->getUser(); if ( !$user->isLoggedIn() ) { - if ( is_callable( array( $this, 'dieWithError' ) ) ) { + if ( is_callable( [ $this, 'dieWithError' ] ) ) { $this->dieWithError( 'apierror-securepoll-mustbeloggedin-strikevote', 'notloggedin' ); @@ -61,16 +61,16 @@ $db = $context->getDB(); $table = $db->tableName( 'securepoll_elections' ); $row = $db->selectRow( - array( 'securepoll_votes', 'securepoll_elections' ), + [ 'securepoll_votes', 'securepoll_elections' ], "$table.*", - array( 'vote_id' => $voteid, 'vote_election=el_entity' ), + [ 'vote_id' => $voteid, 'vote_election=el_entity' ], __METHOD__ ); // if no vote: fail if ( !$row ) { - if ( is_callable( array( $this, 'dieWithError' ) ) ) { - $this->dieWithError( array( 'apierror-securepoll-badvoteid', $voteid ), 'novote' ); + if ( is_callable( [ $this, 'dieWithError' ] ) ) { + $this->dieWithError( [ 'apierror-securepoll-badvoteid', $voteid ], 'novote' ); } else { $this->dieUsage( "$voteid is not a valid vote id.", 'novote' ); } @@ -81,7 +81,7 @@ $subpage->election = $context->newElectionFromRow( $row ); $status = $subpage->strike( $option, $voteid, $reason ); - $result = array(); + $result = []; if ( $status->isGood() ) { $result['status'] = 'good'; } else { @@ -103,32 +103,32 @@ } public function getAllowedParams() { - return array( - 'option' => array( - ApiBase::PARAM_TYPE => array( + return [ + 'option' => [ + ApiBase::PARAM_TYPE => [ 'strike', 'unstrike' - ), + ], ApiBase::PARAM_REQUIRED => true, - ApiBase::PARAM_HELP_MSG_PER_VALUE => array(), - ), - 'reason' => array( + ApiBase::PARAM_HELP_MSG_PER_VALUE => [], + ], + 'reason' => [ ApiBase::PARAM_TYPE => 'string', ApiBase::PARAM_REQUIRED => true, - ), - 'voteid' => array( + ], + 'voteid' => [
[MediaWiki-commits] [Gerrit] mediawiki...SecurePoll[master]: Use short array syntax - includes/*
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/358074 ) Change subject: Use short array syntax - includes/* .. Use short array syntax - includes/* Done by phpcbf over composer fix Change-Id: I257c0ac219c570263017f891359628be42b7cee9 --- M includes/ballots/ApprovalBallot.php M includes/ballots/Ballot.php M includes/ballots/ChooseBallot.php M includes/ballots/PreferentialBallot.php M includes/ballots/RadioRangeBallot.php M includes/ballots/RadioRangeCommentBallot.php M includes/talliers/CommentDumper.php M includes/talliers/ElectionTallier.php M includes/talliers/HistogramRangeTallier.php M includes/talliers/PairwiseTallier.php M includes/talliers/PluralityTallier.php M includes/talliers/SchulzeTallier.php M includes/talliers/Tallier.php M includes/user/Auth.php M includes/user/Voter.php 15 files changed, 186 insertions(+), 186 deletions(-) Approvals: Huji: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/ballots/ApprovalBallot.php b/includes/ballots/ApprovalBallot.php index eb93a2e..b33ea39 100644 --- a/includes/ballots/ApprovalBallot.php +++ b/includes/ballots/ApprovalBallot.php @@ -5,7 +5,7 @@ */ class SecurePoll_ApprovalBallot extends SecurePoll_Ballot { static function getTallyTypes() { - return array( 'plurality' ); + return [ 'plurality' ]; } /** @@ -24,9 +24,9 @@ $oldValue = $wgRequest->getBool( $inputId ); $s .= '' . - Xml::check( $inputId, $oldValue, array( 'id' => $inputId ) ) . + Xml::check( $inputId, $oldValue, [ 'id' => $inputId ] ) . '' . - Xml::tags( 'label', array( 'for' => $inputId ), $optionHTML ) . + Xml::tags( 'label', [ 'for' => $inputId ], $optionHTML ) . '' . "\n"; } @@ -53,7 +53,7 @@ } function unpackRecord( $record ) { - $scores = array(); + $scores = []; $itemLength = 2 * 8 + 7; for ( $offset = 0, $len = strlen( $record ); $offset < $len; $offset += $itemLength ) { if ( !preg_match( '/Q([0-9A-F]{8})-A([0-9A-F]{8})-([yn])--/A', @@ -70,8 +70,8 @@ return $scores; } - function convertScores( $scores, $params = array() ) { - $result = array(); + function convertScores( $scores, $params = [] ) { + $result = []; foreach ( $this->election->getQuestions() as $question ) { $qid = $question->getId(); if ( !isset( $scores[$qid] ) ) { diff --git a/includes/ballots/Ballot.php b/includes/ballots/Ballot.php index 2a65f12..2e4e321 100644 --- a/includes/ballots/Ballot.php +++ b/includes/ballots/Ballot.php @@ -6,13 +6,13 @@ abstract class SecurePoll_Ballot { public $election, $context; - private static $ballotTypes = array( + private static $ballotTypes = [ 'approval' => 'SecurePoll_ApprovalBallot', 'preferential' => 'SecurePoll_PreferentialBallot', 'choose' => 'SecurePoll_ChooseBallot', 'radio-range' => 'SecurePoll_RadioRangeBallot', 'radio-range-comment' => 'SecurePoll_RadioRangeCommentBallot', - ); + ]; /** * Get a list of names of tallying methods, which may be used to produce a @@ -36,24 +36,24 @@ * @return array */ static function getCreateDescriptors() { - return array( - 'election' => array( - 'shuffle-questions' => array( + return [ + 'election' => [ + 'shuffle-questions' => [ 'label-message' => 'securepoll-create-label-shuffle_questions', 'type' => 'check', 'hidelabel' => true, 'SecurePoll_type' => 'property', - ), - 'shuffle-options' => array( + ], + 'shuffle-options' => [ 'label-message' => 'securepoll-create-label-shuffle_options', 'type' => 'check', 'hidelabel' => true, 'SecurePoll_type' => 'property', - ), - ), - 'question' => array(), -
[MediaWiki-commits] [Gerrit] mediawiki...SecurePoll[master]: Use short array syntax - includes/pages
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/358073 ) Change subject: Use short array syntax - includes/pages .. Use short array syntax - includes/pages Done by phpcbf over composer fix Change-Id: I17aa9005f8b2cf4fcd8c2455dcb9b3c017c1 --- M includes/pages/ActionPage.php M includes/pages/CreatePage.php M includes/pages/DetailsPage.php M includes/pages/DumpPage.php M includes/pages/EntryPage.php M includes/pages/ListPage.php M includes/pages/MessageDumpPage.php M includes/pages/TallyPage.php M includes/pages/TranslatePage.php M includes/pages/VotePage.php M includes/pages/VoterEligibilityPage.php 11 files changed, 444 insertions(+), 444 deletions(-) Approvals: Huji: Verified; Looks good to me, approved jenkins-bot: Verified diff --git a/includes/pages/ActionPage.php b/includes/pages/ActionPage.php index 5cf05b0..a7227dd 100644 --- a/includes/pages/ActionPage.php +++ b/includes/pages/ActionPage.php @@ -45,7 +45,7 @@ } $languages = array_merge( - array( $userLang ), + [ $userLang ], Language::getFallbacksFor( $userLang ) ); if ( !in_array( $election->getLanguage(), $languages ) ) { @@ -61,6 +61,6 @@ * Relay for SpecialPage::msg */ protected function msg( /* args */ ) { - return call_user_func_array( array( $this->specialPage, 'msg' ), func_get_args() ); + return call_user_func_array( [ $this->specialPage, 'msg' ], func_get_args() ); } } diff --git a/includes/pages/CreatePage.php b/includes/pages/CreatePage.php index d7b638c..2e44e02 100644 --- a/includes/pages/CreatePage.php +++ b/includes/pages/CreatePage.php @@ -66,38 +66,38 @@ # These are for injecting raw HTML into the HTMLForm for the # multi-column aspects of the designed layout. - $layoutTableStart = array( + $layoutTableStart = [ 'type' => 'info', 'rawrow' => true, 'default' => '', - ); - $layoutTableMid = array( + ]; + $layoutTableMid = [ 'type' => 'info', 'rawrow' => true, 'default' => '', - ); - $layoutTableEnd = array( + ]; + $layoutTableEnd = [ 'type' => 'info', 'rawrow' => true, 'default' => '', - ); + ]; - $formItems = array(); + $formItems = []; - $formItems['election_id'] = array( + $formItems['election_id'] = [ 'type' => 'hidden', 'default' => -1, 'output-as-default' => false, - ); + ]; - $formItems['election_title'] = array( + $formItems['election_title'] = [ 'label-message' => 'securepoll-create-label-election_title', 'type' => 'text', 'required' => true, - ); + ]; $wikiNames = SecurePoll_FormStore::getWikiList(); - $options = array(); + $options = []; $options['securepoll-create-option-wiki-this_wiki'] = wfWikiID(); if ( count( $wikiNames ) > 1 ) { $options['securepoll-create-option-wiki-all_wikis'] = '*'; @@ -112,7 +112,7 @@ // Only option is wfWikiID(), so don't bother making the user select it. } elseif ( count( $wikiNames ) < 10 ) { // So few, we may as well just list them explicitly - $opts = array(); + $opts = []; foreach ( $options as $msg => $value ) { $opts[$this->msg( $msg )->plain()] = $value; } @@ -124,165 +124,165 @@ $opts[$this->msg( 'securepoll-create-option-wiki-other_wiki' )->plain()] = $wikiNames; } - $formItems['property_wiki'] = array( + $formItems['property_wiki'] = [ 'type' => 'select', 'options' => $opts, 'label-message' => 'securepoll-create-label-wiki', - ); + ]; } else { $options['securepoll-create-option-wiki-other_wiki'] = 'other'; - $formItems['property_wiki'] = array( +
[MediaWiki-commits] [Gerrit] mediawiki...SecurePoll[master]: Use short array syntax - cli
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/358072 ) Change subject: Use short array syntax - cli .. Use short array syntax - cli Done by phpcbf over composer fix Change-Id: Idd3caa4eaf982d8bd21afc3c0e8766fe390021ba --- M cli/convertVotes.php M cli/delete.php M cli/dump.php M cli/dumpComments.php M cli/dumpVoteCsv.php M cli/import.php M cli/makeSimpleList.php M cli/purgePrivateVoteData.php M cli/tally.php M cli/testDebian.php M cli/voterList.php M cli/wm-scripts/bv2013/buildSpamTranslations.php M cli/wm-scripts/bv2013/doSpam.php M cli/wm-scripts/bv2013/dumpMetaTranslations.php M cli/wm-scripts/bv2013/populateEditCount.php M cli/wm-scripts/bv2013/sendMails.php M cli/wm-scripts/bv2013/voterList.php M cli/wm-scripts/bv2015/doSpam.php M cli/wm-scripts/bv2015/populateEditCount-fixup.php M cli/wm-scripts/bv2015/populateEditCount.php M cli/wm-scripts/bv2015/voterList.php M cli/wm-scripts/bv2017/doSpam.php M cli/wm-scripts/bv2017/populateEditCount.php M cli/wm-scripts/bv2017/voterList.php M cli/wm-scripts/dumpGlobalVoterList.php 25 files changed, 282 insertions(+), 282 deletions(-) Approvals: Huji: Looks good to me, approved jenkins-bot: Verified diff --git a/cli/convertVotes.php b/cli/convertVotes.php index ed9c385..b69198d 100644 --- a/cli/convertVotes.php +++ b/cli/convertVotes.php @@ -57,12 +57,12 @@ } function convert( $electionId ) { - $this->votes = array(); + $this->votes = []; $this->crypt = $this->election->getCrypt(); $this->ballot = $this->election->getBallot(); $status = $this->context->getStore()->callbackValidVotes( - $electionId, array( $this, 'convertVote' ) ); + $electionId, [ $this, 'convertVote' ] ); if ( !$status->isOK() ) { spFatal( "Error: " . $status->getWikiText() ); } @@ -72,7 +72,7 @@ $s .= str_repeat( '-', 80 ) . "\n\n"; } $s .= $question->getMessage( 'text' ) . "\n"; - $names = array(); + $names = []; foreach ( $question->getOptions() as $option ) { $names[$option->getId()] = $option->getMessage( 'text' ); } diff --git a/cli/delete.php b/cli/delete.php index 17443ed..60ae029 100644 --- a/cli/delete.php +++ b/cli/delete.php @@ -29,8 +29,8 @@ $dbw = wfGetDB( DB_MASTER ); $type = $dbw->selectField( 'securepoll_entity', 'en_type', - array( 'en_id' => $electionId ), - __METHOD__, array( 'FOR UPDATE' ) ); + [ 'en_id' => $electionId ], + __METHOD__, [ 'FOR UPDATE' ] ); if ( !$type ) { echo "The specified id does not exist.\n"; return false; @@ -41,37 +41,37 @@ } # Get a list of entity IDs and lock them - $questionIds = array(); - $res = $dbw->select( 'securepoll_questions', array( 'qu_entity' ), - array( 'qu_election' => $electionId ), - __METHOD__, array( 'FOR UPDATE' ) ); + $questionIds = []; + $res = $dbw->select( 'securepoll_questions', [ 'qu_entity' ], + [ 'qu_election' => $electionId ], + __METHOD__, [ 'FOR UPDATE' ] ); foreach ( $res as $row ) { $questionIds[] = $row->qu_entity; } - $res = $dbw->select( 'securepoll_options', array( 'op_entity' ), - array( 'op_election' => $electionId ), - __METHOD__, array( 'FOR UPDATE' ) ); - $optionIds = array(); + $res = $dbw->select( 'securepoll_options', [ 'op_entity' ], + [ 'op_election' => $electionId ], + __METHOD__, [ 'FOR UPDATE' ] ); + $optionIds = []; foreach ( $res as $row ) { $optionIds[] = $row->op_entity; } - $entityIds = array_merge( $optionIds, $questionIds, array( $electionId ) ); + $entityIds = array_merge( $optionIds, $questionIds, [ $electionId ] ); # Delete the messages and properties - $dbw->delete( 'securepoll_msgs', array( 'msg_entity' => $entityIds ) ); - $dbw->delete( 'securepoll_properties', array( 'pr_entity' => $entityIds ) ); + $dbw->delete( 'securepoll_msgs', [ 'msg_entity' => $entityIds ] ); + $dbw->delete( 'securepoll_properties', [ 'pr_entity' => $entityIds ] ); # Delete the entities if ( $optionIds ) { - $dbw->delete( 'securepoll_options', array( 'op_entity' => $optionIds ), __METHOD__ ); + $dbw->delete( 'securepoll_options', [ 'op_entity' => $optionIds ], __METHOD__ ); } if ( $questionIds ) { - $dbw->delete(
[MediaWiki-commits] [Gerrit] mediawiki...SecurePoll[master]: Use short array syntax in alias file
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/358071 ) Change subject: Use short array syntax in alias file .. Use short array syntax in alias file Done by phpcbf over composer fix Change-Id: Icef22be9cfe8b5a4711d0f2dec3bd52a27959ed7 --- M SecurePoll.alias.php M SecurePoll.namespaces.php 2 files changed, 148 insertions(+), 149 deletions(-) Approvals: Huji: Looks good to me, approved jenkins-bot: Verified diff --git a/SecurePoll.alias.php b/SecurePoll.alias.php index e765c26..33b1b38 100644 --- a/SecurePoll.alias.php +++ b/SecurePoll.alias.php @@ -5,246 +5,245 @@ * @file * @ingroup Extensions */ -// @codingStandardsIgnoreFile -$specialPageAliases = array(); +$specialPageAliases = []; /** English (English) */ -$specialPageAliases['en'] = array( - 'SecurePoll' => array( 'SecurePoll' ), -); +$specialPageAliases['en'] = [ + 'SecurePoll' => [ 'SecurePoll' ], +]; /** Arabic (العربية) */ -$specialPageAliases['ar'] = array( - 'SecurePoll' => array( 'اقتراع_آمن' ), -); +$specialPageAliases['ar'] = [ + 'SecurePoll' => [ 'اقتراع_آمن' ], +]; /** Egyptian Arabic (مصرى) */ -$specialPageAliases['arz'] = array( - 'SecurePoll' => array( 'استطلاع_رأى_امان' ), -); +$specialPageAliases['arz'] = [ + 'SecurePoll' => [ 'استطلاع_رأى_امان' ], +]; /** Avaric (авар) */ -$specialPageAliases['av'] = array( - 'SecurePoll' => array( 'Защищённое_голосование' ), -); +$specialPageAliases['av'] = [ + 'SecurePoll' => [ 'Защищённое_голосование' ], +]; /** Bashkir (башҡортса) */ -$specialPageAliases['ba'] = array( - 'SecurePoll' => array( 'SecurePoll' ), -); +$specialPageAliases['ba'] = [ + 'SecurePoll' => [ 'SecurePoll' ], +]; /** Western Balochi (بلوچی رخشانی) */ -$specialPageAliases['bgn'] = array( - 'SecurePoll' => array( 'ایمنین_رای_گیره_گ' ), -); +$specialPageAliases['bgn'] = [ + 'SecurePoll' => [ 'ایمنین_رای_گیره_گ' ], +]; /** Bengali (বাংলা) */ -$specialPageAliases['bn'] = array( - 'SecurePoll' => array( 'সিকিউর_পোল' ), -); +$specialPageAliases['bn'] = [ + 'SecurePoll' => [ 'সিকিউর_পোল' ], +]; /** Chechen (нохчийн) */ -$specialPageAliases['ce'] = array( - 'SecurePoll' => array( 'Лардина_кхаж_тасар' ), -); +$specialPageAliases['ce'] = [ + 'SecurePoll' => [ 'Лардина_кхаж_тасар' ], +]; /** Czech (čeština) */ -$specialPageAliases['cs'] = array( - 'SecurePoll' => array( 'Bezpečné_hlasování' ), -); +$specialPageAliases['cs'] = [ + 'SecurePoll' => [ 'Bezpečné_hlasování' ], +]; /** Danish (dansk) */ -$specialPageAliases['da'] = array( - 'SecurePoll' => array( 'Sikker_afstemning' ), -); +$specialPageAliases['da'] = [ + 'SecurePoll' => [ 'Sikker_afstemning' ], +]; /** German (Deutsch) */ -$specialPageAliases['de'] = array( - 'SecurePoll' => array( 'Sichere_Abstimmung' ), -); +$specialPageAliases['de'] = [ + 'SecurePoll' => [ 'Sichere_Abstimmung' ], +]; /** Zazaki (Zazaki) */ -$specialPageAliases['diq'] = array( - 'SecurePoll' => array( 'Dolaİtimadi' ), -); +$specialPageAliases['diq'] = [ + 'SecurePoll' => [ 'Dolaİtimadi' ], +]; /** Lower Sorbian (dolnoserbski) */ -$specialPageAliases['dsb'] = array( - 'SecurePoll' => array( 'Wěste wótgłosowanje' ), -); +$specialPageAliases['dsb'] = [ + 'SecurePoll' => [ 'Wěste wótgłosowanje' ], +]; /** Estonian (eesti) */ -$specialPageAliases['et'] = array( - 'SecurePoll' => array( 'Turvaline_hääletus' ), -); +$specialPageAliases['et'] = [ + 'SecurePoll' => [ 'Turvaline_hääletus' ], +]; /** Persian (فارسی) */ -$specialPageAliases['fa'] = array( - 'SecurePoll' => array( 'نظرسنجی_امن', 'رأیگیری_ایمن' ), -); +$specialPageAliases['fa'] = [ + 'SecurePoll' => [ 'نظرسنجی_امن', 'رأیگیری_ایمن' ], +]; /** Finnish (suomi) */ -$specialPageAliases['fi'] = array( - 'SecurePoll' => array( 'Suojattu_kysely' ), -); +$specialPageAliases['fi'] = [ + 'SecurePoll' => [ 'Suojattu_kysely' ], +]; /** French (français) */ -$specialPageAliases['fr'] = array( - 'SecurePoll' => array( 'Vote_sécurisé' ), -); +$specialPageAliases['fr'] = [ + 'SecurePoll' => [ 'Vote_sécurisé' ], +]; /** Arpitan (arpetan) */ -$specialPageAliases['frp'] = array( - 'SecurePoll' => array( 'Voto_sècurisâ', 'VotoSècurisâ' ), -); +$specialPageAliases['frp'] = [ + 'SecurePoll' => [ 'Voto_sècurisâ', 'VotoSècurisâ' ], +]; /** Galician (galego) */ -$specialPageAliases['gl'] = array( - 'SecurePoll' => array( 'Enquisa_segura' ), -); +$specialPageAliases['gl'] = [ + 'SecurePoll' => [ 'Enquisa_segura' ], +]; /** Swiss German (Alemannisch) */ -$specialPageAliases['gsw'] = array( - 'SecurePoll' => array( 'Sicheri_Abstimmig' ), -); +$specialPageAliases['gsw'] = [ + 'SecurePoll' => [ 'Sicheri_Abstimmig' ], +]; /** Hebrew (עברית) */
[MediaWiki-commits] [Gerrit] mediawiki...SecurePoll[master]: Use short array syntax - includes/*
Umherirrender has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/358074 ) Change subject: Use short array syntax - includes/* .. Use short array syntax - includes/* Done by phpcbf over composer fix Change-Id: I257c0ac219c570263017f891359628be42b7cee9 --- M includes/ballots/ApprovalBallot.php M includes/ballots/Ballot.php M includes/ballots/ChooseBallot.php M includes/ballots/PreferentialBallot.php M includes/ballots/RadioRangeBallot.php M includes/ballots/RadioRangeCommentBallot.php M includes/talliers/CommentDumper.php M includes/talliers/ElectionTallier.php M includes/talliers/HistogramRangeTallier.php M includes/talliers/PairwiseTallier.php M includes/talliers/PluralityTallier.php M includes/talliers/SchulzeTallier.php M includes/talliers/Tallier.php M includes/user/Auth.php M includes/user/Voter.php 15 files changed, 186 insertions(+), 186 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SecurePoll refs/changes/74/358074/1 diff --git a/includes/ballots/ApprovalBallot.php b/includes/ballots/ApprovalBallot.php index eb93a2e..b33ea39 100644 --- a/includes/ballots/ApprovalBallot.php +++ b/includes/ballots/ApprovalBallot.php @@ -5,7 +5,7 @@ */ class SecurePoll_ApprovalBallot extends SecurePoll_Ballot { static function getTallyTypes() { - return array( 'plurality' ); + return [ 'plurality' ]; } /** @@ -24,9 +24,9 @@ $oldValue = $wgRequest->getBool( $inputId ); $s .= '' . - Xml::check( $inputId, $oldValue, array( 'id' => $inputId ) ) . + Xml::check( $inputId, $oldValue, [ 'id' => $inputId ] ) . '' . - Xml::tags( 'label', array( 'for' => $inputId ), $optionHTML ) . + Xml::tags( 'label', [ 'for' => $inputId ], $optionHTML ) . '' . "\n"; } @@ -53,7 +53,7 @@ } function unpackRecord( $record ) { - $scores = array(); + $scores = []; $itemLength = 2 * 8 + 7; for ( $offset = 0, $len = strlen( $record ); $offset < $len; $offset += $itemLength ) { if ( !preg_match( '/Q([0-9A-F]{8})-A([0-9A-F]{8})-([yn])--/A', @@ -70,8 +70,8 @@ return $scores; } - function convertScores( $scores, $params = array() ) { - $result = array(); + function convertScores( $scores, $params = [] ) { + $result = []; foreach ( $this->election->getQuestions() as $question ) { $qid = $question->getId(); if ( !isset( $scores[$qid] ) ) { diff --git a/includes/ballots/Ballot.php b/includes/ballots/Ballot.php index 2a65f12..2e4e321 100644 --- a/includes/ballots/Ballot.php +++ b/includes/ballots/Ballot.php @@ -6,13 +6,13 @@ abstract class SecurePoll_Ballot { public $election, $context; - private static $ballotTypes = array( + private static $ballotTypes = [ 'approval' => 'SecurePoll_ApprovalBallot', 'preferential' => 'SecurePoll_PreferentialBallot', 'choose' => 'SecurePoll_ChooseBallot', 'radio-range' => 'SecurePoll_RadioRangeBallot', 'radio-range-comment' => 'SecurePoll_RadioRangeCommentBallot', - ); + ]; /** * Get a list of names of tallying methods, which may be used to produce a @@ -36,24 +36,24 @@ * @return array */ static function getCreateDescriptors() { - return array( - 'election' => array( - 'shuffle-questions' => array( + return [ + 'election' => [ + 'shuffle-questions' => [ 'label-message' => 'securepoll-create-label-shuffle_questions', 'type' => 'check', 'hidelabel' => true, 'SecurePoll_type' => 'property', - ), - 'shuffle-options' => array( + ], + 'shuffle-options' => [ 'label-message' => 'securepoll-create-label-shuffle_options', 'type' => 'check', 'hidelabel' => true, 'SecurePoll_type' => 'property', - ), - ), - 'question' =>
[MediaWiki-commits] [Gerrit] mediawiki...SecurePoll[master]: Use short array syntax - cli
Umherirrender has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/358072 ) Change subject: Use short array syntax - cli .. Use short array syntax - cli Done by phpcbf over composer fix Change-Id: Idd3caa4eaf982d8bd21afc3c0e8766fe390021ba --- M cli/convertVotes.php M cli/delete.php M cli/dump.php M cli/dumpComments.php M cli/dumpVoteCsv.php M cli/import.php M cli/makeSimpleList.php M cli/purgePrivateVoteData.php M cli/tally.php M cli/testDebian.php M cli/voterList.php M cli/wm-scripts/bv2013/buildSpamTranslations.php M cli/wm-scripts/bv2013/doSpam.php M cli/wm-scripts/bv2013/dumpMetaTranslations.php M cli/wm-scripts/bv2013/populateEditCount.php M cli/wm-scripts/bv2013/sendMails.php M cli/wm-scripts/bv2013/voterList.php M cli/wm-scripts/bv2015/doSpam.php M cli/wm-scripts/bv2015/populateEditCount-fixup.php M cli/wm-scripts/bv2015/populateEditCount.php M cli/wm-scripts/bv2015/voterList.php M cli/wm-scripts/bv2017/doSpam.php M cli/wm-scripts/bv2017/populateEditCount.php M cli/wm-scripts/bv2017/voterList.php M cli/wm-scripts/dumpGlobalVoterList.php 25 files changed, 282 insertions(+), 282 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SecurePoll refs/changes/72/358072/1 diff --git a/cli/convertVotes.php b/cli/convertVotes.php index ed9c385..b69198d 100644 --- a/cli/convertVotes.php +++ b/cli/convertVotes.php @@ -57,12 +57,12 @@ } function convert( $electionId ) { - $this->votes = array(); + $this->votes = []; $this->crypt = $this->election->getCrypt(); $this->ballot = $this->election->getBallot(); $status = $this->context->getStore()->callbackValidVotes( - $electionId, array( $this, 'convertVote' ) ); + $electionId, [ $this, 'convertVote' ] ); if ( !$status->isOK() ) { spFatal( "Error: " . $status->getWikiText() ); } @@ -72,7 +72,7 @@ $s .= str_repeat( '-', 80 ) . "\n\n"; } $s .= $question->getMessage( 'text' ) . "\n"; - $names = array(); + $names = []; foreach ( $question->getOptions() as $option ) { $names[$option->getId()] = $option->getMessage( 'text' ); } diff --git a/cli/delete.php b/cli/delete.php index 17443ed..60ae029 100644 --- a/cli/delete.php +++ b/cli/delete.php @@ -29,8 +29,8 @@ $dbw = wfGetDB( DB_MASTER ); $type = $dbw->selectField( 'securepoll_entity', 'en_type', - array( 'en_id' => $electionId ), - __METHOD__, array( 'FOR UPDATE' ) ); + [ 'en_id' => $electionId ], + __METHOD__, [ 'FOR UPDATE' ] ); if ( !$type ) { echo "The specified id does not exist.\n"; return false; @@ -41,37 +41,37 @@ } # Get a list of entity IDs and lock them - $questionIds = array(); - $res = $dbw->select( 'securepoll_questions', array( 'qu_entity' ), - array( 'qu_election' => $electionId ), - __METHOD__, array( 'FOR UPDATE' ) ); + $questionIds = []; + $res = $dbw->select( 'securepoll_questions', [ 'qu_entity' ], + [ 'qu_election' => $electionId ], + __METHOD__, [ 'FOR UPDATE' ] ); foreach ( $res as $row ) { $questionIds[] = $row->qu_entity; } - $res = $dbw->select( 'securepoll_options', array( 'op_entity' ), - array( 'op_election' => $electionId ), - __METHOD__, array( 'FOR UPDATE' ) ); - $optionIds = array(); + $res = $dbw->select( 'securepoll_options', [ 'op_entity' ], + [ 'op_election' => $electionId ], + __METHOD__, [ 'FOR UPDATE' ] ); + $optionIds = []; foreach ( $res as $row ) { $optionIds[] = $row->op_entity; } - $entityIds = array_merge( $optionIds, $questionIds, array( $electionId ) ); + $entityIds = array_merge( $optionIds, $questionIds, [ $electionId ] ); # Delete the messages and properties - $dbw->delete( 'securepoll_msgs', array( 'msg_entity' => $entityIds ) ); - $dbw->delete( 'securepoll_properties', array( 'pr_entity' => $entityIds ) ); + $dbw->delete( 'securepoll_msgs', [ 'msg_entity' => $entityIds ] ); + $dbw->delete( 'securepoll_properties', [ 'pr_entity' => $entityIds ] ); # Delete the entities if ( $optionIds ) { - $dbw->delete( 'securepoll_options', array( 'op_entity' => $optionIds ), __METHOD__ ); + $dbw->delete( 'securepoll_options', [ 'op_entity' => $optionIds ], __METHOD__ ); } if ( $questionIds ) { -
[MediaWiki-commits] [Gerrit] mediawiki...SecurePoll[master]: Use short array syntax - includes/pages
Umherirrender has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/358073 ) Change subject: Use short array syntax - includes/pages .. Use short array syntax - includes/pages Done by phpcbf over composer fix Change-Id: I17aa9005f8b2cf4fcd8c2455dcb9b3c017c1 --- M includes/pages/ActionPage.php M includes/pages/CreatePage.php M includes/pages/DetailsPage.php M includes/pages/DumpPage.php M includes/pages/EntryPage.php M includes/pages/ListPage.php M includes/pages/MessageDumpPage.php M includes/pages/TallyPage.php M includes/pages/TranslatePage.php M includes/pages/VotePage.php M includes/pages/VoterEligibilityPage.php 11 files changed, 444 insertions(+), 444 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SecurePoll refs/changes/73/358073/1 diff --git a/includes/pages/ActionPage.php b/includes/pages/ActionPage.php index 5cf05b0..a7227dd 100644 --- a/includes/pages/ActionPage.php +++ b/includes/pages/ActionPage.php @@ -45,7 +45,7 @@ } $languages = array_merge( - array( $userLang ), + [ $userLang ], Language::getFallbacksFor( $userLang ) ); if ( !in_array( $election->getLanguage(), $languages ) ) { @@ -61,6 +61,6 @@ * Relay for SpecialPage::msg */ protected function msg( /* args */ ) { - return call_user_func_array( array( $this->specialPage, 'msg' ), func_get_args() ); + return call_user_func_array( [ $this->specialPage, 'msg' ], func_get_args() ); } } diff --git a/includes/pages/CreatePage.php b/includes/pages/CreatePage.php index d7b638c..2e44e02 100644 --- a/includes/pages/CreatePage.php +++ b/includes/pages/CreatePage.php @@ -66,38 +66,38 @@ # These are for injecting raw HTML into the HTMLForm for the # multi-column aspects of the designed layout. - $layoutTableStart = array( + $layoutTableStart = [ 'type' => 'info', 'rawrow' => true, 'default' => '', - ); - $layoutTableMid = array( + ]; + $layoutTableMid = [ 'type' => 'info', 'rawrow' => true, 'default' => '', - ); - $layoutTableEnd = array( + ]; + $layoutTableEnd = [ 'type' => 'info', 'rawrow' => true, 'default' => '', - ); + ]; - $formItems = array(); + $formItems = []; - $formItems['election_id'] = array( + $formItems['election_id'] = [ 'type' => 'hidden', 'default' => -1, 'output-as-default' => false, - ); + ]; - $formItems['election_title'] = array( + $formItems['election_title'] = [ 'label-message' => 'securepoll-create-label-election_title', 'type' => 'text', 'required' => true, - ); + ]; $wikiNames = SecurePoll_FormStore::getWikiList(); - $options = array(); + $options = []; $options['securepoll-create-option-wiki-this_wiki'] = wfWikiID(); if ( count( $wikiNames ) > 1 ) { $options['securepoll-create-option-wiki-all_wikis'] = '*'; @@ -112,7 +112,7 @@ // Only option is wfWikiID(), so don't bother making the user select it. } elseif ( count( $wikiNames ) < 10 ) { // So few, we may as well just list them explicitly - $opts = array(); + $opts = []; foreach ( $options as $msg => $value ) { $opts[$this->msg( $msg )->plain()] = $value; } @@ -124,165 +124,165 @@ $opts[$this->msg( 'securepoll-create-option-wiki-other_wiki' )->plain()] = $wikiNames; } - $formItems['property_wiki'] = array( + $formItems['property_wiki'] = [ 'type' => 'select', 'options' => $opts, 'label-message' => 'securepoll-create-label-wiki', - ); + ]; } else { $options['securepoll-create-option-wiki-other_wiki'] = 'other'; - $formItems['property_wiki'] =
[MediaWiki-commits] [Gerrit] mediawiki...SecurePoll[master]: Use short array syntax
Umherirrender has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/358075 ) Change subject: Use short array syntax .. Use short array syntax Done by phpcbf over composer fix Change-Id: I6ba21315abbe586ce4237be991daade483b259a4 --- M SecurePoll.i18n.php M api/ApiStrikeVote.php M includes/crypt/Crypt.php M includes/entities/Election.php M includes/entities/Entity.php M includes/entities/Option.php M includes/entities/Question.php M includes/htmlform/HTMLFormRadioRangeColumnLabels.php M includes/jobs/PopulateVoterListJob.php M includes/main/Context.php M includes/main/SecurePollContentHandler.php M includes/main/SpecialSecurePoll.php M includes/main/Store.php M phpcs.xml 14 files changed, 247 insertions(+), 248 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SecurePoll refs/changes/75/358075/1 diff --git a/SecurePoll.i18n.php b/SecurePoll.i18n.php index e2af401..b627ebd 100644 --- a/SecurePoll.i18n.php +++ b/SecurePoll.i18n.php @@ -10,10 +10,10 @@ * * This shim maintains compatibility back to MediaWiki 1.17. */ -$messages = array(); +$messages = []; if ( !function_exists( 'wfJsonI18nShim310d2110c88636f7' ) ) { function wfJsonI18nShim310d2110c88636f7( $cache, $code, &$cachedData ) { - $codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] ); + $codeSequence = array_merge( [ $code ], $cachedData['fallbackSequence'] ); foreach ( $codeSequence as $csCode ) { $fileName = __DIR__ . "/i18n/$csCode.json"; if ( is_readable( $fileName ) ) { diff --git a/api/ApiStrikeVote.php b/api/ApiStrikeVote.php index efd9046..7e6cefc 100644 --- a/api/ApiStrikeVote.php +++ b/api/ApiStrikeVote.php @@ -44,7 +44,7 @@ // if not logged in: fail $user = $this->getUser(); if ( !$user->isLoggedIn() ) { - if ( is_callable( array( $this, 'dieWithError' ) ) ) { + if ( is_callable( [ $this, 'dieWithError' ] ) ) { $this->dieWithError( 'apierror-securepoll-mustbeloggedin-strikevote', 'notloggedin' ); @@ -61,16 +61,16 @@ $db = $context->getDB(); $table = $db->tableName( 'securepoll_elections' ); $row = $db->selectRow( - array( 'securepoll_votes', 'securepoll_elections' ), + [ 'securepoll_votes', 'securepoll_elections' ], "$table.*", - array( 'vote_id' => $voteid, 'vote_election=el_entity' ), + [ 'vote_id' => $voteid, 'vote_election=el_entity' ], __METHOD__ ); // if no vote: fail if ( !$row ) { - if ( is_callable( array( $this, 'dieWithError' ) ) ) { - $this->dieWithError( array( 'apierror-securepoll-badvoteid', $voteid ), 'novote' ); + if ( is_callable( [ $this, 'dieWithError' ] ) ) { + $this->dieWithError( [ 'apierror-securepoll-badvoteid', $voteid ], 'novote' ); } else { $this->dieUsage( "$voteid is not a valid vote id.", 'novote' ); } @@ -81,7 +81,7 @@ $subpage->election = $context->newElectionFromRow( $row ); $status = $subpage->strike( $option, $voteid, $reason ); - $result = array(); + $result = []; if ( $status->isGood() ) { $result['status'] = 'good'; } else { @@ -103,32 +103,32 @@ } public function getAllowedParams() { - return array( - 'option' => array( - ApiBase::PARAM_TYPE => array( + return [ + 'option' => [ + ApiBase::PARAM_TYPE => [ 'strike', 'unstrike' - ), + ], ApiBase::PARAM_REQUIRED => true, - ApiBase::PARAM_HELP_MSG_PER_VALUE => array(), - ), - 'reason' => array( + ApiBase::PARAM_HELP_MSG_PER_VALUE => [], + ], + 'reason' => [ ApiBase::PARAM_TYPE => 'string', ApiBase::PARAM_REQUIRED => true, - ), - 'voteid' => array( + ], + 'voteid' => [
[MediaWiki-commits] [Gerrit] mediawiki...SecurePoll[master]: Use short array syntax in alias file
Umherirrender has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/358071 ) Change subject: Use short array syntax in alias file .. Use short array syntax in alias file Done by phpcbf over composer fix Change-Id: Icef22be9cfe8b5a4711d0f2dec3bd52a27959ed7 --- M SecurePoll.alias.php M SecurePoll.namespaces.php 2 files changed, 148 insertions(+), 149 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SecurePoll refs/changes/71/358071/1 diff --git a/SecurePoll.alias.php b/SecurePoll.alias.php index e765c26..33b1b38 100644 --- a/SecurePoll.alias.php +++ b/SecurePoll.alias.php @@ -5,246 +5,245 @@ * @file * @ingroup Extensions */ -// @codingStandardsIgnoreFile -$specialPageAliases = array(); +$specialPageAliases = []; /** English (English) */ -$specialPageAliases['en'] = array( - 'SecurePoll' => array( 'SecurePoll' ), -); +$specialPageAliases['en'] = [ + 'SecurePoll' => [ 'SecurePoll' ], +]; /** Arabic (العربية) */ -$specialPageAliases['ar'] = array( - 'SecurePoll' => array( 'اقتراع_آمن' ), -); +$specialPageAliases['ar'] = [ + 'SecurePoll' => [ 'اقتراع_آمن' ], +]; /** Egyptian Arabic (مصرى) */ -$specialPageAliases['arz'] = array( - 'SecurePoll' => array( 'استطلاع_رأى_امان' ), -); +$specialPageAliases['arz'] = [ + 'SecurePoll' => [ 'استطلاع_رأى_امان' ], +]; /** Avaric (авар) */ -$specialPageAliases['av'] = array( - 'SecurePoll' => array( 'Защищённое_голосование' ), -); +$specialPageAliases['av'] = [ + 'SecurePoll' => [ 'Защищённое_голосование' ], +]; /** Bashkir (башҡортса) */ -$specialPageAliases['ba'] = array( - 'SecurePoll' => array( 'SecurePoll' ), -); +$specialPageAliases['ba'] = [ + 'SecurePoll' => [ 'SecurePoll' ], +]; /** Western Balochi (بلوچی رخشانی) */ -$specialPageAliases['bgn'] = array( - 'SecurePoll' => array( 'ایمنین_رای_گیره_گ' ), -); +$specialPageAliases['bgn'] = [ + 'SecurePoll' => [ 'ایمنین_رای_گیره_گ' ], +]; /** Bengali (বাংলা) */ -$specialPageAliases['bn'] = array( - 'SecurePoll' => array( 'সিকিউর_পোল' ), -); +$specialPageAliases['bn'] = [ + 'SecurePoll' => [ 'সিকিউর_পোল' ], +]; /** Chechen (нохчийн) */ -$specialPageAliases['ce'] = array( - 'SecurePoll' => array( 'Лардина_кхаж_тасар' ), -); +$specialPageAliases['ce'] = [ + 'SecurePoll' => [ 'Лардина_кхаж_тасар' ], +]; /** Czech (čeština) */ -$specialPageAliases['cs'] = array( - 'SecurePoll' => array( 'Bezpečné_hlasování' ), -); +$specialPageAliases['cs'] = [ + 'SecurePoll' => [ 'Bezpečné_hlasování' ], +]; /** Danish (dansk) */ -$specialPageAliases['da'] = array( - 'SecurePoll' => array( 'Sikker_afstemning' ), -); +$specialPageAliases['da'] = [ + 'SecurePoll' => [ 'Sikker_afstemning' ], +]; /** German (Deutsch) */ -$specialPageAliases['de'] = array( - 'SecurePoll' => array( 'Sichere_Abstimmung' ), -); +$specialPageAliases['de'] = [ + 'SecurePoll' => [ 'Sichere_Abstimmung' ], +]; /** Zazaki (Zazaki) */ -$specialPageAliases['diq'] = array( - 'SecurePoll' => array( 'Dolaİtimadi' ), -); +$specialPageAliases['diq'] = [ + 'SecurePoll' => [ 'Dolaİtimadi' ], +]; /** Lower Sorbian (dolnoserbski) */ -$specialPageAliases['dsb'] = array( - 'SecurePoll' => array( 'Wěste wótgłosowanje' ), -); +$specialPageAliases['dsb'] = [ + 'SecurePoll' => [ 'Wěste wótgłosowanje' ], +]; /** Estonian (eesti) */ -$specialPageAliases['et'] = array( - 'SecurePoll' => array( 'Turvaline_hääletus' ), -); +$specialPageAliases['et'] = [ + 'SecurePoll' => [ 'Turvaline_hääletus' ], +]; /** Persian (فارسی) */ -$specialPageAliases['fa'] = array( - 'SecurePoll' => array( 'نظرسنجی_امن', 'رأیگیری_ایمن' ), -); +$specialPageAliases['fa'] = [ + 'SecurePoll' => [ 'نظرسنجی_امن', 'رأیگیری_ایمن' ], +]; /** Finnish (suomi) */ -$specialPageAliases['fi'] = array( - 'SecurePoll' => array( 'Suojattu_kysely' ), -); +$specialPageAliases['fi'] = [ + 'SecurePoll' => [ 'Suojattu_kysely' ], +]; /** French (français) */ -$specialPageAliases['fr'] = array( - 'SecurePoll' => array( 'Vote_sécurisé' ), -); +$specialPageAliases['fr'] = [ + 'SecurePoll' => [ 'Vote_sécurisé' ], +]; /** Arpitan (arpetan) */ -$specialPageAliases['frp'] = array( - 'SecurePoll' => array( 'Voto_sècurisâ', 'VotoSècurisâ' ), -); +$specialPageAliases['frp'] = [ + 'SecurePoll' => [ 'Voto_sècurisâ', 'VotoSècurisâ' ], +]; /** Galician (galego) */ -$specialPageAliases['gl'] = array( - 'SecurePoll' => array( 'Enquisa_segura' ), -); +$specialPageAliases['gl'] = [ + 'SecurePoll' => [ 'Enquisa_segura' ], +]; /** Swiss German (Alemannisch) */ -$specialPageAliases['gsw'] = array( - 'SecurePoll' => array( 'Sicheri_Abstimmig' ), -); +$specialPageAliases['gsw'] = [ + 'SecurePoll' => [ 'Sicheri_Abstimmig' ], +]; /** Hebrew