Use array shapes in PHPDoc for FilterArtwork

This commit is contained in:
Mike Colagrosso 2024-07-06 12:34:45 -06:00 committed by Alex Cabal
parent b5933631c5
commit ad9bdde32d
2 changed files with 1 additions and 7 deletions

View file

@ -168,13 +168,9 @@ class Library{
}
/**
* @return array<string, array<Artwork>|int>
* @return array{artworks: array<Artwork>, artworksCount: int}
*/
public static function FilterArtwork(?string $query = null, ?string $status = null, ?ArtworkSortType $sort = null, ?int $submitterUserId = null, int $page = 1, int $perPage = ARTWORK_PER_PAGE): array{
// Returns an array of:
// ['artworks'] => array<Artwork>,
// ['artworksCount'] => int
//
// $status is either the string value of an ArtworkStatus enum, or one of these special statuses:
// null: same as "all"
// "all": Show all approved and in use artwork

View file

@ -68,9 +68,7 @@ try{
}
else{
$result = Library::FilterArtwork($query, $filterArtworkStatus, $sort, $submitterUserId, $page, $perPage);
/** @var array<Artwork> $artworks */
$artworks = $result['artworks'];
/** @var int $totalArtworkCount */
$totalArtworkCount = $result['artworksCount'];
}