Skip to content

Commit d03aa88

Browse files
Copilotmiaulalala
andauthored
fix(psalm): remove redundant casts and dead is_string guard after native types
Agent-Logs-Url: https://github.com/nextcloud/activity/sessions/e9a877c2-92db-4439-b35e-27e0ba15f897 Co-authored-by: miaulalala <7427347+miaulalala@users.noreply.github.com>
1 parent f1b3420 commit d03aa88

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

lib/Controller/APIv2Controller.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ public function __construct(
6060
* @throws \OutOfBoundsException when no user is given
6161
*/
6262
protected function validateParameters(string $filter, int $since, int $limit, bool $previews, string $objectType, int $objectId, string $sort): void {
63-
$this->filter = \is_string($filter) ? $filter : 'all';
63+
$this->filter = $filter;
6464
if ($this->filter !== $this->data->validateFilter($this->filter)) {
6565
throw new InvalidFilterException('Invalid filter');
6666
}
67-
$this->since = (int)$since;
68-
$this->limit = (int)$limit;
69-
$this->loadPreviews = (bool)$previews;
70-
$this->objectType = (string)$objectType;
71-
$this->objectId = (int)$objectId;
67+
$this->since = $since;
68+
$this->limit = $limit;
69+
$this->loadPreviews = $previews;
70+
$this->objectType = $objectType;
71+
$this->objectId = $objectId;
7272
$this->sort = \in_array($sort, ['asc', 'desc'], true) ? $sort : 'desc';
7373

7474
if (($this->objectType !== '' && $this->objectId === 0) || ($this->objectType === '' && $this->objectId !== 0)) {

lib/Data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ protected function setOffsetFromSince(IQueryBuilder $query, string $user, int $s
331331
$queryBuilder = $this->connection->getQueryBuilder();
332332
$queryBuilder->select(['affecteduser', 'timestamp'])
333333
->from('activity')
334-
->where($queryBuilder->expr()->eq('activity_id', $queryBuilder->createNamedParameter((int)$since)));
334+
->where($queryBuilder->expr()->eq('activity_id', $queryBuilder->createNamedParameter($since)));
335335
$result = $queryBuilder->executeQuery();
336336
$activity = $result->fetch();
337337
$result->closeCursor();

0 commit comments

Comments
 (0)