From 4b6639c1d7d48b5ef1da956f394f24fbe6c1c800 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 10 Mar 2015 18:31:46 +0100 Subject: [PATCH] Added checked type-hints Signed-off-by: Roland Haeder --- classes/Notice.php | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/classes/Notice.php b/classes/Notice.php index 0ef25476ca..65190da890 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -1124,7 +1124,7 @@ class Notice extends Managed_DataObject * * @return void */ - function saveKnownUrls($urls) + function saveKnownUrls(array $urls) { if (common_config('attachments', 'process_links')) { // @fixme validation? @@ -1694,12 +1694,12 @@ class Notice extends Managed_DataObject $ids[] = $reply->profile_id; } - $this->_replies[$this->id] = $ids; + $this->_setReplies($ids); return $ids; } - function _setReplies($replies) + function _setReplies(array $replies) { $this->_replies[$this->id] = $replies; } @@ -1776,11 +1776,11 @@ class Notice extends Managed_DataObject } $groups = User_group::multiGet('id', $ids); - $this->_groups[$this->id] = $groups->fetchAll(); + $this->_setGroups($groups->fetchAll()); return $this->_groups[$this->id]; } - function _setGroups($groups) + function _setGroups(array $groups) { $this->_groups[$this->id] = $groups; } @@ -2658,7 +2658,7 @@ class Notice extends Managed_DataObject * * @return boolean whether the profile is in the notice's scope */ - function inScope($profile) + function inScope(Profile $profile=null) { if (is_null($profile)) { $keypart = sprintf('notice:in-scope-for:%d:null', $this->id); @@ -2681,7 +2681,7 @@ class Notice extends Managed_DataObject return ($result == 1) ? true : false; } - protected function _inScope($profile) + protected function _inScope(Profile $profile=null) { if (!is_null($this->scope)) { $scope = $this->scope; @@ -2750,7 +2750,7 @@ class Notice extends Managed_DataObject return !$this->isHiddenSpam($profile); } - function isHiddenSpam($profile) { + function isHiddenSpam(Profile $profile=null) { // Hide posts by silenced users from everyone but moderators. @@ -2815,7 +2815,7 @@ class Notice extends Managed_DataObject return $scope; } - static function fillProfiles($notices) + static function fillProfiles(array $notices) { $map = self::getProfiles($notices); foreach ($notices as $entry=>$notice) { @@ -2832,7 +2832,7 @@ class Notice extends Managed_DataObject return array_values($map); } - static function getProfiles(&$notices) + static function getProfiles(array &$notices) { $ids = array(); foreach ($notices as $notice) { @@ -2842,7 +2842,7 @@ class Notice extends Managed_DataObject return Profile::pivotGet('id', $ids); } - static function fillGroups(&$notices) + static function fillGroups(array &$notices) { $ids = self::_idsOf($notices); $gis = Group_inbox::listGet('notice_id', $ids); @@ -2877,7 +2877,7 @@ class Notice extends Managed_DataObject return array_keys($ids); } - static function fillAttachments(&$notices) + static function fillAttachments(array &$notices) { $ids = self::_idsOf($notices); $f2pMap = File_to_post::listGet('post_id', $ids); @@ -2901,7 +2901,7 @@ class Notice extends Managed_DataObject } } - static function fillReplies(&$notices) + static function fillReplies(array &$notices) { $ids = self::_idsOf($notices); $replyMap = Reply::listGet('notice_id', $ids); @@ -2923,21 +2923,21 @@ class Notice extends Managed_DataObject return $this->_repeats[$this->id]; } $repeatMap = Notice::listGet('repeat_of', array($this->id)); - $this->_repeats[$this->id] = $repeatMap[$this->id]; + $this->_setRepeats($repeatMap[$this->id]); return $this->_repeats[$this->id]; } - function _setRepeats($repeats) + function _setRepeats(array $repeats) { $this->_repeats[$this->id] = $repeats; } - static function fillRepeats(&$notices) + static function fillRepeats(array &$notices) { $ids = self::_idsOf($notices); $repeatMap = Notice::listGet('repeat_of', $ids); foreach ($notices as $notice) { - $repeats = $repeatMap[$notice->id]; + $repeats = $repeatMap[$notice->id]; $notice->_setRepeats($repeats); } } -- 2.39.2