mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-21 21:30:08 +00:00
Avoid the use of empty()
This commit is contained in:
parent
ad9fba9d73
commit
527a04db58
@ -101,7 +101,7 @@ public function validate()
|
||||
{
|
||||
parent::validate();
|
||||
|
||||
if (empty($this->commandTrigger)) {
|
||||
if ($this->commandTrigger === '') {
|
||||
throw new UserInputException('commandTrigger', 'empty');
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ public function validate()
|
||||
throw new UserInputException('commandTrigger', 'duplicate');
|
||||
}
|
||||
|
||||
if (empty($this->className)) {
|
||||
if ($this->className === '') {
|
||||
throw new UserInputException('className', 'empty');
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ public function saveI18nValue(Room $room, $columns)
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($data)) {
|
||||
if ($data !== []) {
|
||||
(new RoomEditor($room))->update($data);
|
||||
}
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ public function readParameters()
|
||||
if (isset($_POST['searchUsername'])) {
|
||||
$this->searchUsername = StringUtil::trim($_POST['searchUsername']);
|
||||
|
||||
if (!empty($this->searchUsername)) {
|
||||
if ($this->searchUsername !== '') {
|
||||
$this->userID = User::getUserByUsername($this->searchUsername)->userID;
|
||||
}
|
||||
} elseif ($this->userID !== null) {
|
||||
@ -159,7 +159,7 @@ public function readParameters()
|
||||
if (isset($_POST['searchJudge'])) {
|
||||
$this->searchJudge = StringUtil::trim($_POST['searchJudge']);
|
||||
|
||||
if (!empty($this->searchJudge)) {
|
||||
if ($this->searchJudge !== '') {
|
||||
$this->judgeID = User::getUserByUsername($this->searchJudge)->userID;
|
||||
}
|
||||
} elseif ($this->judgeID !== null) {
|
||||
|
@ -333,7 +333,7 @@ public function pull()
|
||||
return $message->hasEmbeddedObjects;
|
||||
}));
|
||||
|
||||
if (!empty($embeddedObjectMessageIDs)) {
|
||||
if ($embeddedObjectMessageIDs !== []) {
|
||||
// load embedded objects
|
||||
MessageEmbeddedObjectManager::getInstance()->loadObjects('be.bastelstu.chat.message', $embeddedObjectMessageIDs);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public static function deleteAll(array $messageIDs = [])
|
||||
WCF::getDB()->beginTransaction();
|
||||
|
||||
$result = parent::deleteAll($messageIDs);
|
||||
if (!empty($messageIDs)) {
|
||||
if ($messageIDs !== []) {
|
||||
AttachmentHandler::removeAttachments('be.bastelstu.chat.message', $messageIDs);
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ public function getUsersByID()
|
||||
public function clearDeadSessions()
|
||||
{
|
||||
$sessions = User::getDeadSessions();
|
||||
if (empty($sessions)) {
|
||||
if ($sessions !== []) {
|
||||
return;
|
||||
}
|
||||
$userIDs = \array_map(static function ($item) {
|
||||
|
@ -41,7 +41,7 @@ public function execute($eventObj, $className, $eventName, array &$parameters)
|
||||
$toDelete[] = $room;
|
||||
}
|
||||
}
|
||||
if (!empty($toDelete)) {
|
||||
if ($toDelete !== []) {
|
||||
(new RoomAction(
|
||||
$toDelete,
|
||||
'delete'
|
||||
|
@ -42,7 +42,7 @@ public function execute($eventObj, $className, $eventName, array &$parameters)
|
||||
$parameters['user']->getDecoratedObject(),
|
||||
$eventObj
|
||||
);
|
||||
if (!empty($suspensions)) {
|
||||
if ($suspensions !== []) {
|
||||
$parameters['result'] = new PermissionDeniedException(
|
||||
WCF::getLanguage()->getDynamicVariable('chat.suspension.info.be.bastelstu.chat.suspension.ban')
|
||||
);
|
||||
|
@ -42,7 +42,7 @@ public function execute($eventObj, $className, $eventName, array &$parameters)
|
||||
$parameters['user']->getDecoratedObject(),
|
||||
$eventObj
|
||||
);
|
||||
if (!empty($suspensions)) {
|
||||
if ($suspensions !== []) {
|
||||
$parameters['result'] = new PermissionDeniedException(
|
||||
WCF::getLanguage()->getDynamicVariable('chat.suspension.info.be.bastelstu.chat.suspension.mute')
|
||||
);
|
||||
|
@ -36,7 +36,7 @@ public function getOutstandingItemCount($objectID = null): int
|
||||
return $room->canSee();
|
||||
}));
|
||||
|
||||
if (empty($users)) {
|
||||
if ($users === []) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user