Skip to content

Commit 0c78b4a

Browse files
committed
fix: PHPStan PostGetNavigation
1 parent 70f31b2 commit 0c78b4a

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/Http/Actions/Post/PostGetNavigateAction.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ public function __invoke(string $slug): BaseHttpResponse|JsonResponse|JsonResour
129129
}
130130

131131
// At this point, $currentPost is guaranteed to be a Post instance
132+
/** @var Post $currentPost */
133+
132134
// Using service method for complex business logic
133135
$navigationPosts = $this->postService->getNavigationPosts($currentPost);
134136

src/Services/PostService.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,8 @@ public function getCustomFilters(array $filters): LengthAwarePaginator
4646
*
4747
* @return array{previous: null|Post, next: null|Post}
4848
*/
49-
public function getNavigationPosts(?Post $currentPost): array
49+
public function getNavigationPosts(Post $currentPost): array
5050
{
51-
if (!$currentPost instanceof Post) {
52-
throw new \InvalidArgumentException("Expected a Post instance.");
53-
}
54-
5551
$currentId = $currentPost->id;
5652

5753
// Get previous post (ID smaller than current, order by ID desc to get the closest one)

0 commit comments

Comments
 (0)