From 9881ea93bedbf55a169c8115329961828b9c06ac Mon Sep 17 00:00:00 2001 From: Daimona Eaytoy Date: Tue, 3 Sep 2019 19:38:57 +0200 Subject: [PATCH] Better grouping for code adding elements to arrays Change-Id: I7cc8c810f0dcf1ee84b9d5f14967ec2568e3e0be Follow-up: I50377746f01749b058c39fd8229f9d566224cc43 --- includes/FileDeleteForm.php | 11 ++++++----- includes/LinkFilter.php | 2 +- includes/api/ApiBlock.php | 3 ++- includes/api/ApiUpload.php | 2 +- includes/page/Article.php | 3 ++- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/includes/FileDeleteForm.php b/includes/FileDeleteForm.php index 75eedcc4aa..9518b1d237 100644 --- a/includes/FileDeleteForm.php +++ b/includes/FileDeleteForm.php @@ -255,17 +255,18 @@ class FileDeleteForm { $wgOut->enableOOUI(); + $fields = []; + + $fields[] = new OOUI\LabelWidget( [ 'label' => new OOUI\HtmlSnippet( + $this->prepareMessage( 'filedelete-intro' ) ) ] + ); + $options = Xml::listDropDownOptions( $wgOut->msg( 'filedelete-reason-dropdown' )->inContentLanguage()->text(), [ 'other' => $wgOut->msg( 'filedelete-reason-otherlist' )->inContentLanguage()->text() ] ); $options = Xml::listDropDownOptionsOoui( $options ); - $fields = []; - $fields[] = new OOUI\LabelWidget( [ 'label' => new OOUI\HtmlSnippet( - $this->prepareMessage( 'filedelete-intro' ) ) ] - ); - $fields[] = new OOUI\FieldLayout( new OOUI\DropdownInputWidget( [ 'name' => 'wpDeleteReasonList', diff --git a/includes/LinkFilter.php b/includes/LinkFilter.php index c46df94d3c..e4a5f962d1 100644 --- a/includes/LinkFilter.php +++ b/includes/LinkFilter.php @@ -311,6 +311,7 @@ class LinkFilter { */ public static function makeLikeArray( $filterEntry, $protocol = 'http://' ) { $db = wfGetDB( DB_REPLICA ); + $like = []; $target = $protocol . $filterEntry; $bits = wfParseUrl( $target ); @@ -338,7 +339,6 @@ class LinkFilter { } } - $like = []; $like[] = $bits['scheme'] . $bits['delimiter'] . $bits['host']; if ( $subdomains ) { diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php index 755f319f98..30a9242c3b 100644 --- a/includes/api/ApiBlock.php +++ b/includes/api/ApiBlock.php @@ -140,9 +140,10 @@ class ApiBlock extends ApiBase { $this->dieStatus( $this->errorArrayToStatus( $retval ) ); } - list( $target, /*...*/ ) = SpecialBlock::getTargetAndType( $params['user'] ); $res = []; + $res['user'] = $params['user']; + list( $target, /*...*/ ) = SpecialBlock::getTargetAndType( $params['user'] ); $res['userID'] = $target instanceof User ? $target->getId() : 0; $block = DatabaseBlock::newFromTarget( $target, null, true ); diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index 3a54772f7c..373ec11271 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -793,8 +793,8 @@ class ApiUpload extends ApiBase { } } - $result = []; // No errors, no warnings: do the upload + $result = []; if ( $this->mParams['async'] ) { $progress = UploadBase::getSessionStatus( $this->getUser(), $this->mParams['filekey'] ); if ( $progress && $progress['result'] === 'Poll' ) { diff --git a/includes/page/Article.php b/includes/page/Article.php index 3628c7b69d..0149171312 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -1929,13 +1929,14 @@ class Article implements Page { $outputPage->enableOOUI(); + $fields = []; + $options = Xml::listDropDownOptions( $ctx->msg( 'deletereason-dropdown' )->inContentLanguage()->text(), [ 'other' => $ctx->msg( 'deletereasonotherlist' )->inContentLanguage()->text() ] ); $options = Xml::listDropDownOptionsOoui( $options ); - $fields = []; $fields[] = new OOUI\FieldLayout( new OOUI\DropdownInputWidget( [ 'name' => 'wpDeleteReasonList', -- 2.20.1