diff --git a/lib/private/comments/manager.php b/lib/private/comments/manager.php index 184e37eb12..a2b55c4ffd 100644 --- a/lib/private/comments/manager.php +++ b/lib/private/comments/manager.php @@ -51,7 +51,8 @@ class Manager implements ICommentsManager { * all necessary fields have a value assigned. * * @param IComment $comment - * @return IComment + * @return IComment returns the same updated IComment instance as provided + * by parameter for convenience * @throws \UnexpectedValueException */ protected function prepareCommentForDatabaseWrite(IComment $comment) { @@ -406,14 +407,13 @@ class Manager implements ICommentsManager { * Throws NotFoundException when a comment that is to be updated does not * exist anymore at this point of time. * - * @param IComment &$comment + * @param IComment $comment * @return bool * @throws NotFoundException * @since 9.0.0 */ - public function save(IComment &$comment) { - $comment = $this->prepareCommentForDatabaseWrite($comment); - if($comment->getId() === '') { + public function save(IComment $comment) { + if($this->prepareCommentForDatabaseWrite($comment)->getId() === '') { $result = $this->insert($comment); } else { $result = $this->update($comment); diff --git a/lib/public/comments/icommentsmanager.php b/lib/public/comments/icommentsmanager.php index f6883224d6..7626ffd635 100644 --- a/lib/public/comments/icommentsmanager.php +++ b/lib/public/comments/icommentsmanager.php @@ -139,12 +139,12 @@ interface ICommentsManager { * Throws NotFoundException when a comment that is to be updated does not * exist anymore at this point of time. * - * @param IComment &$comment + * @param IComment $comment * @return bool * @throws NotFoundException * @since 9.0.0 */ - public function save(IComment &$comment); + public function save(IComment $comment); /** * removes references to specific actor (e.g. on user delete) of a comment.