From 0030fe3aeb8dcbdd94c0ab7ca7abe6b9edf126d8 Mon Sep 17 00:00:00 2001 From: Miguel Dantas Date: Fri, 9 Aug 2019 00:15:38 +0100 Subject: [PATCH] [REFACTOR] Added explicit return type to all instances of QueueHandler::handle --- lib/accountmover.php | 2 +- lib/activityimporter.php | 2 +- lib/activitymover.php | 2 +- lib/deluserqueuehandler.php | 2 +- lib/distribqueuehandler.php | 2 +- lib/feedimporter.php | 2 +- lib/imqueuehandler.php | 2 +- lib/imreceiverqueuehandler.php | 2 +- lib/imsenderqueuehandler.php | 2 +- lib/pingqueuehandler.php | 2 +- lib/pluginqueuehandler.php | 2 +- lib/queuehandler.php | 2 +- lib/smsqueuehandler.php | 2 +- plugins/Bookmark/lib/deliciousbackupimporter.php | 2 +- plugins/Bookmark/lib/deliciousbookmarkimporter.php | 2 +- plugins/EmailReminder/lib/siteconfirmreminderhandler.php | 2 +- plugins/EmailReminder/lib/userreminderhandler.php | 2 +- plugins/EmailSummary/lib/siteemailsummaryhandler.php | 2 +- plugins/EmailSummary/lib/useremailsummaryhandler.php | 2 +- plugins/FeedPoller/lib/feedpollqueuehandler.php | 2 +- plugins/OStatus/lib/hubconfqueuehandler.php | 2 +- plugins/OStatus/lib/huboutqueuehandler.php | 2 +- plugins/OStatus/lib/hubprepqueuehandler.php | 2 +- plugins/OStatus/lib/ostatusqueuehandler.php | 2 +- plugins/OStatus/lib/pushinqueuehandler.php | 2 +- plugins/OStatus/lib/pushrenewqueuehandler.php | 2 +- plugins/OStatus/lib/salmonqueuehandler.php | 2 +- plugins/OfflineBackup/lib/offlinebackupqueuehandler.php | 2 +- plugins/RSSCloud/lib/rsscloudqueuehandler.php | 2 +- plugins/SubMirror/SubMirrorPlugin.php | 2 +- plugins/SubMirror/lib/mirrorqueuehandler.php | 2 +- plugins/TwitterBridge/lib/tweetinqueuehandler.php | 2 +- plugins/TwitterBridge/lib/twitterqueuehandler.php | 2 +- plugins/TwitterBridge/tweetctlqueuehandler.php | 2 +- 34 files changed, 34 insertions(+), 34 deletions(-) diff --git a/lib/accountmover.php b/lib/accountmover.php index f8fb4512bd..a5eb49bcc4 100644 --- a/lib/accountmover.php +++ b/lib/accountmover.php @@ -51,7 +51,7 @@ class AccountMover extends QueueHandler return 'acctmove'; } - function handle($object) + function handle($object) : bool { list($user, $remote, $password) = $object; diff --git a/lib/activityimporter.php b/lib/activityimporter.php index c4dd797e6d..68b5873b0b 100644 --- a/lib/activityimporter.php +++ b/lib/activityimporter.php @@ -51,7 +51,7 @@ class ActivityImporter extends QueueHandler * * @return */ - function handle($data) + function handle($data) : bool { list($user, $author, $activity, $trusted) = $data; diff --git a/lib/activitymover.php b/lib/activitymover.php index 74c5c68ad6..ed11925888 100644 --- a/lib/activitymover.php +++ b/lib/activitymover.php @@ -51,7 +51,7 @@ class ActivityMover extends QueueHandler return 'actmove'; } - function handle($data) + function handle($data) : bool { list ($act, $sink, $userURI, $remoteURI) = $data; diff --git a/lib/deluserqueuehandler.php b/lib/deluserqueuehandler.php index 65866af418..90362a5b3b 100644 --- a/lib/deluserqueuehandler.php +++ b/lib/deluserqueuehandler.php @@ -36,7 +36,7 @@ class DelUserQueueHandler extends QueueHandler return 'deluser'; } - public function handle($user) + public function handle($user) : bool { if (!($user instanceof User)) { common_log(LOG_ERR, "Got a bogus user, not deleting"); diff --git a/lib/distribqueuehandler.php b/lib/distribqueuehandler.php index 036d970f2a..79d91533ad 100644 --- a/lib/distribqueuehandler.php +++ b/lib/distribqueuehandler.php @@ -61,7 +61,7 @@ class DistribQueueHandler * @param Notice $notice * @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 $ptAtts = $notice->getAttentionsFromProfileTags(); diff --git a/lib/feedimporter.php b/lib/feedimporter.php index b5807ee8b4..39e98c39e2 100644 --- a/lib/feedimporter.php +++ b/lib/feedimporter.php @@ -59,7 +59,7 @@ class FeedImporter extends QueueHandler return 'feedimp'; } - function handle($data) + function handle($data) : bool { list($user, $xml, $trusted) = $data; diff --git a/lib/imqueuehandler.php b/lib/imqueuehandler.php index b1eeb0ac36..e8421710c7 100644 --- a/lib/imqueuehandler.php +++ b/lib/imqueuehandler.php @@ -35,7 +35,7 @@ class ImQueueHandler extends QueueHandler * @param Notice $notice * @return boolean success */ - function handle($notice): bool + function handle($notice) : bool { if (!($notice instanceof Notice)) { common_log(LOG_ERR, "Got a bogus notice, not broadcasting"); diff --git a/lib/imreceiverqueuehandler.php b/lib/imreceiverqueuehandler.php index aa4a663b7a..dfe0776e14 100644 --- a/lib/imreceiverqueuehandler.php +++ b/lib/imreceiverqueuehandler.php @@ -35,7 +35,7 @@ class ImReceiverQueueHandler extends QueueHandler * @param object $data * @return boolean success */ - function handle($data) + function handle($data) : bool { return $this->plugin->receiveRawMessage($data); } diff --git a/lib/imsenderqueuehandler.php b/lib/imsenderqueuehandler.php index 790dd7b107..f1b709bd07 100644 --- a/lib/imsenderqueuehandler.php +++ b/lib/imsenderqueuehandler.php @@ -35,7 +35,7 @@ class ImSenderQueueHandler extends QueueHandler * @param object $data * @return boolean success */ - function handle($data) + function handle($data) : bool { return $this->plugin->imManager->send_raw_message($data); } diff --git a/lib/pingqueuehandler.php b/lib/pingqueuehandler.php index 7f5b11ea6a..0e62774bd5 100644 --- a/lib/pingqueuehandler.php +++ b/lib/pingqueuehandler.php @@ -29,7 +29,7 @@ class PingQueueHandler extends QueueHandler { return 'ping'; } - function handle($notice): bool + function handle($notice) : bool { if (!($notice instanceof Notice)) { common_log(LOG_ERR, "Got a bogus notice, not broadcasting"); diff --git a/lib/pluginqueuehandler.php b/lib/pluginqueuehandler.php index 46b61d6a96..36b7c07c1b 100644 --- a/lib/pluginqueuehandler.php +++ b/lib/pluginqueuehandler.php @@ -40,7 +40,7 @@ class PluginQueueHandler extends QueueHandler return 'plugin'; } - function handle($notice): bool + function handle($notice) : bool { if (!($notice instanceof Notice)) { common_log(LOG_ERR, "Got a bogus notice, not broadcasting"); diff --git a/lib/queuehandler.php b/lib/queuehandler.php index 47161a987c..118b16dade 100644 --- a/lib/queuehandler.php +++ b/lib/queuehandler.php @@ -46,7 +46,7 @@ class QueueHandler * @param mixed $object * @return boolean true on success, false on failure */ - function handle($object): bool + function handle($object) : bool { return true; } diff --git a/lib/smsqueuehandler.php b/lib/smsqueuehandler.php index 1df7011e3c..007852c7f8 100644 --- a/lib/smsqueuehandler.php +++ b/lib/smsqueuehandler.php @@ -29,7 +29,7 @@ class SmsQueueHandler extends QueueHandler return 'sms'; } - function handle($notice): bool + function handle($notice) : bool { if (!($notice instanceof Notice)) { common_log(LOG_ERR, "Got a bogus notice, not broadcasting"); diff --git a/plugins/Bookmark/lib/deliciousbackupimporter.php b/plugins/Bookmark/lib/deliciousbackupimporter.php index c8caef689a..aa0bb92b78 100644 --- a/plugins/Bookmark/lib/deliciousbackupimporter.php +++ b/plugins/Bookmark/lib/deliciousbackupimporter.php @@ -70,7 +70,7 @@ class DeliciousBackupImporter extends QueueHandler * * @return boolean success value */ - function handle($data) + function handle($data) : bool { list($user, $body) = $data; diff --git a/plugins/Bookmark/lib/deliciousbookmarkimporter.php b/plugins/Bookmark/lib/deliciousbookmarkimporter.php index eca9e96060..5ebd39815f 100644 --- a/plugins/Bookmark/lib/deliciousbookmarkimporter.php +++ b/plugins/Bookmark/lib/deliciousbookmarkimporter.php @@ -63,7 +63,7 @@ class DeliciousBookmarkImporter extends QueueHandler * * @return boolean success value */ - function handle($data) + function handle($data) : bool { $profile = Profile::getKV('id', $data['profile_id']); diff --git a/plugins/EmailReminder/lib/siteconfirmreminderhandler.php b/plugins/EmailReminder/lib/siteconfirmreminderhandler.php index e5b4a5e2ab..df83ea3e3c 100644 --- a/plugins/EmailReminder/lib/siteconfirmreminderhandler.php +++ b/plugins/EmailReminder/lib/siteconfirmreminderhandler.php @@ -63,7 +63,7 @@ class SiteConfirmReminderHandler extends QueueHandler * @param array $remitem type of reminder to send and any special options * @return boolean true on success, false on failure */ - function handle($remitem) + function handle($remitem) : bool { list($type, $opts) = $remitem; diff --git a/plugins/EmailReminder/lib/userreminderhandler.php b/plugins/EmailReminder/lib/userreminderhandler.php index e9d38a00a7..6dc7beff89 100644 --- a/plugins/EmailReminder/lib/userreminderhandler.php +++ b/plugins/EmailReminder/lib/userreminderhandler.php @@ -46,7 +46,7 @@ class UserReminderHandler extends QueueHandler { * @param Confirm_address $confirm the confirmation email/code * @return boolean true on success, false on failure */ - function handle($confirm) { + function handle($confirm) : bool { return $this->sendNextReminder($confirm); } diff --git a/plugins/EmailSummary/lib/siteemailsummaryhandler.php b/plugins/EmailSummary/lib/siteemailsummaryhandler.php index 37e1a227f3..839002bc5b 100644 --- a/plugins/EmailSummary/lib/siteemailsummaryhandler.php +++ b/plugins/EmailSummary/lib/siteemailsummaryhandler.php @@ -64,7 +64,7 @@ class SiteEmailSummaryHandler extends QueueHandler * @param mixed $object * @return boolean true on success, false on failure */ - function handle($object) + function handle($object) : bool { $qm = QueueManager::get(); diff --git a/plugins/EmailSummary/lib/useremailsummaryhandler.php b/plugins/EmailSummary/lib/useremailsummaryhandler.php index 143d6c1bd2..ed90f0ede8 100644 --- a/plugins/EmailSummary/lib/useremailsummaryhandler.php +++ b/plugins/EmailSummary/lib/useremailsummaryhandler.php @@ -64,7 +64,7 @@ class UserEmailSummaryHandler extends QueueHandler * @param mixed $object * @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 diff --git a/plugins/FeedPoller/lib/feedpollqueuehandler.php b/plugins/FeedPoller/lib/feedpollqueuehandler.php index f0441a5700..38e6cc9770 100644 --- a/plugins/FeedPoller/lib/feedpollqueuehandler.php +++ b/plugins/FeedPoller/lib/feedpollqueuehandler.php @@ -14,7 +14,7 @@ class FeedPollQueueHandler extends QueueHandler return FeedPoll::QUEUE_CHECK; } - public function handle($item) + public function handle($item) : bool { $feedsub = FeedSub::getKV('id', $item['id']); if (!$feedsub instanceof FeedSub) { diff --git a/plugins/OStatus/lib/hubconfqueuehandler.php b/plugins/OStatus/lib/hubconfqueuehandler.php index 6c06e677fe..09911622f4 100644 --- a/plugins/OStatus/lib/hubconfqueuehandler.php +++ b/plugins/OStatus/lib/hubconfqueuehandler.php @@ -33,7 +33,7 @@ class HubConfQueueHandler extends QueueHandler return 'hubconf'; } - function handle($data) + function handle($data) : bool { $sub = $data['sub']; $mode = $data['mode']; diff --git a/plugins/OStatus/lib/huboutqueuehandler.php b/plugins/OStatus/lib/huboutqueuehandler.php index 91ac30e650..daf92d3995 100644 --- a/plugins/OStatus/lib/huboutqueuehandler.php +++ b/plugins/OStatus/lib/huboutqueuehandler.php @@ -31,7 +31,7 @@ class HubOutQueueHandler extends QueueHandler return 'hubout'; } - function handle($data) + function handle($data) : bool { assert(array_key_exists('atom', $data)); assert(is_string($data['atom'])); diff --git a/plugins/OStatus/lib/hubprepqueuehandler.php b/plugins/OStatus/lib/hubprepqueuehandler.php index f11ca42e62..a9a821457e 100644 --- a/plugins/OStatus/lib/hubprepqueuehandler.php +++ b/plugins/OStatus/lib/hubprepqueuehandler.php @@ -43,7 +43,7 @@ class HubPrepQueueHandler extends QueueHandler return 'hubprep'; } - function handle($data) + function handle($data) : bool { $topic = $data['topic']; $atom = $data['atom']; diff --git a/plugins/OStatus/lib/ostatusqueuehandler.php b/plugins/OStatus/lib/ostatusqueuehandler.php index 74db1924fa..21a9a37e3c 100644 --- a/plugins/OStatus/lib/ostatusqueuehandler.php +++ b/plugins/OStatus/lib/ostatusqueuehandler.php @@ -44,7 +44,7 @@ class OStatusQueueHandler extends QueueHandler return 'ostatus'; } - function handle($notice): bool + function handle($notice) : bool { if (!($notice instanceof Notice)) { common_log(LOG_ERR, "Got a bogus notice, not distributing"); diff --git a/plugins/OStatus/lib/pushinqueuehandler.php b/plugins/OStatus/lib/pushinqueuehandler.php index 0ffb43b14a..60bf6aa69d 100644 --- a/plugins/OStatus/lib/pushinqueuehandler.php +++ b/plugins/OStatus/lib/pushinqueuehandler.php @@ -31,7 +31,7 @@ class PushInQueueHandler extends QueueHandler return 'pushin'; } - function handle($data): bool + function handle($data) : bool { if (!is_array($data)) { common_log(LOG_ERR, "Got bogus data, not processing"); diff --git a/plugins/OStatus/lib/pushrenewqueuehandler.php b/plugins/OStatus/lib/pushrenewqueuehandler.php index 31df9b5f63..1b5574865b 100644 --- a/plugins/OStatus/lib/pushrenewqueuehandler.php +++ b/plugins/OStatus/lib/pushrenewqueuehandler.php @@ -30,7 +30,7 @@ class PushRenewQueueHandler extends QueueHandler return 'pushrenew'; } - function handle($data) + function handle($data) : bool { $feedsub_id = $data['feedsub_id']; $feedsub = FeedSub::getKV('id', $feedsub_id); diff --git a/plugins/OStatus/lib/salmonqueuehandler.php b/plugins/OStatus/lib/salmonqueuehandler.php index b5142a9424..7fd63b8c46 100644 --- a/plugins/OStatus/lib/salmonqueuehandler.php +++ b/plugins/OStatus/lib/salmonqueuehandler.php @@ -33,7 +33,7 @@ class SalmonQueueHandler extends QueueHandler return 'salmon'; } - function handle($data) + function handle($data) : bool { assert(is_array($data)); assert(is_string($data['salmonuri'])); diff --git a/plugins/OfflineBackup/lib/offlinebackupqueuehandler.php b/plugins/OfflineBackup/lib/offlinebackupqueuehandler.php index 9f96193d95..6f2816c678 100644 --- a/plugins/OfflineBackup/lib/offlinebackupqueuehandler.php +++ b/plugins/OfflineBackup/lib/offlinebackupqueuehandler.php @@ -52,7 +52,7 @@ class OfflineBackupQueueHandler extends QueueHandler return 'backoff'; } - function handle($object) + function handle($object) : bool { $userId = $object; diff --git a/plugins/RSSCloud/lib/rsscloudqueuehandler.php b/plugins/RSSCloud/lib/rsscloudqueuehandler.php index 63f6559412..90efca4fbb 100644 --- a/plugins/RSSCloud/lib/rsscloudqueuehandler.php +++ b/plugins/RSSCloud/lib/rsscloudqueuehandler.php @@ -26,7 +26,7 @@ class RSSCloudQueueHandler extends QueueHandler return 'rsscloud'; } - function handle($notice): bool + function handle($notice) : bool { if (!($notice instanceof Notice)) { common_log(LOG_ERR, "Got a bogus notice, not using"); diff --git a/plugins/SubMirror/SubMirrorPlugin.php b/plugins/SubMirror/SubMirrorPlugin.php index 3bad0911ec..2ddfefa9c2 100644 --- a/plugins/SubMirror/SubMirrorPlugin.php +++ b/plugins/SubMirror/SubMirrorPlugin.php @@ -47,7 +47,7 @@ class SubMirrorPlugin extends Plugin return true; } - function handle($notice) + function handle($notice) : bool { // Is anybody mirroring? $mirror = new SubMirror(); diff --git a/plugins/SubMirror/lib/mirrorqueuehandler.php b/plugins/SubMirror/lib/mirrorqueuehandler.php index abdc259d8f..016a1f7b9d 100644 --- a/plugins/SubMirror/lib/mirrorqueuehandler.php +++ b/plugins/SubMirror/lib/mirrorqueuehandler.php @@ -32,7 +32,7 @@ class MirrorQueueHandler extends QueueHandler return 'mirror'; } - function handle($notice): bool + function handle($notice) : bool { if (!($notice instanceof Notice)) { common_log(LOG_ERR, "Got a bogus notice, not mirroring"); diff --git a/plugins/TwitterBridge/lib/tweetinqueuehandler.php b/plugins/TwitterBridge/lib/tweetinqueuehandler.php index 69ce5a61e9..394fa6c37a 100644 --- a/plugins/TwitterBridge/lib/tweetinqueuehandler.php +++ b/plugins/TwitterBridge/lib/tweetinqueuehandler.php @@ -40,7 +40,7 @@ class TweetInQueueHandler extends QueueHandler return 'tweetin'; } - function handle($data) + function handle($data) : bool { // JSON object with Twitter data $status = $data['status']; diff --git a/plugins/TwitterBridge/lib/twitterqueuehandler.php b/plugins/TwitterBridge/lib/twitterqueuehandler.php index 2c6c36906f..80bcd610f4 100644 --- a/plugins/TwitterBridge/lib/twitterqueuehandler.php +++ b/plugins/TwitterBridge/lib/twitterqueuehandler.php @@ -28,7 +28,7 @@ class TwitterQueueHandler extends QueueHandler return 'twitter'; } - function handle($notice): bool + function handle($notice) : bool { if (!($notice instanceof Notice)) { common_log(LOG_ERR, "Got a bogus notice, not broadcasting"); diff --git a/plugins/TwitterBridge/tweetctlqueuehandler.php b/plugins/TwitterBridge/tweetctlqueuehandler.php index d7636c373e..f4bc8cd75c 100644 --- a/plugins/TwitterBridge/tweetctlqueuehandler.php +++ b/plugins/TwitterBridge/tweetctlqueuehandler.php @@ -40,7 +40,7 @@ class TweetCtlQueueHandler extends QueueHandler return 'tweetctl'; } - function handle($data) + function handle($data) : bool { // A user has activated or deactivated their Twitter bridge // import status.