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>
This commit is contained in:
Côme Chilliet 2024-04-02 17:13:35 +02:00 committed by Richard Steinmetz
parent 9ef70f0c4e
commit ab6afe0111
9 changed files with 15 additions and 27 deletions

View File

@ -2347,7 +2347,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
* @param int $syncLevel
* @param int|null $limit
* @param int $calendarType
* @return array
* @return ?array
*/
public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
$table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions';

View File

@ -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);
}

View File

@ -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 {

View File

@ -32,10 +32,7 @@ class Literal implements ILiteral {
$this->literal = $literal;
}
/**
* @return string
*/
public function __toString() {
public function __toString(): string {
return (string) $this->literal;
}
}

View File

@ -31,10 +31,7 @@ class Parameter implements IParameter {
$this->name = $name;
}
/**
* @return string
*/
public function __toString() {
public function __toString(): string {
return (string) $this->name;
}
}

View File

@ -31,10 +31,7 @@ class QueryFunction implements IQueryFunction {
$this->function = $function;
}
/**
* @return string
*/
public function __toString() {
public function __toString(): string {
return (string) $this->function;
}
}

View File

@ -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();
}
}

View File

@ -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());
}

View File

@ -50,10 +50,9 @@ class LockNotAcquiredException extends \Exception {
/**
* custom string representation of object
*
* @return string
* @since 7.0.0
*/
public function __toString() {
public function __toString(): string {
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
}
}