From d968247f754d66f76e5715b3d1e6933328270eaa Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 27 Jan 2015 19:10:48 +0100 Subject: [PATCH] Added a lot more type-hints where they will happen. Please note that I found a confusion in one method's signature as Profile and User are given at the same parameter (see @WARNING). Signed-off-by: Roland Haeder --- classes/Confirm_address.php | 2 +- classes/File_redirection.php | 2 +- classes/File_thumbnail.php | 3 +++ classes/Notice.php | 13 ++++++++----- lib/docfile.php | 2 +- lib/noticeform.php | 6 +----- plugins/ActivitySpam/ActivitySpamPlugin.php | 4 ++-- plugins/ActivitySpam/classes/spam_score.php | 2 +- plugins/Blog/classes/Blog_entry.php | 8 ++------ plugins/Bookmark/BookmarkPlugin.php | 2 +- plugins/Bookmark/classes/Bookmark.php | 12 ++++-------- plugins/Event/classes/Happening.php | 4 ++-- plugins/Event/classes/RSVP.php | 4 ++-- plugins/GNUsocialPhoto/classes/Photo.php | 4 ++-- plugins/GNUsocialVideo/classes/Video.php | 4 ++-- plugins/Minify/MinifyPlugin.php | 2 +- plugins/ModHelper/ModHelperPlugin.php | 2 +- plugins/ModLog/ModLogPlugin.php | 10 +++++----- plugins/NoticeTitle/NoticeTitlePlugin.php | 4 ++-- plugins/NoticeTitle/classes/Notice_title.php | 2 +- plugins/Oembed/classes/File_oembed.php | 3 +++ plugins/Poll/classes/Poll.php | 8 ++------ plugins/Poll/classes/Poll_response.php | 8 ++------ plugins/QnA/classes/QnA_Answer.php | 12 ++++-------- plugins/QnA/classes/QnA_Question.php | 8 ++++---- plugins/QnA/forms/qnanewquestion.php | 2 +- plugins/Recaptcha/RecaptchaPlugin.php | 12 +++++++++++- plugins/RegisterThrottle/RegisterThrottlePlugin.php | 4 ++-- plugins/SubMirror/classes/SubMirror.php | 7 ++++--- plugins/UserFlag/UserFlagPlugin.php | 2 ++ plugins/UserLimit/UserLimitPlugin.php | 12 +++++++++++- 31 files changed, 89 insertions(+), 81 deletions(-) diff --git a/classes/Confirm_address.php b/classes/Confirm_address.php index 0ed7796ad4..97c69872a6 100644 --- a/classes/Confirm_address.php +++ b/classes/Confirm_address.php @@ -56,7 +56,7 @@ class Confirm_address extends Managed_DataObject return null; } - static function saveNew($user, $address, $addressType, $extra=null) + static function saveNew(User $user, $address, $addressType, $extra=null) { $ca = new Confirm_address(); diff --git a/classes/File_redirection.php b/classes/File_redirection.php index 0bcccc6cff..292e6372a6 100644 --- a/classes/File_redirection.php +++ b/classes/File_redirection.php @@ -332,7 +332,7 @@ class File_redirection extends Managed_DataObject return $out_url; } - function saveNew($data, $file_id, $url) { + function saveNew(array $data, $file_id, $url) { $file_redir = new File_redirection; $file_redir->url = $url; $file_redir->file_id = $file_id; diff --git a/classes/File_thumbnail.php b/classes/File_thumbnail.php index 4d76b7dc55..9d8131463d 100644 --- a/classes/File_thumbnail.php +++ b/classes/File_thumbnail.php @@ -63,6 +63,9 @@ class File_thumbnail extends Managed_DataObject * @param int $file_id */ public static function saveNew($data, $file_id) { + // @TODO Must be an object (see below code) + assert(is_object($data)); + if (!empty($data->thumbnail_url)) { // Non-photo types such as video will usually // show us a thumbnail, though it's not required. diff --git a/classes/Notice.php b/classes/Notice.php index 37765ce38c..6314ff534a 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -414,7 +414,7 @@ class Notice extends Managed_DataObject * @return Notice * @throws ClientException */ - static function saveNew($profile_id, $content, $source, array $options=null) { + static function saveNew($profile_id, $content, $source, array $options=array()) { $defaults = array('uri' => null, 'url' => null, 'conversation' => null, // URI of conversation @@ -425,13 +425,16 @@ class Notice extends Managed_DataObject 'object_type' => null, 'verb' => null); - if (!empty($options) && is_array($options)) { + /* + * Above type-hint is already array, so simply count it, this saves + * "some" CPU cycles. + */ + if (count($options) > 0) { $options = array_merge($defaults, $options); - extract($options); - } else { - extract($defaults); } + extract($options); + if (!isset($is_local)) { $is_local = Notice::LOCAL_PUBLIC; } diff --git a/lib/docfile.php b/lib/docfile.php index e396870695..1b7fde3cfe 100644 --- a/lib/docfile.php +++ b/lib/docfile.php @@ -95,7 +95,7 @@ class DocFile } } - function toHTML($args=null) + function toHTML(array $args=null) { if (is_null($args)) { $args = array(); diff --git a/lib/noticeform.php b/lib/noticeform.php index 012619a0ba..320b097e62 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -101,7 +101,7 @@ class NoticeForm extends Form * 'location_id' ID of location * 'location_ns' Namespace of location */ - function __construct($action, $options=null) + function __construct(Action $action, array $options = array()) { // XXX: ??? Is this to keep notice forms distinct? // Do we have to worry about sub-second race conditions? @@ -111,10 +111,6 @@ class NoticeForm extends Form parent::__construct($action); - if (is_null($options)) { - $options = array(); - } - $this->actionName = $action->trimmed('action'); $prefill = array('content', 'inreplyto', 'lat', diff --git a/plugins/ActivitySpam/ActivitySpamPlugin.php b/plugins/ActivitySpam/ActivitySpamPlugin.php index 9d61b2dddd..fe6b8f6cef 100644 --- a/plugins/ActivitySpam/ActivitySpamPlugin.php +++ b/plugins/ActivitySpam/ActivitySpamPlugin.php @@ -118,7 +118,7 @@ class ActivitySpamPlugin extends Plugin return true; } - function onNoticeDeleteRelated($notice) { + function onNoticeDeleteRelated(Notice $notice) { $score = Spam_score::getKV('notice_id', $notice->id); if (!empty($score)) { $score->delete(); @@ -126,7 +126,7 @@ class ActivitySpamPlugin extends Plugin return true; } - function onUserRightsCheck($profile, $right, &$result) { + function onUserRightsCheck(Profile $profile, $right, &$result) { switch ($right) { case self::REVIEWSPAM: case self::TRAINSPAM: diff --git a/plugins/ActivitySpam/classes/spam_score.php b/plugins/ActivitySpam/classes/spam_score.php index 5c583a2e07..6a2a11d069 100644 --- a/plugins/ActivitySpam/classes/spam_score.php +++ b/plugins/ActivitySpam/classes/spam_score.php @@ -53,7 +53,7 @@ class Spam_score extends Managed_DataObject public $score; // float public $created; // datetime - function saveNew($notice, $result) { + function saveNew(Notice $notice, $result) { $score = new Spam_score(); diff --git a/plugins/Blog/classes/Blog_entry.php b/plugins/Blog/classes/Blog_entry.php index 1f585dce4f..26ed41f452 100644 --- a/plugins/Blog/classes/Blog_entry.php +++ b/plugins/Blog/classes/Blog_entry.php @@ -107,12 +107,8 @@ class Blog_entry extends Managed_DataObject ); } - static function saveNew($profile, $title, $content, $options=null) + static function saveNew(Profile $profile, $title, $content, array $options = array()) { - if (is_null($options)) { - $options = array(); - } - $be = new Blog_entry(); $be->id = (string) new UUID(); $be->profile_id = $profile->id; @@ -218,7 +214,7 @@ class Blog_entry extends Managed_DataObject } } - static function fromNotice($notice) + static function fromNotice(Notice $notice) { return Blog_entry::getKV('uri', $notice->uri); } diff --git a/plugins/Bookmark/BookmarkPlugin.php b/plugins/Bookmark/BookmarkPlugin.php index a3dc196e78..33c3a9eea9 100644 --- a/plugins/Bookmark/BookmarkPlugin.php +++ b/plugins/Bookmark/BookmarkPlugin.php @@ -61,7 +61,7 @@ class BookmarkPlugin extends MicroAppPlugin * * @return boolean hook value */ - function onUserRightsCheck($profile, $right, &$result) + function onUserRightsCheck(Profile $profile, $right, &$result) { if ($right == self::IMPORTDELICIOUS) { $result = !$profile->isSilenced(); diff --git a/plugins/Bookmark/classes/Bookmark.php b/plugins/Bookmark/classes/Bookmark.php index a99df87ee3..b86746dde7 100644 --- a/plugins/Bookmark/classes/Bookmark.php +++ b/plugins/Bookmark/classes/Bookmark.php @@ -92,7 +92,7 @@ class Bookmark extends Managed_DataObject * * @return Bookmark found bookmark or null */ - static function getByNotice($notice) + static function getByNotice(Notice $notice) { return self::getKV('uri', $notice->uri); } @@ -105,7 +105,7 @@ class Bookmark extends Managed_DataObject * * @return Bookmark bookmark found or null */ - static function getByURL($profile, $url) + static function getByURL(Profile $profile, $url) { $nb = new Bookmark(); @@ -131,8 +131,8 @@ class Bookmark extends Managed_DataObject * * @return Notice saved notice */ - static function saveNew($profile, $title, $url, $rawtags, $description, - $options=null) + static function saveNew(Profile $profile, $title, $url, $rawtags, $description, + array $options=array()) { if (!common_valid_http_url($url)) { throw new ClientException(_m('Only web bookmarks can be posted (HTTP or HTTPS).')); @@ -145,10 +145,6 @@ class Bookmark extends Managed_DataObject throw new ClientException(_m('Bookmark already exists.')); } - if (empty($options)) { - $options = array(); - } - if (array_key_exists('uri', $options)) { $other = Bookmark::getKV('uri', $options['uri']); if (!empty($other)) { diff --git a/plugins/Event/classes/Happening.php b/plugins/Event/classes/Happening.php index 3a094ece6c..3d2a1738b5 100644 --- a/plugins/Event/classes/Happening.php +++ b/plugins/Event/classes/Happening.php @@ -102,7 +102,7 @@ class Happening extends Managed_DataObject ); } - static function saveNew($profile, $start_time, $end_time, $title, $location, $description, $url, $options=array()) + static function saveNew(Profile $profile, $start_time, $end_time, $title, $location, $description, $url, array $options=array()) { if (array_key_exists('uri', $options)) { $other = Happening::getKV('uri', $options['uri']); @@ -207,7 +207,7 @@ class Happening extends Managed_DataObject return Notice::getKV('uri', $this->uri); } - static function fromNotice($notice) + static function fromNotice(Notice $notice) { return Happening::getKV('uri', $notice->uri); } diff --git a/plugins/Event/classes/RSVP.php b/plugins/Event/classes/RSVP.php index 7266ea7493..c9504bf601 100644 --- a/plugins/Event/classes/RSVP.php +++ b/plugins/Event/classes/RSVP.php @@ -107,7 +107,7 @@ class RSVP extends Managed_DataObject ); } - function saveNew($profile, $event, $verb, $options=array()) + function saveNew(Profile $profile, $event, $verb, array $options = array()) { if (array_key_exists('uri', $options)) { $other = RSVP::getKV('uri', $options['uri']); @@ -315,7 +315,7 @@ class RSVP extends Managed_DataObject $this->response); } - static function toHTML($profile, $event, $response) + static function toHTML(Profile $profile, Event $event, $response) { $fmt = null; diff --git a/plugins/GNUsocialPhoto/classes/Photo.php b/plugins/GNUsocialPhoto/classes/Photo.php index a6e01a8c1b..c530ca030c 100644 --- a/plugins/GNUsocialPhoto/classes/Photo.php +++ b/plugins/GNUsocialPhoto/classes/Photo.php @@ -46,7 +46,7 @@ class Photo extends Managed_DataObject public $description; // text public $profile_id; // int - public static function getByNotice($notice) + public static function getByNotice(Notice $notice) { return self::getKV('uri', $notice->uri); } @@ -81,7 +81,7 @@ class Photo extends Managed_DataObject ); } - static function saveNew(Profile $profile, $photo_uri, $thumb_uri, $title, $description, $options=array()) + static function saveNew(Profile $profile, $photo_uri, $thumb_uri, $title, $description, array $options=array()) { $photo = new Photo(); diff --git a/plugins/GNUsocialVideo/classes/Video.php b/plugins/GNUsocialVideo/classes/Video.php index d2dd0469a1..9746948e16 100644 --- a/plugins/GNUsocialVideo/classes/Video.php +++ b/plugins/GNUsocialVideo/classes/Video.php @@ -43,7 +43,7 @@ class Video extends Managed_DataObject public $url; // varchar (255) public $profile_id; // int - public static function getByNotice($notice) + public static function getByNotice(Notice $notice) { return self::getKV('uri', $notice->uri); } @@ -75,7 +75,7 @@ class Video extends Managed_DataObject ); } - static function saveNew(Profile $profile, $url, $options=array()) + static function saveNew(Profile $profile, $url, array $options=array()) { $vid = new Video(); diff --git a/plugins/Minify/MinifyPlugin.php b/plugins/Minify/MinifyPlugin.php index 1dd3bdcf34..cb51e980f3 100644 --- a/plugins/Minify/MinifyPlugin.php +++ b/plugins/Minify/MinifyPlugin.php @@ -152,7 +152,7 @@ class MinifyPlugin extends Plugin return JSMin::minify($code); } - static function minifyCss($code, $options = array()) { + static function minifyCss($code, array $options = array()) { require_once('Minify/CSS.php'); return Minify_CSS::minify($code,$options); } diff --git a/plugins/ModHelper/ModHelperPlugin.php b/plugins/ModHelper/ModHelperPlugin.php index 2752a21539..b37ea44578 100644 --- a/plugins/ModHelper/ModHelperPlugin.php +++ b/plugins/ModHelper/ModHelperPlugin.php @@ -42,7 +42,7 @@ class ModHelperPlugin extends Plugin return true; } - function onUserRightsCheck($profile, $right, &$result) + function onUserRightsCheck(Profile $profile, $right, &$result) { if (in_array($right, self::$rights)) { // Hrm.... really we should confirm that the *other* user isn't privleged. :) diff --git a/plugins/ModLog/ModLogPlugin.php b/plugins/ModLog/ModLogPlugin.php index 32c96be0e8..e659ee57c3 100644 --- a/plugins/ModLog/ModLogPlugin.php +++ b/plugins/ModLog/ModLogPlugin.php @@ -71,7 +71,7 @@ class ModLogPlugin extends Plugin return true; } - function onEndGrantRole($profile, $role) + function onEndGrantRole(Profile $profile, $role) { $modlog = new ModLog(); @@ -79,7 +79,7 @@ class ModLogPlugin extends Plugin $modlog->profile_id = $profile->id; $cur = common_current_user(); - + if (!empty($cur)) { $modlog->moderator_id = $cur->id; } @@ -93,7 +93,7 @@ class ModLogPlugin extends Plugin return true; } - function onEndRevokeRole($profile, $role) + function onEndRevokeRole(Profile $profile, $role) { $modlog = new ModLog(); @@ -102,7 +102,7 @@ class ModLogPlugin extends Plugin $modlog->profile_id = $profile->id; $cur = common_current_user(); - + if (!empty($cur)) { $modlog->moderator_id = $cur->id; } @@ -173,7 +173,7 @@ class ModLogPlugin extends Plugin } } - function onUserRightsCheck($profile, $right, &$result) { + function onUserRightsCheck(Profile $profile, $right, &$result) { switch ($right) { case self::VIEWMODLOG: $result = ($profile->hasRole(Profile_role::MODERATOR) || $profile->hasRole('modhelper')); diff --git a/plugins/NoticeTitle/NoticeTitlePlugin.php b/plugins/NoticeTitle/NoticeTitlePlugin.php index 960cb935f7..87e07d5a63 100644 --- a/plugins/NoticeTitle/NoticeTitlePlugin.php +++ b/plugins/NoticeTitle/NoticeTitlePlugin.php @@ -246,7 +246,7 @@ class NoticeTitlePlugin extends Plugin * * @return boolean hook value */ - function onNoticeDeleteRelated($notice) + function onNoticeDeleteRelated(Notice $notice) { $nt = Notice_title::getKV('notice_id', $notice->id); @@ -264,7 +264,7 @@ class NoticeTitlePlugin extends Plugin * * @return boolean hook value */ - function onStartShowHeadTitle($action) + function onStartShowHeadTitle(Action $action) { $actionName = $action->trimmed('action'); diff --git a/plugins/NoticeTitle/classes/Notice_title.php b/plugins/NoticeTitle/classes/Notice_title.php index 610e32fca7..66ad948e6d 100644 --- a/plugins/NoticeTitle/classes/Notice_title.php +++ b/plugins/NoticeTitle/classes/Notice_title.php @@ -77,7 +77,7 @@ class Notice_title extends Managed_DataObject * * @return string title of the notice, or null if none */ - static function fromNotice($notice) + static function fromNotice(Notice $notice) { $nt = Notice_title::getKV('notice_id', $notice->id); if (empty($nt)) { diff --git a/plugins/Oembed/classes/File_oembed.php b/plugins/Oembed/classes/File_oembed.php index cb8420e352..e2b003c31d 100644 --- a/plugins/Oembed/classes/File_oembed.php +++ b/plugins/Oembed/classes/File_oembed.php @@ -92,6 +92,9 @@ class File_oembed extends Managed_DataObject * @param int $file_id */ public static function saveNew($data, $file_id) { + // @TODO Must be an object + assert(is_object($data)); + $file_oembed = new File_oembed; $file_oembed->file_id = $file_id; if (!isset($data->version)) { diff --git a/plugins/Poll/classes/Poll.php b/plugins/Poll/classes/Poll.php index 1544142028..850b5fc057 100644 --- a/plugins/Poll/classes/Poll.php +++ b/plugins/Poll/classes/Poll.php @@ -82,7 +82,7 @@ class Poll extends Managed_DataObject * * @return Poll found poll or null */ - static function getByNotice($notice) + static function getByNotice(Notice $notice) { return self::getKV('uri', $notice->uri); } @@ -167,12 +167,8 @@ class Poll extends Managed_DataObject * * @return Notice saved notice */ - static function saveNew($profile, $question, $opts, $options=null) + static function saveNew(Profile $profile, $question, $opts, array $options = array()) { - if (empty($options)) { - $options = array(); - } - $p = new Poll(); $p->id = UUID::gen(); diff --git a/plugins/Poll/classes/Poll_response.php b/plugins/Poll/classes/Poll_response.php index 0fc08443fa..3c9379a938 100644 --- a/plugins/Poll/classes/Poll_response.php +++ b/plugins/Poll/classes/Poll_response.php @@ -85,7 +85,7 @@ class Poll_response extends Managed_DataObject * * @return Poll_response found response or null */ - static function getByNotice($notice) + static function getByNotice(Notice $notice) { return self::getKV('uri', $notice->uri); } @@ -123,12 +123,8 @@ class Poll_response extends Managed_DataObject * * @return Notice saved notice */ - static function saveNew($profile, $poll, $selection, $options=null) + static function saveNew(Profile $profile, $poll, $selection, array $options=array) { - if (empty($options)) { - $options = array(); - } - if (!$poll->isValidSelection($selection)) { // TRANS: Client exception thrown when responding to a poll with an invalid option. throw new ClientException(_m('Invalid poll selection.')); diff --git a/plugins/QnA/classes/QnA_Answer.php b/plugins/QnA/classes/QnA_Answer.php index 70285cfe14..ef8bcf5b60 100644 --- a/plugins/QnA/classes/QnA_Answer.php +++ b/plugins/QnA/classes/QnA_Answer.php @@ -103,7 +103,7 @@ class QnA_Answer extends Managed_DataObject * * @return QnA_Answer found response or null */ - static function getByNotice($notice) + static function getByNotice(Notice $notice) { $answer = self::getKV('uri', $notice->uri); if (empty($answer)) { @@ -122,7 +122,7 @@ class QnA_Answer extends Managed_DataObject return Notice::getKV('uri', $this->uri); } - static function fromNotice($notice) + static function fromNotice(Notice $notice) { return QnA_Answer::getKV('uri', $notice->uri); } @@ -177,7 +177,7 @@ class QnA_Answer extends Managed_DataObject ); } - static function toHTML($profile, $question, $answer) + static function toHTML(Profile $profile, $question, $answer) { $notice = $question->getNotice(); @@ -235,12 +235,8 @@ class QnA_Answer extends Managed_DataObject * * @return Notice saved notice */ - static function saveNew($profile, $question, $text, $options = null) + static function saveNew(Profile $profile, $question, $text, array $options = array()) { - if (empty($options)) { - $options = array(); - } - $answer = new QnA_Answer(); $answer->id = UUID::gen(); $answer->profile_id = $profile->id; diff --git a/plugins/QnA/classes/QnA_Question.php b/plugins/QnA/classes/QnA_Question.php index 66eb1b1236..977f93fe47 100644 --- a/plugins/QnA/classes/QnA_Question.php +++ b/plugins/QnA/classes/QnA_Question.php @@ -97,7 +97,7 @@ class QnA_Question extends Managed_DataObject * * @return Question found question or null */ - static function getByNotice($notice) + static function getByNotice(Notice $notice) { return self::getKV('uri', $notice->uri); } @@ -164,7 +164,7 @@ class QnA_Question extends Managed_DataObject return $a->count(); } - static function fromNotice($notice) + static function fromNotice(Notice $notice) { return QnA_Question::getKV('uri', $notice->uri); } @@ -179,7 +179,7 @@ class QnA_Question extends Managed_DataObject return self::toString($this->getProfile(), $this); } - static function toHTML($profile, $question) + static function toHTML(Profile $profile, $question) { $notice = $question->getNotice(); @@ -237,7 +237,7 @@ class QnA_Question extends Managed_DataObject * * @return Notice saved notice */ - static function saveNew($profile, $title, $description, $options = array()) + static function saveNew(Profile $profile, $title, $description, array $options = array()) { $q = new QnA_Question(); diff --git a/plugins/QnA/forms/qnanewquestion.php b/plugins/QnA/forms/qnanewquestion.php index eca0187982..760c389051 100644 --- a/plugins/QnA/forms/qnanewquestion.php +++ b/plugins/QnA/forms/qnanewquestion.php @@ -56,7 +56,7 @@ class QnanewquestionForm extends Form * * @return void */ - function __construct($out = null, $title = null, $description = null, $options = null) + function __construct($out = null, $title = null, $description = null, array $options = array()) { parent::__construct($out); $this->title = $title; diff --git a/plugins/Recaptcha/RecaptchaPlugin.php b/plugins/Recaptcha/RecaptchaPlugin.php index 48754ffab4..e44caa13f7 100644 --- a/plugins/Recaptcha/RecaptchaPlugin.php +++ b/plugins/Recaptcha/RecaptchaPlugin.php @@ -85,7 +85,17 @@ class RecaptchaPlugin extends Plugin return true; } - function onStartRegistrationTry($action) + /** + * Called when someone tries to register. + * + * We check the IP here to determine if it goes over any of our + * configured limits. + * + * @param Action $action Action that is being executed + * + * @return boolean hook value + */ + function onStartRegistrationTry(Action $action) { $resp = recaptcha_check_answer ($this->private_key, $_SERVER["REMOTE_ADDR"], diff --git a/plugins/RegisterThrottle/RegisterThrottlePlugin.php b/plugins/RegisterThrottle/RegisterThrottlePlugin.php index 9d3be3b8a2..d09642a633 100644 --- a/plugins/RegisterThrottle/RegisterThrottlePlugin.php +++ b/plugins/RegisterThrottle/RegisterThrottlePlugin.php @@ -91,7 +91,7 @@ class RegisterThrottlePlugin extends Plugin * * @return boolean hook value */ - public function onStartRegistrationTry($action) + public function onStartRegistrationTry(Action $action) { $ipaddress = $this->_getIpAddress(); @@ -241,7 +241,7 @@ class RegisterThrottlePlugin extends Plugin * * @return boolean hook value */ - public function onEndGrantRole($profile, $role) + public function onEndGrantRole(Profile $profile, $role) { if (!self::$enabled) { return true; diff --git a/plugins/SubMirror/classes/SubMirror.php b/plugins/SubMirror/classes/SubMirror.php index de63841e72..cdbbed6726 100644 --- a/plugins/SubMirror/classes/SubMirror.php +++ b/plugins/SubMirror/classes/SubMirror.php @@ -188,10 +188,11 @@ class SubMirror extends Managed_DataObject * Kind of dirty, but if pulling an external data feed into an account * that may be what you want. * - * @param Notice $notice - * @return mixed Notice on successful repeat, true if already repeated, false on failure + * @param Profile $profile + * @param Notice $notice + * @return mixed Notice on successful repeat, true if already repeated, false on failure */ - protected function copyNotice($profile, $notice) + protected function copyNotice(Profile $profile, Notice $notice) { $options = array('is_local' => Notice::LOCAL_PUBLIC, 'url' => $notice->getUrl(), // pass through the foreign link... diff --git a/plugins/UserFlag/UserFlagPlugin.php b/plugins/UserFlag/UserFlagPlugin.php index d2afeaced8..696019337a 100644 --- a/plugins/UserFlag/UserFlagPlugin.php +++ b/plugins/UserFlag/UserFlagPlugin.php @@ -152,6 +152,8 @@ class UserFlagPlugin extends Plugin * @param boolean &$result out, result of the check * * @return boolean hook result + * @TODO Other implementing classes expect Profile here!!! + * @WARNING */ function onUserRightsCheck($user, $right, &$result) { diff --git a/plugins/UserLimit/UserLimitPlugin.php b/plugins/UserLimit/UserLimitPlugin.php index ac4d503151..ed4ff9df49 100644 --- a/plugins/UserLimit/UserLimitPlugin.php +++ b/plugins/UserLimit/UserLimitPlugin.php @@ -55,7 +55,17 @@ class UserLimitPlugin extends Plugin return true; } - function onStartRegistrationTry($action) + /** + * Called when someone tries to register. + * + * We check the IP here to determine if it goes over any of our + * configured limits. + * + * @param Action $action Action that is being executed + * + * @return boolean hook value + */ + function onStartRegistrationTry(Action $action) { $this->_checkMaxUsers(); return true; -- 2.39.5