Skip to content

Commit b37044d

Browse files
committed
chore: Fix psalm issues following strong typing of IUser
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent a8f21da commit b37044d

7 files changed

Lines changed: 7 additions & 6 deletions

File tree

apps/files_trashbin/lib/Trashbin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ private static function calculateFreeSpace(Folder $userFolder, int|float $trashb
850850

851851
$softQuota = true;
852852
$quota = $user->getQuota();
853-
if ($quota === null || $quota === 'none') {
853+
if ($quota === 'none') {
854854
$quota = Filesystem::free_space('/');
855855
$softQuota = false;
856856
// inf or unknown free space

apps/files_versions/lib/Storage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ public static function expire($filename, $uid) {
879879

880880
$softQuota = true;
881881
$quota = $user->getQuota();
882-
if ($quota === null || $quota === 'none') {
882+
if ($quota === 'none') {
883883
$quota = Filesystem::free_space('/');
884884
$softQuota = false;
885885
} else {

apps/provisioning_api/lib/Controller/GroupsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public function getGroupUsersDetails(string $groupId, string $search = '', ?int
216216
foreach ($users as $user) {
217217
try {
218218
/** @var IUser $user */
219-
$userId = (string)$user->getUID();
219+
$userId = $user->getUID();
220220
$userData = $this->getUserData($userId);
221221
// Do not insert empty entry
222222
if ($userData !== null) {

apps/user_ldap/lib/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ public function writeToCache($key, $value, ?int $ttlOverride = null): void {
313313
$key = $this->getCacheKey($key);
314314
$value = base64_encode(json_encode($value));
315315
$ttl = $ttlOverride ?? $this->configuration->ldapCacheTTL;
316-
$this->cache->set($key, $value, $ttl);
316+
$this->cache->set($key, $value, (int)$ttl);
317317
}
318318

319319
public function clearCache() {

build/psalm-baseline.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3417,6 +3417,7 @@
34173417
<code><![CDATA[getPassword]]></code>
34183418
<code><![CDATA[getRemember]]></code>
34193419
<code><![CDATA[getScope]]></code>
3420+
<code><![CDATA[getToken]]></code>
34203421
<code><![CDATA[setExpires]]></code>
34213422
<code><![CDATA[setLastCheck]]></code>
34223423
<code><![CDATA[setName]]></code>

lib/private/Group/Manager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ public function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0
452452

453453
$matchingUsers = [];
454454
foreach ($groupUsers as $groupUser) {
455-
$matchingUsers[(string)$groupUser->getUID()] = $groupUser->getDisplayName();
455+
$matchingUsers[$groupUser->getUID()] = $groupUser->getDisplayName();
456456
}
457457
return $matchingUsers;
458458
}

lib/private/User/LazyUser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function setEnabled(bool $enabled = true): void {
148148
}
149149

150150
#[\Override]
151-
public function getEMailAddress(): string {
151+
public function getEMailAddress(): ?string {
152152
return $this->getUser()->getEMailAddress();
153153
}
154154

0 commit comments

Comments
 (0)