From 21117c37a051bf7bfe743e44486477b58d9aae67 Mon Sep 17 00:00:00 2001 From: YoonPer Date: Fri, 14 Apr 2023 15:11:01 +0800 Subject: [PATCH] Fixed code search api deprecation of sort and order parameters --- doc/search.md | 1 - lib/Github/Api/Search.php | 12 +++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/doc/search.md b/doc/search.md index 24dbbef2302..417170b954c 100644 --- a/doc/search.md +++ b/doc/search.md @@ -54,7 +54,6 @@ You can sort results using 2-3 arguments. ```php $repos = $client->api('search')->repositories('...', 'created', 'asc'); -$files = $client->api('search')->code('...........', 'indexed', 'desc'); $issues = $client->api('search')->issues('.........', 'comments', 'asc'); $users = $client->api('search')->users('..........', 'followers', 'asc'); $commits = $client->api('search')->commits('..........', 'author-date', 'desc'); diff --git a/lib/Github/Api/Search.php b/lib/Github/Api/Search.php index 96a51ea6a46..a739cb02222 100644 --- a/lib/Github/Api/Search.php +++ b/lib/Github/Api/Search.php @@ -50,15 +50,13 @@ public function issues($q, $sort = 'updated', $order = 'desc') * * @link https://developer.github.com/v3/search/#search-code * - * @param string $q the filter - * @param string $sort the sort field - * @param string $order asc/desc + * @param string $q the filter * * @return array list of code found */ - public function code($q, $sort = 'updated', $order = 'desc') + public function code(string $q) { - return $this->get('/search/code', ['q' => $q, 'sort' => $sort, 'order' => $order]); + return $this->get('/search/code', ['q' => $q]); } /** @@ -69,11 +67,11 @@ public function code($q, $sort = 'updated', $order = 'desc') * * @return array list of code found */ - public function codeWithMatch(string $q, string $sort = 'updated', string $order = 'desc'): array + public function codeWithMatch(string $q): array { $this->acceptHeaderValue = 'application/vnd.github.v3.text-match+json'; - return $this->code($q, $sort, $order); + return $this->code($q); } /**