Skip to content

Commit e15ee94

Browse files
authored
feature KnpLabs#1066 Fix typehint for repository dispatch method (cweagans)
This PR was squashed before being merged into the 3.4.x-dev branch. Discussion ---------- Closes KnpLabs#1065 Commits ------- 714798c Fix typehint for repository dispatch method 5005773 styleci fixes
1 parent aed0167 commit e15ee94

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
@@ -286,14 +286,19 @@ public function readme($username, $repository, $format = 'raw', $dir = null, $pa
286286
*
287287
* @link https://developer.github.com/v3/repos/#create-a-repository-dispatch-event
288288
*
289-
* @param string $username the user who owns the repository
290-
* @param string $repository the name of the repository
291-
* @param string $eventType A custom webhook event name
289+
* @param string $username the user who owns the repository
290+
* @param string $repository the name of the repository
291+
* @param string $eventType A custom webhook event name
292+
* @param array|object $clientPayload The payload to pass to Github.
292293
*
293294
* @return mixed null on success, array on error with 'message'
294295
*/
295-
public function dispatch($username, $repository, $eventType, array $clientPayload)
296+
public function dispatch($username, $repository, $eventType, $clientPayload)
296297
{
298+
if (is_array($clientPayload)) {
299+
$clientPayload = (object) $clientPayload;
300+
}
301+
297302
return $this->post(\sprintf('/repos/%s/%s/dispatches', rawurlencode($username), rawurlencode($repository)), [
298303
'event_type' => $eventType,
299304
'client_payload' => $clientPayload,

0 commit comments

Comments
 (0)