Browse Source

Fix invalid argument types

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/8429/head
Joas Schilling 3 years ago
parent
commit
cc4f9ad0cf
No known key found for this signature in database GPG Key ID: 74434EFE0D2E2205
  1. 2
      lib/BackgroundJob/RemoveEmptyRooms.php
  2. 2
      lib/Capabilities.php
  3. 4
      lib/Chat/Changelog/Manager.php
  4. 4
      lib/Chat/ChatManager.php
  5. 2
      lib/Chat/Notifier.php
  6. 2
      lib/Chat/Parser/SystemMessage.php
  7. 2
      lib/Controller/RoomController.php
  8. 4
      lib/Files/Util.php
  9. 4
      lib/Manager.php
  10. 2
      lib/Migration/Version2000Date20171026140257.php
  11. 2
      lib/Participant.php
  12. 4
      lib/Service/HostedSignalingServerService.php
  13. 4
      lib/Settings/Admin/AdminSettings.php

2
lib/BackgroundJob/RemoveEmptyRooms.php

@ -106,7 +106,7 @@ class RemoveEmptyRooms extends TimedJob {
return false;
}
$mountsForFile = $this->userMountCache->getMountsForFileId($room->getObjectId());
$mountsForFile = $this->userMountCache->getMountsForFileId((int) $room->getObjectId());
if (!empty($mountsForFile)) {
return false;
}

2
lib/Capabilities.php

@ -121,7 +121,7 @@ class Capabilities implements IPublicCapability {
'allowed' => $user instanceof IUser,
],
'call' => [
'enabled' => ((int) $this->serverConfig->getAppValue('spreed', 'start_calls', Room::START_CALL_EVERYONE)) !== Room::START_CALL_NOONE,
'enabled' => ((int) $this->serverConfig->getAppValue('spreed', 'start_calls', (string) Room::START_CALL_EVERYONE)) !== Room::START_CALL_NOONE,
'breakout-rooms' => $this->talkConfig->isBreakoutRoomsEnabled(),
'recording' => $this->talkConfig->isRecordingEnabled(),
],

4
lib/Chat/Changelog/Manager.php

