Use array shapes in the PHPDoc

This makes the extra documentation unnecessary
This commit is contained in:
Mike Colagrosso 2024-07-06 12:14:25 -06:00 committed by Alex Cabal
parent e5fc21ffd3
commit 807e8410b4
2 changed files with 1 additions and 7 deletions

View file

@ -16,13 +16,9 @@ use function Safe\usort;
class Library{
/**
* @param array<string> $tags
* @return array<string, array<Ebook>|int>
* @return array{ebooks: array<Ebook>, ebooksCount: int}
*/
public static function FilterEbooks(string $query = null, array $tags = [], EbookSortType $sort = null, int $page = 1, int $perPage = EBOOKS_PER_PAGE): array{
// Returns an array of:
// ['ebooks'] => array<Ebook>,
// ['ebooksCount'] => int
$limit = $perPage;
$offset = (($page - 1) * $perPage);
$joinContributors = '';

View file

@ -36,9 +36,7 @@ try{
}
$result = Library::FilterEbooks($query != '' ? $query : null, $tags, $sort, $page, $perPage);
/** @var array<Ebook> $ebooks */
$ebooks = $result['ebooks'];
/** @var int $totalEbooks */
$totalEbooks = $result['ebooksCount'];
$pageTitle = 'Browse Standard Ebooks';
$pageHeader = 'Browse Ebooks';