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>
pull/44607/head
Côme Chilliet 2 months ago committed by Richard Steinmetz
parent 9ef70f0c4e
commit ab6afe0111

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

@ -60,7 +60,7 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer {
* @psalm-param S $id * @psalm-param S $id
* @psalm-return (S is class-string<T> ? T : mixed) * @psalm-return (S is class-string<T> ? T : mixed)
*/ */
public function get(string $id) { public function get(string $id): mixed {
return $this->query($id); return $this->query($id);
} }

@ -91,8 +91,6 @@ class ProviderUserAssignmentDao {
/** /**
* Delete all provider states of a user and return the provider IDs * 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}> * @return list<array{provider_id: string, uid: string, enabled: bool}>
*/ */
public function deleteByUser(string $uid): array { public function deleteByUser(string $uid): array {
@ -100,7 +98,7 @@ class ProviderUserAssignmentDao {
$selectQuery = $qb1->select('*') $selectQuery = $qb1->select('*')
->from(self::TABLE_NAME) ->from(self::TABLE_NAME)
->where($qb1->expr()->eq('uid', $qb1->createNamedParameter($uid))); ->where($qb1->expr()->eq('uid', $qb1->createNamedParameter($uid)));
$selectResult = $selectQuery->execute(); $selectResult = $selectQuery->executeQuery();
$rows = $selectResult->fetchAll(); $rows = $selectResult->fetchAll();
$selectResult->closeCursor(); $selectResult->closeCursor();
@ -108,15 +106,15 @@ class ProviderUserAssignmentDao {
$deleteQuery = $qb2 $deleteQuery = $qb2
->delete(self::TABLE_NAME) ->delete(self::TABLE_NAME)
->where($qb2->expr()->eq('uid', $qb2->createNamedParameter($uid))); ->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 [ return [
'provider_id' => $row['provider_id'], 'provider_id' => (string)$row['provider_id'],
'uid' => $row['uid'], 'uid' => (string)$row['uid'],
'enabled' => (int) $row['enabled'] === 1, 'enabled' => ((int) $row['enabled']) === 1,
]; ];
}, $rows); }, $rows));
} }
public function deleteAll(string $providerId): void { public function deleteAll(string $providerId): void {

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

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

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

@ -101,7 +101,7 @@ class Event implements IEvent {
return $this->end - $this->start; return $this->end - $this->start;
} }
public function __toString() { public function __toString(): string {
return $this->getId() . ' ' . $this->getDescription() . ' ' . $this->getDuration(); return $this->getId() . ' ' . $this->getDescription() . ' ' . $this->getDuration();
} }
} }

@ -419,7 +419,7 @@ class OC_Image implements \OCP\IImage {
/** /**
* @return string - base64 encoded, which is suitable for embedding in a VCard. * @return string - base64 encoded, which is suitable for embedding in a VCard.
*/ */
public function __toString() { public function __toString(): string {
return base64_encode($this->data()); return base64_encode($this->data());
} }

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

Loading…
Cancel
Save