From 7fc5507c76085e20112532273c38d7d4d4222a17 Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Sun, 3 Mar 2024 15:04:26 +0000 Subject: [PATCH] Fix type error in ResultPager::fetch When using etags, the reply from github may be empty and the underlying APIs will return an empty string. We need to flip those to empty arrays. e.g.: ``` $github_builder ->addPlugin(new Http\Client\Common\Plugin\HeaderSetPlugin([ 'If-None-Match' => $etag, ])); $api = $github_client->user('user'); $paginator = new \Github\ResultPager($github_client); $data = $paginator->fetch($api, 'events', [$username]); // $data should be [] if $etag is the latest ``` --- lib/Github/ResultPager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Github/ResultPager.php b/lib/Github/ResultPager.php index cfd1d605e4f..fd3558cc709 100644 --- a/lib/Github/ResultPager.php +++ b/lib/Github/ResultPager.php @@ -88,7 +88,7 @@ public function fetch(AbstractApi $api, string $method, array $parameters = []): $this->postFetch(true); - return $result; + return $result ? $result : []; } /**