Merge "Fixes for the phan upgrade, part 2"
This commit is contained in:
commit
5eef84d786
5 changed files with 23 additions and 16 deletions
|
|
@ -260,6 +260,7 @@ class ProtectionForm {
|
|||
* Show the input form with optional error message
|
||||
*
|
||||
* @param string|string[]|null $err Error message or null if there's no error
|
||||
* @phan-param string|non-empty-array|null $err
|
||||
*/
|
||||
private function show( $err = null ) {
|
||||
$out = $this->mOut;
|
||||
|
|
|
|||
|
|
@ -449,7 +449,7 @@ class Message implements MessageSpecifier, Serializable {
|
|||
*
|
||||
* @param string|string[] ...$keys Message keys, or first argument as an array of all the
|
||||
* message keys.
|
||||
* @param-taint $keys tainted
|
||||
* @param-taint ...$keys tainted
|
||||
*
|
||||
* @return Message
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -86,7 +86,10 @@ class SpecialBlock extends FormSpecialPage {
|
|||
/** @var bool */
|
||||
protected $alreadyBlocked;
|
||||
|
||||
/** @var array */
|
||||
/**
|
||||
* @var array[]
|
||||
* @phan-var non-empty-array[]
|
||||
*/
|
||||
protected $preErrors = [];
|
||||
|
||||
/** @var NamespaceInfo */
|
||||
|
|
@ -192,18 +195,16 @@ class SpecialBlock extends FormSpecialPage {
|
|||
|
||||
# Don't need to do anything if the form has been posted
|
||||
if ( !$this->getRequest()->wasPosted() && $this->preErrors ) {
|
||||
if ( $this->preErrors ) {
|
||||
# Mimic error messages normally generated by the form
|
||||
$form->addHeaderText( (string)new OOUI\FieldLayout(
|
||||
new OOUI\Widget( [] ),
|
||||
[
|
||||
'align' => 'top',
|
||||
'errors' => array_map( function ( $errMsg ) {
|
||||
return new OOUI\HtmlSnippet( $this->msg( ...$errMsg )->parse() );
|
||||
}, $this->preErrors ),
|
||||
]
|
||||
) );
|
||||
}
|
||||
# Mimic error messages normally generated by the form
|
||||
$form->addHeaderText( (string)new OOUI\FieldLayout(
|
||||
new OOUI\Widget( [] ),
|
||||
[
|
||||
'align' => 'top',
|
||||
'errors' => array_map( function ( $errMsg ) {
|
||||
return new OOUI\HtmlSnippet( $this->msg( ...$errMsg )->parse() );
|
||||
}, $this->preErrors ),
|
||||
]
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -483,7 +483,7 @@ abstract class UploadBase {
|
|||
/**
|
||||
* Verifies that it's ok to include the uploaded file
|
||||
*
|
||||
* @return array|bool True of the file is verified, array otherwise.
|
||||
* @return array|true True of the file is verified, array otherwise.
|
||||
*/
|
||||
protected function verifyFile() {
|
||||
$config = MediaWikiServices::getInstance()->getMainConfig();
|
||||
|
|
@ -547,7 +547,8 @@ abstract class UploadBase {
|
|||
* Runs the blacklist checks, but not any checks that may
|
||||
* assume the entire file is present.
|
||||
*
|
||||
* @return array|bool True if the file is valid, else an array with error message key.
|
||||
* @return array|true True if the file is valid, else an array with error message key.
|
||||
* @phan-return non-empty-array|true
|
||||
*/
|
||||
protected function verifyPartialFile() {
|
||||
$config = MediaWikiServices::getInstance()->getMainConfig();
|
||||
|
|
|
|||
|
|
@ -27,6 +27,10 @@
|
|||
class UploadChunkVerificationException extends MWException {
|
||||
public $msg;
|
||||
|
||||
/**
|
||||
* @param array $res
|
||||
* @phan-param non-empty-array $res
|
||||
*/
|
||||
public function __construct( array $res ) {
|
||||
$this->msg = wfMessage( ...$res );
|
||||
parent::__construct( wfMessage( ...$res )
|
||||
|
|
|
|||
Loading…
Reference in a new issue