[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';
}
function handle($object)
function handle($object) : bool
{
list($user, $remote, $password) = $object;

View File

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

View File

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

View File

@ -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");

View File

@ -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();

View File

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

View File

@ -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");

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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");

View File

@ -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");

View File

@ -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;
}

View File

@ -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");

View File

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

View File

@ -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']);

View File

@ -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;

View File

@ -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);
}

View File

@ -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();

View File

@ -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

View File

@ -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) {

View File

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

View File

@ -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']));

View File

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

View File

@ -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");

View File

@ -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");

View File

@ -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);

View File

@ -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']));

View File

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

View File

@ -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");

View File

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

View File

@ -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");

View File

@ -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'];

View File

@ -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");

View File

@ -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.