aboutsummaryrefslogtreecommitdiffstats
path: root/includes/specials/SpecialBlock.php
diff options
context:
space:
mode:
authorBartosz Dziewoński <dziewonski@fastmail.fm>2024-06-26 02:03:38 +0200
committerBartosz Dziewoński <dziewonski@fastmail.fm>2024-07-10 10:32:14 +0000
commita817bbaede106603c3a0df361ca4b32ee05c6948 (patch)
tree5db00bfb57a943c6fc5113882fa9ce8d1bc8ac16 /includes/specials/SpecialBlock.php
parentd19f2543c14b36bb2ce3f2d8799d5e6a596ebb93 (diff)
downloadmediawikicore-a817bbaede106603c3a0df361ca4b32ee05c6948.tar.gz
mediawikicore-a817bbaede106603c3a0df361ca4b32ee05c6948.zip
specials: Use StatusValue::getMessages() instead of deprecated methods
A few easy-ish cases in various special pages. Change-Id: If3f6bcf1825452c7241b5b059c96c8882cf223bc
Diffstat (limited to 'includes/specials/SpecialBlock.php')
-rw-r--r--includes/specials/SpecialBlock.php15
1 files changed, 7 insertions, 8 deletions
diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php
index a9ffddd18091..11e3f49cf7ea 100644
--- a/includes/specials/SpecialBlock.php
+++ b/includes/specials/SpecialBlock.php
@@ -55,6 +55,7 @@ use MediaWiki\User\User;
use MediaWiki\User\UserIdentity;
use MediaWiki\User\UserNamePrefixSearch;
use MediaWiki\User\UserNameUtils;
+use MessageSpecifier;
use OOUI\FieldLayout;
use OOUI\HtmlSnippet;
use OOUI\LabelWidget;
@@ -96,8 +97,7 @@ class SpecialBlock extends FormSpecialPage {
protected $alreadyBlocked;
/**
- * @var array[]
- * @phan-var non-empty-array[]
+ * @var MessageSpecifier[]
*/
protected $preErrors = [];
@@ -226,8 +226,7 @@ class SpecialBlock extends FormSpecialPage {
[
'align' => 'top',
'errors' => array_map( function ( $errMsg ) {
- // @phan-suppress-next-line PhanParamTooFewUnpack Should infer non-emptiness
- return new HtmlSnippet( $this->msg( ...$errMsg )->parse() );
+ return new HtmlSnippet( $this->msg( $errMsg )->parse() );
}, $this->preErrors ),
]
) );
@@ -490,7 +489,7 @@ class SpecialBlock extends FormSpecialPage {
if ( $this->target ) {
$status = $this->blockUtils->validateTarget( $this->target );
if ( !$status->isOK() ) {
- $errors = $status->getErrorsArray();
+ $errors = $status->getMessages( 'error' );
$this->preErrors = array_merge( $this->preErrors, $errors );
}
}
@@ -580,7 +579,7 @@ class SpecialBlock extends FormSpecialPage {
}
$this->alreadyBlocked = true;
- $this->preErrors[] = [ 'ipb-needreblock', wfEscapeWikiText( $block->getTargetName() ) ];
+ $this->preErrors[] = $this->msg( 'ipb-needreblock', wfEscapeWikiText( $block->getTargetName() ) );
}
if ( $this->alreadyBlocked || $this->getRequest()->wasPosted()
@@ -593,14 +592,14 @@ class SpecialBlock extends FormSpecialPage {
if ( $this->requestedHideUser ) {
$fields['Confirm']['type'] = 'check';
unset( $fields['Confirm']['default'] );
- $this->preErrors[] = [ 'ipb-confirmhideuser', 'ipb-confirmaction' ];
+ $this->preErrors[] = $this->msg( 'ipb-confirmhideuser', 'ipb-confirmaction' );
}
// Or if the user is trying to block themselves
if ( (string)$this->target === $this->getUser()->getName() ) {
$fields['Confirm']['type'] = 'check';
unset( $fields['Confirm']['default'] );
- $this->preErrors[] = [ 'ipb-blockingself', 'ipb-confirmaction' ];
+ $this->preErrors[] = $this->msg( 'ipb-blockingself', 'ipb-confirmaction' );
}
}