From 93cffcc2397e1fe856a503ef5fb81eca48627328 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Thu, 5 Mar 2015 19:18:38 +0100 Subject: [PATCH] Added more checked type-hints Signed-off-by: Roland Haeder --- plugins/DomainWhitelist/DomainWhitelistPlugin.php | 9 +++++---- plugins/OStatus/OStatusPlugin.php | 10 +++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/plugins/DomainWhitelist/DomainWhitelistPlugin.php b/plugins/DomainWhitelist/DomainWhitelistPlugin.php index 8be03df39e..82119b344e 100644 --- a/plugins/DomainWhitelist/DomainWhitelistPlugin.php +++ b/plugins/DomainWhitelist/DomainWhitelistPlugin.php @@ -67,7 +67,7 @@ class DomainWhitelistPlugin extends Plugin * * @return boolean hook flag */ - function onEndShowStatusNetScripts($action) { + public function onEndShowStatusNetScripts(Action $action) { $name = $action->arg('action'); if ($name == 'invite') { $action->script($this->getPath() . '/js/whitelistinvite.js'); @@ -75,13 +75,14 @@ class DomainWhitelistPlugin extends Plugin return true; } - function onRequireValidatedEmailPlugin_Override($user, &$knownGood) + public function onRequireValidatedEmailPlugin_Override(User $user, &$knownGood) { $knownGood = (!empty($user->email) && $this->matchesWhitelist($user->email)); return true; } - function onEndValidateUserEmail($user, $email, &$valid) + // @TODO Most callers are given NULL as first argument + public function onEndValidateUserEmail($user, $email, &$valid) { if ($valid) { // it's otherwise valid if (!$this->matchesWhitelist($email)) { @@ -104,7 +105,7 @@ class DomainWhitelistPlugin extends Plugin return true; } - function onStartAddEmailAddress($user, $email) + public function onStartAddEmailAddress(User $user, $email) { if (!$this->matchesWhitelist($email)) { // TRANS: Exception thrown when an e-mail address does not match the site's domain whitelist. diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index 394606d78a..0cc5878fbd 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -230,7 +230,7 @@ class OStatusPlugin extends Plugin /* * If the field being looked for is URI look for the profile */ - function onStartProfileCompletionSearch($action, $profile, $search_engine) { + public function onStartProfileCompletionSearch(Action $action, Profile $profile, $search_engine) { if ($action->field == 'uri') { $profile->joinAdd(array('id', 'user:id')); $profile->whereAdd('uri LIKE "%' . $profile->escape($q) . '%"'); @@ -319,7 +319,7 @@ class OStatusPlugin extends Plugin * @param array &$mention in/out param: set of found mentions * @return boolean hook return value */ - function onEndFindMentions($sender, $text, &$mentions) + function onEndFindMentions(Profile $sender, $text, array &$mentions) { $matches = array(); @@ -472,7 +472,7 @@ class OStatusPlugin extends Plugin * @param Profile &$profile * @return hook return code */ - function onStartCommandGetProfile($command, $arg, &$profile) + public function onStartCommandGetProfile(Command $command, $arg, Profile &$profile = null) { $oprofile = $this->pullRemoteProfile($arg); if ($oprofile instanceof Ostatus_profile && !$oprofile->isGroup()) { @@ -499,7 +499,7 @@ class OStatusPlugin extends Plugin * @param User_group &$group * @return hook return code */ - function onStartCommandGetGroup($command, $arg, &$group) + function onStartCommandGetGroup(Command $command, $arg, User_group &$group = null) { $oprofile = $this->pullRemoteProfile($arg); if ($oprofile instanceof Ostatus_profile && $oprofile->isGroup()) { @@ -574,7 +574,7 @@ class OStatusPlugin extends Plugin return true; } - function onEndShowStatusNetScripts($action) { + public function onEndShowStatusNetScripts(Action $action) { $action->script($this->path('js/ostatus.js')); return true; } -- 2.39.5