Skip to content

Commit 8d3f456

Browse files
committed
Fix tweet comments count getter
1 parent d59d245 commit 8d3f456

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

backend/app/Entity/Tweet.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ public function getAuthor(): User
8080

8181
public function getCommentsCount(): int
8282
{
83-
return $this->comments_count;
83+
// cast to int, because if tweet doesn't have comments null will be returned
84+
return (int)$this->comments_count;
8485
}
8586

8687
public function changeContent(string $text): void

0 commit comments

Comments
 (0)