diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-04-02 17:13:35 +0200 |
---|---|---|
committer | Richard Steinmetz <richard@steinmetz.cloud> | 2024-04-08 11:29:09 +0200 |
commit | ab6afe0111b25bd2d764bb807f086808ae7a5534 (patch) | |
tree | daa4749047458d69e04da2d8e1fef348ceed6630 /lib/private | |
parent | 9ef70f0c4e94bd32d6b7732d4735c561901cb3df (diff) | |
download | nextcloud-server-ab6afe0111b25bd2d764bb807f086808ae7a5534.tar.gz nextcloud-server-ab6afe0111b25bd2d764bb807f086808ae7a5534.zip |
fix: Fix new psalm errors from update
Not sure about the SimpleContainer modification, let’s see what CI says
about that.
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/AppFramework/Utility/SimpleContainer.php | 2 | ||||
-rw-r--r-- | lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php | 16 | ||||
-rw-r--r-- | lib/private/DB/QueryBuilder/Literal.php | 5 | ||||
-rw-r--r-- | lib/private/DB/QueryBuilder/Parameter.php | 5 | ||||
-rw-r--r-- | lib/private/DB/QueryBuilder/QueryFunction.php | 5 | ||||
-rw-r--r-- | lib/private/Diagnostics/Event.php | 2 | ||||
-rw-r--r-- | lib/private/legacy/OC_Image.php | 2 |
7 files changed, 13 insertions, 24 deletions
diff --git a/lib/private/AppFramework/Utility/SimpleContainer.php b/lib/private/AppFramework/Utility/SimpleContainer.php index 83aed4381b3..77f09df307d 100644 --- a/lib/private/AppFramework/Utility/SimpleContainer.php +++ b/lib/private/AppFramework/Utility/SimpleContainer.php @@ -60,7 +60,7 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer { * @psalm-param S $id * @psalm-return (S is class-string<T> ? T : mixed) */ - public function get(string $id) { + public function get(string $id): mixed { return $this->query($id); } diff --git a/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php b/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php index db5da97f275..458ed690e56 100644 --- a/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php +++ b/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php @@ -91,8 +91,6 @@ class ProviderUserAssignmentDao { /** * Delete all provider states of a user and return the provider IDs * - * @param string $uid - * * @return list<array{provider_id: string, uid: string, enabled: bool}> */ public function deleteByUser(string $uid): array { @@ -100,7 +98,7 @@ class ProviderUserAssignmentDao { $selectQuery = $qb1->select('*') ->from(self::TABLE_NAME) ->where($qb1->expr()->eq('uid', $qb1->createNamedParameter($uid))); - $selectResult = $selectQuery->execute(); + $selectResult = $selectQuery->executeQuery(); $rows = $selectResult->fetchAll(); $selectResult->closeCursor(); @@ -108,15 +106,15 @@ class ProviderUserAssignmentDao { $deleteQuery = $qb2 ->delete(self::TABLE_NAME) ->where($qb2->expr()->eq('uid', $qb2->createNamedParameter($uid))); - $deleteQuery->execute(); + $deleteQuery->executeStatement(); - return array_map(function (array $row) { + return array_values(array_map(function (array $row) { return [ - 'provider_id' => $row['provider_id'], - 'uid' => $row['uid'], - 'enabled' => (int) $row['enabled'] === 1, + 'provider_id' => (string)$row['provider_id'], + 'uid' => (string)$row['uid'], + 'enabled' => ((int) $row['enabled']) === 1, ]; - }, $rows); + }, $rows)); } public function deleteAll(string $providerId): void { diff --git a/lib/private/DB/QueryBuilder/Literal.php b/lib/private/DB/QueryBuilder/Literal.php index b4e8a36b86f..321a836abc7 100644 --- a/lib/private/DB/QueryBuilder/Literal.php +++ b/lib/private/DB/QueryBuilder/Literal.php @@ -32,10 +32,7 @@ class Literal implements ILiteral { $this->literal = $literal; } - /** - * @return string - */ - public function __toString() { + public function __toString(): string { return (string) $this->literal; } } diff --git a/lib/private/DB/QueryBuilder/Parameter.php b/lib/private/DB/QueryBuilder/Parameter.php index b6cfa844e01..148580447bd 100644 --- a/lib/private/DB/QueryBuilder/Parameter.php +++ b/lib/private/DB/QueryBuilder/Parameter.php @@ -31,10 +31,7 @@ class Parameter implements IParameter { $this->name = $name; } - /** - * @return string - */ - public function __toString() { + public function __toString(): string { return (string) $this->name; } } diff --git a/lib/private/DB/QueryBuilder/QueryFunction.php b/lib/private/DB/QueryBuilder/QueryFunction.php index 41798f233cd..c0fd38150ef 100644 --- a/lib/private/DB/QueryBuilder/QueryFunction.php +++ b/lib/private/DB/QueryBuilder/QueryFunction.php @@ -31,10 +31,7 @@ class QueryFunction implements IQueryFunction { $this->function = $function; } - /** - * @return string - */ - public function __toString() { + public function __toString(): string { return (string) $this->function; } } diff --git a/lib/private/Diagnostics/Event.php b/lib/private/Diagnostics/Event.php index 0c3aa6ae29c..554f54a6ffd 100644 --- a/lib/private/Diagnostics/Event.php +++ b/lib/private/Diagnostics/Event.php @@ -101,7 +101,7 @@ class Event implements IEvent { return $this->end - $this->start; } - public function __toString() { + public function __toString(): string { return $this->getId() . ' ' . $this->getDescription() . ' ' . $this->getDuration(); } } diff --git a/lib/private/legacy/OC_Image.php b/lib/private/legacy/OC_Image.php index 48f1812038b..28d4af118f0 100644 --- a/lib/private/legacy/OC_Image.php +++ b/lib/private/legacy/OC_Image.php @@ -419,7 +419,7 @@ class OC_Image implements \OCP\IImage { /** * @return string - base64 encoded, which is suitable for embedding in a VCard. */ - public function __toString() { + public function __toString(): string { return base64_encode($this->data()); } |