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
1717 */
1818 public function toArray ($ request ): array
1919 {
20+ /** @var array{previous: object|null, next: object|null} $resource */
21+ $ resource = $ this ->resource ;
22+
2023 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 ,
2326 ];
2427 }
2528}
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ public function getNextPost(int|string $postId): ?object
4545 * Get both previous and next posts
4646 *
4747 * @param int|string $postId
48- * @return array
48+ * @return array{previous: object|null, next: object|null}
4949 */
5050 public function getNavigatePosts (int |string $ postId ): array
5151 {
You can’t perform that action at this time.
0 commit comments