@ -53,7 +53,7 @@ class Manager {
}
public function getChangelogForUser(string $userId): int {
return (int) $this->config->getUserValue($userId, 'spreed', 'changelog', 0);
return (int) $this->config->getUserValue($userId, 'spreed', 'changelog', '0');
}
public function userHasNewChangelog(string $userId): bool {
@ -73,7 +73,7 @@ class Manager {
$this->chatManager->addChangelogMessage($room, $changelog);
}
$this->config->setUserValue($userId, 'spreed', 'changelog', count($this->getChangelogs()));
$this->config->setUserValue($userId, 'spreed', 'changelog', (string) count($this->getChangelogs()));
}
public function getChangelogs(): array {

4
lib/Chat/ChatManager.php

@ -506,7 +506,7 @@ class ChatManager {
}
public function getLastReadMessageFromLegacy(Room $chat, IUser $user): int {
$marker = $this->commentsManager->getReadMark('chat', $chat->getId(), $user);
$marker = $this->commentsManager->getReadMark('chat', (string) $chat->getId(), $user);
if ($marker === null) {
return 0;
}
@ -719,7 +719,7 @@ class ChatManager {
* @return IComment[]
*/
public function getMessagesById(Room $chat, array $commentIds): array {
$comments = $this->commentsManager->getCommentsById($commentIds);
$comments = $this->commentsManager->getCommentsById(array_map('strval', $commentIds));
$comments = array_filter($comments, static function (IComment $comment) use ($chat) {
return $comment->getObjectType() === 'chat'

2
lib/Chat/Notifier.php

@ -420,7 +420,7 @@ class Notifier {
}
protected function getDefaultGroupNotification(): int {
return (int) $this->config->getAppValue('spreed', 'default_group_notification', Participant::NOTIFY_MENTION);
return (int) $this->config->getAppValue('spreed', 'default_group_notification', (string) Participant::NOTIFY_MENTION);
}
/**

2
lib/Chat/Parser/SystemMessage.php

@ -585,7 +585,7 @@ class SystemMessage {
* @throws ShareNotFound
*/
protected function getFileFromShare(Participant $participant, string $shareId): array {
$share = $this->shareProvider->getShareById($shareId);
$share = $this->shareProvider->getShareById((int) $shareId);
if (!$participant->isGuest()) {
if ($share->getShareOwner() !== $participant->getAttendee()->getActorId()) {

2
lib/Controller/RoomController.php

@ -526,7 +526,7 @@ class RoomController extends AEnvironmentAwareController {
} elseif ($room->getType() === Room::TYPE_ONE_TO_ONE) {
$roomData['notificationLevel'] = Participant::NOTIFY_ALWAYS;
} else {
$adminSetting = (int) $this->config->getAppValue('spreed', 'default_group_notification', Participant::NOTIFY_DEFAULT);
$adminSetting = (int) $this->config->getAppValue('spreed', 'default_group_notification', (string) Participant::NOTIFY_DEFAULT);
if ($adminSetting === Participant::NOTIFY_DEFAULT) {
$roomData['notificationLevel'] = Participant::NOTIFY_MENTION;
} else {

4
lib/Files/Util.php

@ -56,7 +56,7 @@ class Util {
public function getUsersWithAccessFile(string $fileId): array {
if (!isset($this->accessLists[$fileId])) {
$nodes = $this->rootFolder->getById($fileId);
$nodes = $this->rootFolder->getById((int) $fileId);
if (empty($nodes)) {
return [];
@ -67,7 +67,7 @@ class Util {
if (!$node->getStorage()->instanceOfStorage(SharedStorage::class)) {
// The file is not a shared file,
// let's check the accesslist for mount points of groupfolders and external storages
$mountsForFile = $this->userMountCache->getMountsForFileId($fileId);
$mountsForFile = $this->userMountCache->getMountsForFileId((int) $fileId);
$affectedUserIds = array_map(function (ICachedMountInfo $mount) {
return $mount->getUser()->getUID();
}, $mountsForFile);

4
lib/Manager.php

@ -1098,7 +1098,7 @@ class Manager {
* @return string
*/
protected function getNewToken(): string {
$entropy = (int) $this->config->getAppValue('spreed', 'token_entropy', 8);
$entropy = (int) $this->config->getAppValue('spreed', 'token_entropy', '8');
$entropy = max(8, $entropy); // For update cases
$digitsOnly = $this->talkConfig->isSIPConfigured();
if ($digitsOnly) {
@ -1129,7 +1129,7 @@ class Manager {
}
$entropy++;
$this->config->setAppValue('spreed', 'token_entropy', $entropy);
$this->config->setAppValue('spreed', 'token_entropy', (string) $entropy);
return $this->generateNewToken($query, $entropy, $digitsOnly);
}

2
lib/Migration/Version2000Date20171026140257.php

@ -63,7 +63,7 @@ class Version2000Date20171026140257 extends SimpleMigrationStep {
}
$chars = str_replace(['l', '0', '1'], '', ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS);
$entropy = (int) $this->config->getAppValue('spreed', 'token_entropy', 8);
$entropy = (int) $this->config->getAppValue('spreed', 'token_entropy', '8');
$update = $this->connection->getQueryBuilder();
$update->update('spreedme_rooms')

2
lib/Participant.php

@ -93,7 +93,7 @@ class Participant {
}
public function canStartCall(IConfig $config): bool {
$defaultStartCall = (int) $config->getAppValue('spreed', 'start_calls', Room::START_CALL_EVERYONE);
$defaultStartCall = (int) $config->getAppValue('spreed', 'start_calls', (string) Room::START_CALL_EVERYONE);
if ($defaultStartCall === Room::START_CALL_NOONE) {
return false;

4
lib/Service/HostedSignalingServerService.php

@ -84,7 +84,7 @@ class HostedSignalingServerService {
'timeout' => 10,
]);
// this is needed here because the delete happens in a concurrent request
// this is needed here because the deletion happens in a concurrent request
// and thus the cached value in the config object would trigger an UPDATE
// instead of an INSERT if there is another request to the API server
$this->config->deleteAppValue('spreed', 'hosted-signaling-server-nonce');
@ -243,7 +243,7 @@ class HostedSignalingServerService {
*
* @return (\ArrayAccess|array|mixed)[]|\ArrayAccess
*
* @psalm-return \ArrayAccess|array{created: mixed, owner: \ArrayAccess|array, status: mixed, signaling?: \ArrayAccess|array}
* @psalm-return \ArrayAccess|non-empty-array{created: mixed, owner: \ArrayAccess|array, status: mixed, signaling?: \ArrayAccess|array}
*/
public function fetchAccountInfo(AccountId $accountId) {
try {

4
lib/Settings/Admin/AdminSettings.php

@ -98,14 +98,14 @@ class AdminSettings implements ISettings {
}
protected function initGeneralSettings(): void {
$this->initialState->provideInitialState('default_group_notification', (int) $this->serverConfig->getAppValue('spreed', 'default_group_notification', Participant::NOTIFY_MENTION));
$this->initialState->provideInitialState('default_group_notification', (int) $this->serverConfig->getAppValue('spreed', 'default_group_notification', (string) Participant::NOTIFY_MENTION));
$this->initialState->provideInitialState('conversations_files', (int) $this->serverConfig->getAppValue('spreed', 'conversations_files', '1'));
$this->initialState->provideInitialState('conversations_files_public_shares', (int) $this->serverConfig->getAppValue('spreed', 'conversations_files_public_shares', '1'));
$this->initialState->provideInitialState('valid_apache_php_configuration', $this->validApachePHPConfiguration());
}
protected function initAllowedGroups(): void {
$this->initialState->provideInitialState('start_calls', (int) $this->serverConfig->getAppValue('spreed', 'start_calls', Room::START_CALL_EVERYONE));
$this->initialState->provideInitialState('start_calls', (int) $this->serverConfig->getAppValue('spreed', 'start_calls', (string) Room::START_CALL_EVERYONE));
$groups = $this->getGroupDetailsArray($this->talkConfig->getAllowedConversationsGroupIds(), 'start_conversations');
$this->initialState->provideInitialState('start_conversations', $groups);

Loading…
Cancel
Save