diff --git a/files/lib/data/message/Message.class.php b/files/lib/data/message/Message.class.php index 9361fde..de0aa11 100644 --- a/files/lib/data/message/Message.class.php +++ b/files/lib/data/message/Message.class.php @@ -14,6 +14,10 @@ namespace chat\data\message; +use \chat\data\room\Room; +use \wcf\data\object\type\ObjectType; +use \wcf\data\object\type\ObjectTypeCache; + /** * Represents a chat message. * @@ -42,28 +46,22 @@ protected function handleData($data) { /** * Returns whether this message already is inside the log. - * - * @return boolean */ - public function isInLog() { + public function isInLog(): bool { return $this->time < (TIME_NOW - CHAT_ARCHIVE_AFTER); } /** * Returns the message type object of this message. - * - * @return \wcf\data\object\type\ObjectType */ - public function getMessageType() { - return \wcf\data\object\type\ObjectTypeCache::getInstance()->getObjectType($this->objectTypeID); + public function getMessageType(): ObjectType { + return ObjectTypeCache::getInstance()->getObjectType($this->objectTypeID); } /** * Returns the chat room that contains this message. - * - * @return \chat\data\room\Room */ - public function getRoom() { + public function getRoom(): Room { return \chat\data\room\RoomCache::getInstance()->getRoom($this->roomID); } } diff --git a/files/lib/data/room/Room.class.php b/files/lib/data/room/Room.class.php index 58a3601..de36be7 100644 --- a/files/lib/data/room/Room.class.php +++ b/files/lib/data/room/Room.class.php @@ -52,11 +52,8 @@ public function __toString() { * Returns whether the given user can see at least * one chat room. If no user is given the current user * should be assumed - * - * @param \wcf\data\user\UserProfile $user - * @return boolean */ - public static function canSeeAny(\wcf\data\user\UserProfile $user = null) { + public static function canSeeAny(\wcf\data\user\UserProfile $user = null): bool { $rooms = RoomCache::getInstance()->getRooms(); foreach ($rooms as $room) { if ($room->canSee($user)) return true; @@ -68,11 +65,8 @@ public static function canSeeAny(\wcf\data\user\UserProfile $user = null) { /** * Returns whether the given user can see this room. * If no user is given the current user should be assumed. - * - * @param \wcf\data\user\UserProfile $user - * @return boolean */ - public function canSee(\wcf\data\user\UserProfile $user = null, \Exception &$reason = null) { + public function canSee(\wcf\data\user\UserProfile $user = null, \Exception &$reason = null): bool { static $cache = [ ]; if ($user === null) $user = new \wcf\data\user\UserProfile(WCF::getUser()); @@ -107,11 +101,8 @@ public function canSee(\wcf\data\user\UserProfile $user = null, \Exception &$rea /** * Returns whether the given user can see the log of this room. * If no user is given the current user should be assumed. - * - * @param \wcf\data\user\UserProfile $user - * @return boolean */ - public function canSeeLog(\wcf\data\user\UserProfile $user = null, \Exception &$reason = null) { + public function canSeeLog(\wcf\data\user\UserProfile $user = null, \Exception &$reason = null): bool { static $cache = [ ]; if ($user === null) $user = new \wcf\data\user\UserProfile(WCF::getUser()); @@ -141,11 +132,8 @@ public function canSeeLog(\wcf\data\user\UserProfile $user = null, \Exception &$ /** * Returns whether the given user can join this room. * If no user is given the current user should be assumed. - * - * @param \wcf\data\user\UserProfile $user - * @return boolean */ - public function canJoin(\wcf\data\user\UserProfile $user = null, \Exception &$reason = null) { + public function canJoin(\wcf\data\user\UserProfile $user = null, \Exception &$reason = null): bool { static $cache = [ ]; if ($user === null) $user = new \wcf\data\user\UserProfile(WCF::getUser()); @@ -170,11 +158,8 @@ public function canJoin(\wcf\data\user\UserProfile $user = null, \Exception &$re /** * Returns whether the given user can write public messages in this room. * If no user is given the current user should be assumed. - * - * @param \wcf\data\user\UserProfile $user - * @return boolean */ - public function canWritePublicly(\wcf\data\user\UserProfile $user = null, \Exception &$reason = null) { + public function canWritePublicly(\wcf\data\user\UserProfile $user = null, \Exception &$reason = null): bool { static $cache = [ ]; if ($user === null) $user = new \wcf\data\user\UserProfile(WCF::getUser());