diff --git a/files/lib/data/room/RoomAction.class.php b/files/lib/data/room/RoomAction.class.php index c4d11f6..5686950 100644 --- a/files/lib/data/room/RoomAction.class.php +++ b/files/lib/data/room/RoomAction.class.php @@ -291,9 +291,7 @@ public function leave() AND userID = ?"; $statement = WCF::getDB()->prepare($sql); $statement->execute([ 0, $room->roomID, $user->userID ]); - if ($statement->getAffectedRows() === 0) { - throw new \LogicException('Unreachable'); - } + \assert($statement->getAffectedRows() > 0); WCF::getDB()->commitTransaction(); $commited = true; diff --git a/files/lib/system/attachment/MessageAttachmentObjectType.class.php b/files/lib/system/attachment/MessageAttachmentObjectType.class.php index 99212d4..dcc2ec8 100644 --- a/files/lib/system/attachment/MessageAttachmentObjectType.class.php +++ b/files/lib/system/attachment/MessageAttachmentObjectType.class.php @@ -35,9 +35,7 @@ public function canDownload($objectID) if ($objectID) { $message = new Message($objectID); - if ($message->getMessageType()->objectType !== 'be.bastelstu.chat.messageType.attachment') { - throw new \LogicException('Unreachable'); - } + \assert($message->getMessageType()->objectType === 'be.bastelstu.chat.messageType.attachment'); $room = $message->getRoom(); return $room->canSee(); diff --git a/files/lib/system/event/listener/RoomCanJoinBanListener.class.php b/files/lib/system/event/listener/RoomCanJoinBanListener.class.php index 10de3aa..0ea920d 100644 --- a/files/lib/system/event/listener/RoomCanJoinBanListener.class.php +++ b/files/lib/system/event/listener/RoomCanJoinBanListener.class.php @@ -35,9 +35,7 @@ public function execute($eventObj, $className, $eventName, array &$parameters) 'be.bastelstu.chat.suspension', 'be.bastelstu.chat.suspension.ban' ); - if (!$objectTypeID) { - throw new \LogicException('Unreachable'); - } + \assert($objectTypeID !== null); $suspensions = Suspension::getActiveSuspensionsByTriple( $objectTypeID, diff --git a/files/lib/system/event/listener/RoomCanWritePubliclyMuteListener.class.php b/files/lib/system/event/listener/RoomCanWritePubliclyMuteListener.class.php index 1d2f491..104ea2a 100644 --- a/files/lib/system/event/listener/RoomCanWritePubliclyMuteListener.class.php +++ b/files/lib/system/event/listener/RoomCanWritePubliclyMuteListener.class.php @@ -35,9 +35,7 @@ public function execute($eventObj, $className, $eventName, array &$parameters) 'be.bastelstu.chat.suspension', 'be.bastelstu.chat.suspension.mute' ); - if (!$objectTypeID) { - throw new \LogicException('Unreachable'); - } + \assert($objectTypeID !== null); $suspensions = Suspension::getActiveSuspensionsByTriple( $objectTypeID,