[REFACTOR] Added explicit return type to all instances of QueueHandler::handle

This commit is contained in:
Miguel Dantas 2019-08-09 00:15:38 +01:00 committed by Diogo Cordeiro
parent aaabf82eff
commit 0030fe3aeb
34 changed files with 34 additions and 34 deletions

View File

@ -51,7 +51,7 @@ class AccountMover extends QueueHandler
return 'acctmove'; return 'acctmove';
} }
function handle($object) function handle($object) : bool
{ {
list($user, $remote, $password) = $object; list($user, $remote, $password) = $object;

View File

@ -51,7 +51,7 @@ class ActivityImporter extends QueueHandler
* *
* @return * @return
*/ */
function handle($data) function handle($data) : bool
{ {
list($user, $author, $activity, $trusted) = $data; list($user, $author, $activity, $trusted) = $data;

View File

@ -51,7 +51,7 @@ class ActivityMover extends QueueHandler
return 'actmove'; return 'actmove';
} }
function handle($data) function handle($data) : bool
{ {
list ($act, $sink, $userURI, $remoteURI) = $data; list ($act, $sink, $userURI, $remoteURI) = $data;

View File

@ -36,7 +36,7 @@ class DelUserQueueHandler extends QueueHandler
return 'deluser'; return 'deluser';
} }
public function handle($user) public function handle($user) : bool
{ {
if (!($user instanceof User)) { if (!($user instanceof User)) {
common_log(LOG_ERR, "Got a bogus user, not deleting"); common_log(LOG_ERR, "Got a bogus user, not deleting");

View File

@ -61,7 +61,7 @@ class DistribQueueHandler
* @param Notice $notice * @param Notice $notice
* @return boolean true on success, false on failure * @return boolean true on success, false on failure
*/ */
public function handle(Notice $notice) public function handle(Notice $notice) : bool
{ {
// We have to manually add attentions to non-profile subs and non-mentions // We have to manually add attentions to non-profile subs and non-mentions
$ptAtts = $notice->getAttentionsFromProfileTags(); $ptAtts = $notice->getAttentionsFromProfileTags();

View File

@ -59,7 +59,7 @@ class FeedImporter extends QueueHandler
return 'feedimp'; return 'feedimp';
} }
function handle($data) function handle($data) : bool
{ {
list($user, $xml, $trusted) = $data; list($user, $xml, $trusted) = $data;

View File

@ -35,7 +35,7 @@ class ImQueueHandler extends QueueHandler
* @param Notice $notice * @param Notice $notice
* @return boolean success * @return boolean success
*/ */
function handle($notice): bool function handle($notice) : bool
{ {
if (!($notice instanceof Notice)) { if (!($notice instanceof Notice)) {
common_log(LOG_ERR, "Got a bogus notice, not broadcasting"); common_log(LOG_ERR, "Got a bogus notice, not broadcasting");

View File

@ -35,7 +35,7 @@ class ImReceiverQueueHandler extends QueueHandler
* @param object $data * @param object $data
* @return boolean success * @return boolean success
*/ */
function handle($data) function handle($data) : bool
{ {
return $this->plugin->receiveRawMessage($data); return $this->plugin->receiveRawMessage($data);
} }

View File

@ -35,7 +35,7 @@ class ImSenderQueueHandler extends QueueHandler
* @param object $data * @param object $data
* @return boolean success * @return boolean success
*/ */
function handle($data) function handle($data) : bool
{ {
return $this->plugin->imManager->send_raw_message($data); return $this->plugin->imManager->send_raw_message($data);
} }

View File

@ -29,7 +29,7 @@ class PingQueueHandler extends QueueHandler {
return 'ping'; return 'ping';
} }
function handle($notice): bool function handle($notice) : bool
{ {
if (!($notice instanceof Notice)) { if (!($notice instanceof Notice)) {
common_log(LOG_ERR, "Got a bogus notice, not broadcasting"); common_log(LOG_ERR, "Got a bogus notice, not broadcasting");

View File

@ -40,7 +40,7 @@ class PluginQueueHandler extends QueueHandler
return 'plugin'; return 'plugin';
} }
function handle($notice): bool function handle($notice) : bool
{ {
if (!($notice instanceof Notice)) { if (!($notice instanceof Notice)) {
common_log(LOG_ERR, "Got a bogus notice, not broadcasting"); common_log(LOG_ERR, "Got a bogus notice, not broadcasting");

View File

@ -46,7 +46,7 @@ class QueueHandler
* @param mixed $object * @param mixed $object
* @return boolean true on success, false on failure * @return boolean true on success, false on failure
*/ */
function handle($object): bool function handle($object) : bool
{ {
return true; return true;
} }

View File

@ -29,7 +29,7 @@ class SmsQueueHandler extends QueueHandler
return 'sms'; return 'sms';
} }
function handle($notice): bool function handle($notice) : bool
{ {
if (!($notice instanceof Notice)) { if (!($notice instanceof Notice)) {
common_log(LOG_ERR, "Got a bogus notice, not broadcasting"); common_log(LOG_ERR, "Got a bogus notice, not broadcasting");

View File

@ -70,7 +70,7 @@ class DeliciousBackupImporter extends QueueHandler
* *
* @return boolean success value * @return boolean success value
*/ */
function handle($data) function handle($data) : bool
{ {
list($user, $body) = $data; list($user, $body) = $data;

View File

@ -63,7 +63,7 @@ class DeliciousBookmarkImporter extends QueueHandler
* *
* @return boolean success value * @return boolean success value
*/ */
function handle($data) function handle($data) : bool
{ {
$profile = Profile::getKV('id', $data['profile_id']); $profile = Profile::getKV('id', $data['profile_id']);

View File

@ -63,7 +63,7 @@ class SiteConfirmReminderHandler extends QueueHandler
* @param array $remitem type of reminder to send and any special options * @param array $remitem type of reminder to send and any special options
* @return boolean true on success, false on failure * @return boolean true on success, false on failure
*/ */
function handle($remitem) function handle($remitem) : bool
{ {
list($type, $opts) = $remitem; list($type, $opts) = $remitem;

View File

@ -46,7 +46,7 @@ class UserReminderHandler extends QueueHandler {
* @param Confirm_address $confirm the confirmation email/code * @param Confirm_address $confirm the confirmation email/code
* @return boolean true on success, false on failure * @return boolean true on success, false on failure
*/ */
function handle($confirm) { function handle($confirm) : bool {
return $this->sendNextReminder($confirm); return $this->sendNextReminder($confirm);
} }

View File

@ -64,7 +64,7 @@ class SiteEmailSummaryHandler extends QueueHandler
* @param mixed $object * @param mixed $object
* @return boolean true on success, false on failure * @return boolean true on success, false on failure
*/ */
function handle($object) function handle($object) : bool
{ {
$qm = QueueManager::get(); $qm = QueueManager::get();

View File

@ -64,7 +64,7 @@ class UserEmailSummaryHandler extends QueueHandler
* @param mixed $object * @param mixed $object
* @return boolean true on success, false on failure * @return boolean true on success, false on failure
*/ */
function handle($user_id) function handle($user_id) : bool
{ {
// Skip if they've asked not to get summaries // Skip if they've asked not to get summaries

View File

@ -14,7 +14,7 @@ class FeedPollQueueHandler extends QueueHandler
return FeedPoll::QUEUE_CHECK; return FeedPoll::QUEUE_CHECK;
} }
public function handle($item) public function handle($item) : bool
{ {
$feedsub = FeedSub::getKV('id', $item['id']); $feedsub = FeedSub::getKV('id', $item['id']);
if (!$feedsub instanceof FeedSub) { if (!$feedsub instanceof FeedSub) {

View File

@ -33,7 +33,7 @@ class HubConfQueueHandler extends QueueHandler
return 'hubconf'; return 'hubconf';
} }
function handle($data) function handle($data) : bool
{ {
$sub = $data['sub']; $sub = $data['sub'];
$mode = $data['mode']; $mode = $data['mode'];

View File

@ -31,7 +31,7 @@ class HubOutQueueHandler extends QueueHandler
return 'hubout'; return 'hubout';
} }
function handle($data) function handle($data) : bool
{ {
assert(array_key_exists('atom', $data)); assert(array_key_exists('atom', $data));
assert(is_string($data['atom'])); assert(is_string($data['atom']));

View File

@ -43,7 +43,7 @@ class HubPrepQueueHandler extends QueueHandler
return 'hubprep'; return 'hubprep';
} }
function handle($data) function handle($data) : bool
{ {
$topic = $data['topic']; $topic = $data['topic'];
$atom = $data['atom']; $atom = $data['atom'];

View File

@ -44,7 +44,7 @@ class OStatusQueueHandler extends QueueHandler
return 'ostatus'; return 'ostatus';
} }
function handle($notice): bool function handle($notice) : bool
{ {
if (!($notice instanceof Notice)) { if (!($notice instanceof Notice)) {
common_log(LOG_ERR, "Got a bogus notice, not distributing"); common_log(LOG_ERR, "Got a bogus notice, not distributing");

View File

@ -31,7 +31,7 @@ class PushInQueueHandler extends QueueHandler
return 'pushin'; return 'pushin';
} }
function handle($data): bool function handle($data) : bool
{ {
if (!is_array($data)) { if (!is_array($data)) {
common_log(LOG_ERR, "Got bogus data, not processing"); common_log(LOG_ERR, "Got bogus data, not processing");

View File

@ -30,7 +30,7 @@ class PushRenewQueueHandler extends QueueHandler
return 'pushrenew'; return 'pushrenew';
} }
function handle($data) function handle($data) : bool
{ {
$feedsub_id = $data['feedsub_id']; $feedsub_id = $data['feedsub_id'];
$feedsub = FeedSub::getKV('id', $feedsub_id); $feedsub = FeedSub::getKV('id', $feedsub_id);

View File

@ -33,7 +33,7 @@ class SalmonQueueHandler extends QueueHandler
return 'salmon'; return 'salmon';
} }
function handle($data) function handle($data) : bool
{ {
assert(is_array($data)); assert(is_array($data));
assert(is_string($data['salmonuri'])); assert(is_string($data['salmonuri']));

View File

@ -52,7 +52,7 @@ class OfflineBackupQueueHandler extends QueueHandler
return 'backoff'; return 'backoff';
} }
function handle($object) function handle($object) : bool
{ {
$userId = $object; $userId = $object;

View File

@ -26,7 +26,7 @@ class RSSCloudQueueHandler extends QueueHandler
return 'rsscloud'; return 'rsscloud';
} }
function handle($notice): bool function handle($notice) : bool
{ {
if (!($notice instanceof Notice)) { if (!($notice instanceof Notice)) {
common_log(LOG_ERR, "Got a bogus notice, not using"); common_log(LOG_ERR, "Got a bogus notice, not using");

View File

@ -47,7 +47,7 @@ class SubMirrorPlugin extends Plugin
return true; return true;
} }
function handle($notice) function handle($notice) : bool
{ {
// Is anybody mirroring? // Is anybody mirroring?
$mirror = new SubMirror(); $mirror = new SubMirror();

View File

@ -32,7 +32,7 @@ class MirrorQueueHandler extends QueueHandler
return 'mirror'; return 'mirror';
} }
function handle($notice): bool function handle($notice) : bool
{ {
if (!($notice instanceof Notice)) { if (!($notice instanceof Notice)) {
common_log(LOG_ERR, "Got a bogus notice, not mirroring"); common_log(LOG_ERR, "Got a bogus notice, not mirroring");

View File

@ -40,7 +40,7 @@ class TweetInQueueHandler extends QueueHandler
return 'tweetin'; return 'tweetin';
} }
function handle($data) function handle($data) : bool
{ {
// JSON object with Twitter data // JSON object with Twitter data
$status = $data['status']; $status = $data['status'];

View File

@ -28,7 +28,7 @@ class TwitterQueueHandler extends QueueHandler
return 'twitter'; return 'twitter';
} }
function handle($notice): bool function handle($notice) : bool
{ {
if (!($notice instanceof Notice)) { if (!($notice instanceof Notice)) {
common_log(LOG_ERR, "Got a bogus notice, not broadcasting"); common_log(LOG_ERR, "Got a bogus notice, not broadcasting");

View File

@ -40,7 +40,7 @@ class TweetCtlQueueHandler extends QueueHandler
return 'tweetctl'; return 'tweetctl';
} }
function handle($data) function handle($data) : bool
{ {
// A user has activated or deactivated their Twitter bridge // A user has activated or deactivated their Twitter bridge
// import status. // import status.