From 714798ce7bde498dafae276ac54194cbd1e05144 Mon Sep 17 00:00:00 2001 From: Cameron Eagans Date: Wed, 18 May 2022 16:55:25 -0600 Subject: [PATCH 1/2] Fix typehint for repository dispatch method --- lib/Github/Api/Repo.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/Github/Api/Repo.php b/lib/Github/Api/Repo.php index 12fe726b450..8504b500fc3 100644 --- a/lib/Github/Api/Repo.php +++ b/lib/Github/Api/Repo.php @@ -283,14 +283,19 @@ public function readme($username, $repository, $format = 'raw', $dir = null, $pa * * @link https://developer.github.com/v3/repos/#create-a-repository-dispatch-event * - * @param string $username the user who owns the repository - * @param string $repository the name of the repository - * @param string $eventType A custom webhook event name + * @param string $username the user who owns the repository + * @param string $repository the name of the repository + * @param string $eventType A custom webhook event name + * @param array|object $clientPayload The payload to pass to Github. * * @return mixed null on success, array on error with 'message' */ - public function dispatch($username, $repository, $eventType, array $clientPayload) + public function dispatch($username, $repository, $eventType, $clientPayload) { + if (is_array($clientPayload)) { + $clientPayload = (object) $clientPayload; + } + return $this->post(\sprintf('/repos/%s/%s/dispatches', rawurlencode($username), rawurlencode($repository)), [ 'event_type' => $eventType, 'client_payload' => $clientPayload, From 5005773664c5f0be14c6d6b7d6c2a5bce90e7671 Mon Sep 17 00:00:00 2001 From: Cameron Eagans Date: Mon, 1 Aug 2022 11:10:02 -0600 Subject: [PATCH 2/2] styleci fixes --- lib/Github/Api/Repo.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Github/Api/Repo.php b/lib/Github/Api/Repo.php index 8504b500fc3..6b3a982b52d 100644 --- a/lib/Github/Api/Repo.php +++ b/lib/Github/Api/Repo.php @@ -283,9 +283,9 @@ public function readme($username, $repository, $format = 'raw', $dir = null, $pa * * @link https://developer.github.com/v3/repos/#create-a-repository-dispatch-event * - * @param string $username the user who owns the repository - * @param string $repository the name of the repository - * @param string $eventType A custom webhook event name + * @param string $username the user who owns the repository + * @param string $repository the name of the repository + * @param string $eventType A custom webhook event name * @param array|object $clientPayload The payload to pass to Github. * * @return mixed null on success, array on error with 'message'