Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ public function deleteByUser(string $uid): array {
->where($qb2->expr()->eq('uid', $qb2->createNamedParameter($uid)));
$deleteQuery->executeStatement();

return array_values(array_map(function (array $row) {
return array_map(function (array $row) {
return [
'provider_id' => (string)$row['provider_id'],
'uid' => (string)$row['uid'],
'enabled' => ((int)$row['enabled']) === 1,
];
}, $rows));
}, $rows);
}

public function deleteAll(string $providerId): void {
Expand Down
31 changes: 9 additions & 22 deletions lib/private/DB/ArrayResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ArrayResult implements IResult {
protected int $count;

public function __construct(
/** @var array<string, mixed> $rows */
/** @var list<array<string, mixed>> $rows */
protected array $rows,
) {
$this->count = count($this->rows);
Expand Down Expand Up @@ -66,52 +66,39 @@ public function fetchOne() {
$row = $this->fetch();
if ($row) {
return current($row);
} else {
return false;
}

return false;
}

#[Override]
public function fetchAssociative(): array|false {
$row = $this->fetch();
if ($row) {
/** @var array<string, mixed> $row */
return $row;
} else {
return false;
}

return false;
}

#[Override]
public function fetchNumeric(): array|false {
$row = $this->fetch(PDO::FETCH_NUM);
if ($row) {
/** @var list<mixed> $row */
return $row;
} else {
return false;
}
return $this->fetch(PDO::FETCH_NUM);
}

#[Override]
public function fetchAllNumeric(): array {
/** @var list<list<mixed>> $result */
$result = $this->fetchAll(PDO::FETCH_NUM);
return $result;
return $this->fetchAll(PDO::FETCH_NUM);
}

#[Override]
public function fetchAllAssociative(): array {
/** @var list<array<string,mixed>> $result */
$result = $this->fetchAll();
return $result;
return $this->fetchAll();
}

#[Override]
public function fetchFirstColumn(): array {
/** @var list<mixed> $result */
$result = $this->fetchAll(PDO::FETCH_COLUMN);
return $result;
return $this->fetchAll(PDO::FETCH_COLUMN);
}

#[Override]
Expand Down
3 changes: 2 additions & 1 deletion lib/private/Files/Cache/QuerySearchHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected function applySearchConstraints(


/**
* @return array<array-key, array{id: int, name: string, visibility: int, editable: int, ref_file_id: int, number_files: int}>
* @return list<array{id: int, name: string, visibility: int, editable: int, ref_file_id: int, number_files: int}>
*/
public function findUsedTagsInCaches(ISearchQuery $searchQuery, array $caches): array {
$query = $this->getQueryBuilder();
Expand All @@ -90,6 +90,7 @@ public function findUsedTagsInCaches(ISearchQuery $searchQuery, array $caches):
$this->applySearchConstraints($query, $searchQuery, $caches);

$result = $query->executeQuery();
/** @var list<array{id: int, name: string, visibility: int, editable: int, ref_file_id: int, number_files: int}> $tags */
$tags = $result->fetchAll();
$result->closeCursor();
return $tags;
Expand Down
8 changes: 4 additions & 4 deletions lib/public/DB/IResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ interface IResult {
public function closeCursor(): bool;

/**
* @param int $fetchMode
* @param PDO::FETCH_* $fetchMode
*
* @return mixed
* @return ($fetchMode is PDO::FETCH_ASSOC ? array<string, mixed> : ($fetchMode is PDO::FETCH_NUM ? list<mixed> : mixed))|false
*
* @since 21.0.0
* @note Since 33.0.0, prefer using fetchAssociative/fetchNumeric/fetchOne or iterateAssociate/iterateNumeric instead.
Expand Down Expand Up @@ -76,9 +76,9 @@ public function fetchNumeric(): array|false;
public function fetchOne();

/**
* @param int $fetchMode (one of PDO::FETCH_ASSOC, PDO::FETCH_NUM or PDO::FETCH_COLUMN (2, 3 or 7)
* @param PDO::FETCH_* $fetchMode
*
* @return mixed[]
* @return list<($fetchMode is PDO::FETCH_ASSOC ? array<string, mixed> : ($fetchMode is PDO::FETCH_NUM ? list<mixed> : mixed))>
*
* @since 21.0.0
* @note Since 33.0.0, prefer using fetchAllAssociative/fetchAllNumeric/fetchFirstColumn or iterateAssociate/iterateNumeric instead.
Expand Down
Loading