Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/89383
Change subject: Add type hinting
......................................................................
Add type hinting
Change-Id: I7de3a4de4e59a42a6c0c61aaddd7f8d7954aa233
---
M MassMessage.body.php
M MassMessage.hooks.php
M MassMessageJob.php
M MassMessageSubmitJob.php
M SpecialMassMessage.php
5 files changed, 16 insertions(+), 16 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MassMessage
refs/changes/83/89383/1
diff --git a/MassMessage.body.php b/MassMessage.body.php
index 7a62c01..944933e 100644
--- a/MassMessage.body.php
+++ b/MassMessage.body.php
@@ -16,7 +16,7 @@
* @param $title Title
* @return Title|null null if the page is an interwiki redirect
*/
- public static function followRedirect( $title ) {
+ public static function followRedirect( Title $title ) {
if ( !$title->isRedirect() ) {
return $title;
}
@@ -120,7 +120,7 @@
* @param array $data
* @return array
*/
- public static function normalizeTargets( $data ) {
+ public static function normalizeTargets( array $data ) {
$targets = array();
foreach ( $data as $target ) {
@@ -160,7 +160,7 @@
* @param IContextSource $context
* @return array
*/
- public static function getParserFunctionTargets( $spamlist, $context ) {
+ public static function getParserFunctionTargets( Title $spamlist,
$context ) {
$page = WikiPage::factory( $spamlist );
$content = $page->getContent( Revision::RAW );
if ( $content instanceof TextContent ) {
diff --git a/MassMessage.hooks.php b/MassMessage.hooks.php
index 5174247..1671c06 100644
--- a/MassMessage.hooks.php
+++ b/MassMessage.hooks.php
@@ -53,7 +53,7 @@
* @param string $page
* @return array
*/
- public static function outputParserFunction( $parser, $page, $site = ''
) {
+ public static function outputParserFunction( Parser $parser, $page,
$site = '' ) {
global $wgScript;
$data = self::verifyPFData( $page, $site );
@@ -77,7 +77,7 @@
* @param string $site
* @return string
*/
- public static function storeDataParserFunction( $parser, $page, $site =
'' ) {
+ public static function storeDataParserFunction( Parser $parser, $page,
$site = '' ) {
$data = self::verifyPFData( $page, $site );
if ( isset( $data['error'] ) ) {
return ''; // Output doesn't matter
@@ -154,7 +154,7 @@
* @param $event EchoEvent
* @return bool
*/
- public static function onBeforeEchoEventInsert( $event ) {
+ public static function onBeforeEchoEventInsert( EchoEvent $event ) {
// Don't spam a user with mention notifications if it's a
MassMessage
if ( $event->getType() == 'mention' && $event->getAgent() && //
getAgent() can return null
$event->getAgent()->getId() ==
MassMessage::getMessengerUser()->getId() ) {
diff --git a/MassMessageJob.php b/MassMessageJob.php
index 75cbee6..01d9d44 100644
--- a/MassMessageJob.php
+++ b/MassMessageJob.php
@@ -11,7 +11,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
2.0 or later
*/
class MassMessageJob extends Job {
- public function __construct( $title, $params, $id = 0 ) {
+ public function __construct( Title $title, array $params, $id = 0 ) {
parent::__construct( 'massmessageJob', $title, $params, $id );
}
@@ -37,7 +37,7 @@
* @param Title $title
* @return Title|null null if we shouldn't post on that title
*/
- function normalizeTitle( $title ) {
+ function normalizeTitle( Title $title ) {
global $wgNamespacesToPostIn, $wgNamespacesToConvert;
if ( isset( $wgNamespacesToConvert[$title->getNamespace()] ) ) {
$title = Title::makeTitle(
$wgNamespacesToConvert[$title->getNamespace()], $title->getText() );
@@ -56,7 +56,7 @@
* @param $title Title
* @return bool
*/
- public static function isOptedOut( $title) {
+ public static function isOptedOut( Title $title) {
$wikipage = WikiPage::factory( $title );
$categories = $wikipage->getCategories();
$category = Title::makeTitle( NS_CATEGORY, wfMessage(
'massmessage-optout-category')->inContentLanguage()->text() );
@@ -190,7 +190,7 @@
return $text;
}
- function makeAPIRequest( $params ) {
+ function makeAPIRequest( array $params ) {
global $wgUser, $wgRequest;
$wgRequest = new DerivativeRequest(
diff --git a/MassMessageSubmitJob.php b/MassMessageSubmitJob.php
index a50978d..611d35e 100644
--- a/MassMessageSubmitJob.php
+++ b/MassMessageSubmitJob.php
@@ -9,7 +9,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
2.0 or later
*/
class MassMessageSubmitJob extends Job {
- public function __construct( $title, $params, $id = 0 ) {
+ public function __construct( Title $title, array $params, $id = 0 ) {
parent::__construct( 'massmessagesubmitJob', $title, $params,
$id );
}
diff --git a/SpecialMassMessage.php b/SpecialMassMessage.php
index f1dea85..e7f997f 100644
--- a/SpecialMassMessage.php
+++ b/SpecialMassMessage.php
@@ -160,7 +160,7 @@
* @param $spamlist Title
* @param $subject string
*/
- protected function logToWiki( $spamlist, $subject ) {
+ protected function logToWiki( Title $spamlist, $subject ) {
// $title->getLatestRevID()
$logEntry = new ManualLogEntry( 'massmessage', 'send' );
@@ -181,7 +181,7 @@
* @param $data Array
* @return Status
*/
- public function callback( $data ) {
+ public function callback( array $data ) {
$this->verifyData( $data );
@@ -235,7 +235,7 @@
* @param $data Array
* @return Status
*/
- protected function verifyData( $data ) {
+ protected function verifyData( array $data ) {
// Trim all the things!
foreach ( $data as $k => $v ) {
$data[$k] = trim( $v );
@@ -263,7 +263,7 @@
* @param $data Array
* @return Status
*/
- protected function preview( $data ) {
+ protected function preview( array $data ) {
// $spamlist = $this->getSpamlist( $data['spamlist'] );
// $targets = MassMessage::getParserFunctionTargets( $spamlist,
$this->getContext() );
// $firstTarget = array_values( $targets )[0]; // Why doesn't
this work??
@@ -305,7 +305,7 @@
* @param $data Array
* @return Status
*/
- protected function submit( $data ) {
+ protected function submit( array $data ) {
$spamlist = $this->getSpamlist( $data['spamlist'] );
// Prep the HTML comment message
--
To view, visit https://gerrit.wikimedia.org/r/89383
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7de3a4de4e59a42a6c0c61aaddd7f8d7954aa233
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MassMessage
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits