diff options
author | 2022-10-12 09:11:23 -0400 | |
---|---|---|
committer | 2022-10-12 09:11:23 -0400 | |
commit | 16501e80a206d33d4035d044eb30ec639e50f457 (patch) | |
tree | f37192cebd50439d3d1889112773078bb604aa74 /CommentStreams/includes/ApiCSUnwatch.php | |
parent | GentooPackages: Fix missing namespace use (diff) | |
download | extensions-16501e80a206d33d4035d044eb30ec639e50f457.tar.gz extensions-16501e80a206d33d4035d044eb30ec639e50f457.tar.bz2 extensions-16501e80a206d33d4035d044eb30ec639e50f457.zip |
Update CommentSteams to version 6.3v1.35.4
Signed-off-by: Brian Evans <grknight@gentoo.org>
Diffstat (limited to 'CommentStreams/includes/ApiCSUnwatch.php')
-rw-r--r-- | CommentStreams/includes/ApiCSUnwatch.php | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/CommentStreams/includes/ApiCSUnwatch.php b/CommentStreams/includes/ApiCSUnwatch.php index 27251f97..219eb2be 100644 --- a/CommentStreams/includes/ApiCSUnwatch.php +++ b/CommentStreams/includes/ApiCSUnwatch.php @@ -23,56 +23,56 @@ namespace MediaWiki\Extension\CommentStreams; -class ApiCSUnwatch extends ApiCSBase { +use ApiMain; +use ApiUsageException; +class ApiCSUnwatch extends ApiCSBase { /** * @param ApiMain $main main module * @param string $action name of this module */ - public function __construct( $main, $action ) { + public function __construct( ApiMain $main, string $action ) { parent::__construct( $main, $action, true ); } /** * the real body of the execute function - * - * @return result of API request + * @return ?array result of API request + * @throws ApiUsageException */ - protected function executeBody() { + protected function executeBody() : ?array { if ( $this->getUser()->isAnon() ) { - $this->dieCustomUsageMessage( - 'commentstreams-api-error-unwatch-notloggedin' ); + $this->dieWithError( 'commentstreams-api-error-unwatch-notloggedin' ); } if ( $this->comment->getParentId() !== null ) { - $this->dieCustomUsageMessage( - 'commentstreams-api-error-unwatch-nounwatchonreply' ); + $this->dieWithError( 'commentstreams-api-error-unwatch-nounwatchonreply' ); } - $result = $this->comment->unwatch( $this->getUser() ); + $result = $this->comment->unwatch( $this->getUser()->getId() ); if ( !$result ) { - $this->dieCustomUsageMessage( 'commentstreams-api-error-unwatch' ); + $this->dieWithError( 'commentstreams-api-error-unwatch' ); } - $this->getResult()->addValue( null, $this->getModuleName(), '' ); + return null; } /** * @return array examples of the use of this API module */ - public function getExamplesMessages() { + public function getExamplesMessages() : array { return [ 'action=' . $this->getModuleName() . '&pageid=3' => - 'apihelp-' . $this->getModuleName() . '-pageid-example', + 'apihelp-' . $this->getModuleName() . '-pageid-example', 'action=' . $this->getModuleName() . '&title=CommentStreams:3' => - 'apihelp-' . $this->getModuleName() . '-title-example' + 'apihelp-' . $this->getModuleName() . '-title-example' ]; } /** * @return string indicates that this API module requires a CSRF toekn */ - public function needsToken() { + public function needsToken() : string { return 'csrf'; } } |