File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -17,9 +17,12 @@ class PostNavigateResource extends JsonResource
17
17
*/
18
18
public function toArray ($ request ): array
19
19
{
20
+ /** @var array{previous: object|null, next: object|null} $resource */
21
+ $ resource = $ this ->resource ;
22
+
20
23
return [
21
- 'previous ' => $ this -> resource ['previous ' ] ? new PostNavigationResource ($ this -> resource ['previous ' ]) : null ,
22
- 'next ' => $ this -> resource ['next ' ] ? new PostNavigationResource ($ this -> resource ['next ' ]) : null ,
24
+ 'previous ' => $ resource ['previous ' ] ? new PostNavigationResource ($ resource ['previous ' ]) : null ,
25
+ 'next ' => $ resource ['next ' ] ? new PostNavigationResource ($ resource ['next ' ]) : null ,
23
26
];
24
27
}
25
28
}
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ public function getNextPost(int|string $postId): ?object
45
45
* Get both previous and next posts
46
46
*
47
47
* @param int|string $postId
48
- * @return array
48
+ * @return array{previous: object|null, next: object|null}
49
49
*/
50
50
public function getNavigatePosts (int |string $ postId ): array
51
51
{
You can’t perform that action at this time.
0 commit comments