From 0f1f10fa2d11f1265480f8fa27a484fc707f04cf Mon Sep 17 00:00:00 2001 From: Jeroen Thora Date: Sun, 28 Mar 2021 10:20:23 +0200 Subject: [PATCH] Add deprecations to the PR review methods to allow cleanup --- composer.json | 3 ++- lib/Github/Api/PullRequest/Review.php | 6 ++++++ lib/Github/Api/PullRequest/ReviewRequest.php | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 864d25c0219..cb858e180f0 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,8 @@ "psr/http-client-implementation": "^1.0", "psr/http-factory-implementation": "^1.0", "psr/http-message": "^1.0", - "symfony/polyfill-php80": "^1.17" + "symfony/polyfill-php80": "^1.17", + "symfony/deprecation-contracts": "^2.2" }, "require-dev": { "symfony/cache": "^5.1.8", diff --git a/lib/Github/Api/PullRequest/Review.php b/lib/Github/Api/PullRequest/Review.php index 249477f0478..ed586ddf6fc 100644 --- a/lib/Github/Api/PullRequest/Review.php +++ b/lib/Github/Api/PullRequest/Review.php @@ -20,6 +20,8 @@ class Review extends AbstractApi public function configure() { + trigger_deprecation('KnpLabs/php-github-api', '3.2', 'The "%s" is deprecated and will be removed.', __METHOD__); + return $this; } @@ -37,6 +39,10 @@ public function configure() */ public function all($username, $repository, $pullRequest, array $params = []) { + if (!empty($params)) { + trigger_deprecation('KnpLabs/php-github-api', '3.2', 'The "$params" parameter is deprecated, to paginate the results use the "ResultPager" instead.'); + } + $parameters = array_merge([ 'page' => 1, 'per_page' => 30, diff --git a/lib/Github/Api/PullRequest/ReviewRequest.php b/lib/Github/Api/PullRequest/ReviewRequest.php index 540307559e2..d95913ccde3 100644 --- a/lib/Github/Api/PullRequest/ReviewRequest.php +++ b/lib/Github/Api/PullRequest/ReviewRequest.php @@ -14,6 +14,8 @@ class ReviewRequest extends AbstractApi public function configure() { + trigger_deprecation('KnpLabs/php-github-api', '3.2', 'The "%s" is deprecated and will be removed.', __METHOD__); + return $this; } @@ -29,6 +31,10 @@ public function configure() */ public function all($username, $repository, $pullRequest, array $params = []) { + if (!empty($params)) { + trigger_deprecation('KnpLabs/php-github-api', '3.2', 'The "$params" parameter is deprecated, to paginate the results use the "ResultPager" instead.'); + } + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/requested_reviewers', $params); }