Skip to content

Commit 714798c

Browse files
committed
Fix typehint for repository dispatch method
1 parent 1f31aa1 commit 714798c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/Github/Api/Repo.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,14 +283,19 @@ public function readme($username, $repository, $format = 'raw', $dir = null, $pa
283283
*
284284
* @link https://developer.github.com/v3/repos/#create-a-repository-dispatch-event
285285
*
286-
* @param string $username the user who owns the repository
287-
* @param string $repository the name of the repository
288-
* @param string $eventType A custom webhook event name
286+
* @param string $username the user who owns the repository
287+
* @param string $repository the name of the repository
288+
* @param string $eventType A custom webhook event name
289+
* @param array|object $clientPayload The payload to pass to Github.
289290
*
290291
* @return mixed null on success, array on error with 'message'
291292
*/
292-
public function dispatch($username, $repository, $eventType, array $clientPayload)
293+
public function dispatch($username, $repository, $eventType, $clientPayload)
293294
{
295+
if (is_array($clientPayload)) {
296+
$clientPayload = (object) $clientPayload;
297+
}
298+
294299
return $this->post(\sprintf('/repos/%s/%s/dispatches', rawurlencode($username), rawurlencode($repository)), [
295300
'event_type' => $eventType,
296301
'client_payload' => $clientPayload,

0 commit comments

Comments
 (0)