diff options
author | Daimona Eaytoy <daimona.wiki@gmail.com> | 2022-10-08 15:07:46 +0200 |
---|---|---|
committer | Daimona Eaytoy <daimona.wiki@gmail.com> | 2022-10-08 15:40:29 +0200 |
commit | 02a28663c1659330edc79029c2793abefd1a0ef4 (patch) | |
tree | a7cfb82840c6f9de52dd76472dcf02c7619ae960 | |
parent | 350e9b88c12648c5c2fcb1a91c23b3575771ca04 (diff) | |
download | mediawikicore-02a28663c1659330edc79029c2793abefd1a0ef4.tar.gz mediawikicore-02a28663c1659330edc79029c2793abefd1a0ef4.zip |
Fixes for the phan upgrade, part 2
Change-Id: I1c6beba4ff6132b07cbf0a6c96be056509aa5eff
-rw-r--r-- | includes/ProtectionForm.php | 1 | ||||
-rw-r--r-- | includes/language/Message.php | 2 | ||||
-rw-r--r-- | includes/specials/SpecialBlock.php | 27 | ||||
-rw-r--r-- | includes/upload/UploadBase.php | 5 | ||||
-rw-r--r-- | includes/upload/exception/UploadChunkVerificationException.php | 4 |
5 files changed, 23 insertions, 16 deletions
diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index 801db2cc37d2..6b3a8026d7da 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -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; diff --git a/includes/language/Message.php b/includes/language/Message.php index 88c08457d464..359f4dd3e875 100644 --- a/includes/language/Message.php +++ b/includes/language/Message.php @@ -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 */ diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php index a4befd3175e8..e2094d4b51c0 100644 --- a/includes/specials/SpecialBlock.php +++ b/includes/specials/SpecialBlock.php @@ -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 ), + ] + ) ); } } diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index 435e2b29fbb7..c802fd1de36f 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -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(); diff --git a/includes/upload/exception/UploadChunkVerificationException.php b/includes/upload/exception/UploadChunkVerificationException.php index c1e5001b10e5..8fb9f8d4c791 100644 --- a/includes/upload/exception/UploadChunkVerificationException.php +++ b/includes/upload/exception/UploadChunkVerificationException.php @@ -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 ) |