Skip to content

Commit 3975f1b

Browse files
committed
feat: add type hinting and improve payload handling in WebhookAction
1 parent f519d3a commit 3975f1b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

phpstan-baseline.neon

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ parameters:
55

66
- message: '#Part \$routePrefix \(mixed\) of encapsed string cannot be cast to string\.#'
77
path: routes/*.php
8+
9+
- message: '#Cannot cast mixed to string#'
10+
path: src/*.php

src/Actions/WebhookAction.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public function __invoke(): JsonResponse
2424
return response()->json(['message' => __('github-project::github-project.error.event.denied')], 403);
2525
}
2626

27+
/** @var array<string, list<string, mixed>> $payload */
2728
$payload = json_decode($request->getContent(), true);
2829

2930
if (!isset($payload['action'])) {
@@ -53,7 +54,7 @@ public function __invoke(): JsonResponse
5354
compact('editor', 'fieldName', 'fromValue', 'toValue')
5455
)->render();
5556

56-
$this->webhookService->commentOnNode($nodeId, $message);
57+
$this->webhookService->commentOnNode((string) $nodeId, $message);
5758

5859
return response()->json(['message' => __('github-project::github-project.success.message')]);
5960
}

0 commit comments

Comments
 (0)