Skip to content

Commit

Permalink
Add more fields to phpdoc
Browse files Browse the repository at this point in the history
We were missing `id` and others.
Also format the type into multiple lines for legibility.
  • Loading branch information
jtojnar committed Dec 29, 2024
1 parent ce3f897 commit e88f0b8
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 3 deletions.
24 changes: 23 additions & 1 deletion src/controllers/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,29 @@ public function home(): void {
* @param array<string, mixed> $params request parameters
* @param array<array{tag: string, color: string, unread: int}> $tags information about tags
*
* @return array{entries: array<array{title: string, strippedTitle: string, content: string, wordCount: int, lengthWithoutTags: int, datetime: string, updatetime: string, sourcetitle: string, tags: StringKeyedArray<array{backColor: string, foreColor: string}>}>, hasMore: bool} html with items
* @return array{
* entries: array<array{
* id: int,
* title: string,
* strippedTitle: string,
* content: string,
* unread: bool,
* starred: bool,
* source: int,
* thumbnail: string,
* icon: string,
* uid: string,
* link: string,
* wordCount: int,
* lengthWithoutTags: int,
* datetime: string,
* updatetime: string,
* sourcetitle: string,
* author: string,
* tags: StringKeyedArray<array{backColor: string, foreColor: string}>,
* }>,
* hasMore: bool,
* } html with items
*/
private function loadItems(array $params, array $tags) {
$options = new ItemOptions($params);
Expand Down
39 changes: 37 additions & 2 deletions src/helpers/ViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,47 @@ public function camoflauge(string $content): string {
/**
* Prepare entry as expected by the client.
*
* @param array{title: string, content: string, datetime: DateTime, updatetime: DateTime, sourcetitle: string, tags: string[]} $item item to modify
* @param array{
* id: int,
* title: string,
* content: string,
* unread: bool,
* starred: bool,
* source: int,
* thumbnail: string,
* icon: string,
* uid: string,
* link: string,
* datetime: DateTime,
* updatetime: DateTime,
* sourcetitle: string,
* author: string,
* tags: string[],
* } $item item to modify
* @param \controllers\Tags $tagsController tags controller
* @param ?array<array{tag: string, color: string}> $tags list of tags
* @param ?string $search search query
*
* @return array{title: string, strippedTitle: string, content: string, wordCount: int, lengthWithoutTags: int, datetime: string, updatetime: string, sourcetitle: string, tags: StringKeyedArray<array{backColor: string, foreColor: string}>} modified item
* @return array{
* id: int,
* title: string,
* strippedTitle: string,
* content: string,
* unread: bool,
* starred: bool,
* source: int,
* thumbnail: string,
* icon: string,
* uid: string,
* link: string,
* wordCount: int,
* lengthWithoutTags: int,
* datetime: string,
* updatetime: string,
* sourcetitle: string,
* author: string,
* tags: StringKeyedArray<array{backColor: string, foreColor: string}>,
* } modified item
*/
public function preprocessEntry(array $item, \controllers\Tags $tagsController, ?array $tags = null, ?string $search = null): array {
// parse tags and assign tag colors
Expand Down

0 comments on commit e88f0b8

Please sign in to comment.