Skip to content

Commit 2ee19c6

Browse files
committed
Array fix for pull requests
1 parent 7a84aef commit 2ee19c6

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

src/GithubClient.php

+9-14
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ public function getRepositories(
8585
$allRepos = array_merge($allRepos, $repos);
8686

8787
$page++;
88-
8988
} while (count($repos) === $perPage);
9089

9190
return $allRepos;
@@ -165,7 +164,6 @@ public function getCommitsFromRepository(
165164
$allCommits = array_merge($allCommits, $commits);
166165

167166
$page++;
168-
169167
} while (count($commits) === $perPage);
170168

171169
return $allCommits;
@@ -231,21 +229,20 @@ public function getIssues(
231229
$allIssues = array_merge($allIssues, $issues);
232230

233231
$page++;
234-
235232
} while (count($issues) === $perPage);
236233

237234
return $allIssues;
238235
}
239236

240237
/**
241-
* Get pull requests from a repository.
242-
*
243-
* @param string $owner The owner of the repository
244-
* @param string $repo The name of the repository
245-
* @param int $perPage Number of results per page. Default: 25
246-
* @param int $page Page number of the results to fetch. Default: 1
247-
* @return array|null Array of pull requests
248-
*/
238+
* Get pull requests from a repository.
239+
*
240+
* @param string $owner The owner of the repository
241+
* @param string $repo The name of the repository
242+
* @param int $perPage Number of results per page. Default: 25
243+
* @param int $page Page number of the results to fetch. Default: 1
244+
* @return array|null Array of pull requests
245+
*/
249246
public function getPullRequests(
250247
string $repo,
251248
string $owner,
@@ -265,17 +262,15 @@ public function getPullRequests(
265262
]);
266263

267264
if ($response->failed()) {
268-
return null;
265+
return [];
269266
}
270267

271268
$pullRequests = $response->json();
272269
$allPullRequests = array_merge($allPullRequests, $pullRequests);
273270

274271
$page++;
275-
276272
} while (count($pullRequests) === $perPage);
277273

278274
return $allPullRequests;
279275
}
280276
}
281-

0 commit comments

Comments
 (0)