diff --git a/CHANGELOG.md b/CHANGELOG.md index 653fd30..7d25a07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Usage of `Api:api` with not fully qualified class name - Usage of `Api::HTTP_RESPONSE_*` constants - Usage of response format other than `json` - - Passing a string as `$params` to the methods `create` and `update` of the `PullRequests`, `BranchRestrictions`, and `Repository` API + - Passing a string as `$params` to the methods `create` and `update` of the `PullRequests`, `BranchRestrictions`, `Pipelines`, and `Repository` API + - `ClientInterface`, use `Client` instead + - Passing a string as `$params` to the `request` method of `Client` ## 2.1.0 / 2021-07-23 diff --git a/lib/Bitbucket/API/Http/Client.php b/lib/Bitbucket/API/Http/Client.php index f038c0f..2dabe3e 100644 --- a/lib/Bitbucket/API/Http/Client.php +++ b/lib/Bitbucket/API/Http/Client.php @@ -130,6 +130,8 @@ public function request($endpoint, $params = array(), $method = 'GET', array $he } if (is_string($params) && $params !== null) { + trigger_deprecation('private-packagist/bitbucket-api', '2.2', 'Calling Client::request() with a string as params argument is deprecated. Pass an array instead.'); + $body = $params; } diff --git a/lib/Bitbucket/API/Http/ClientInterface.php b/lib/Bitbucket/API/Http/ClientInterface.php index b5bc695..ea349c1 100644 --- a/lib/Bitbucket/API/Http/ClientInterface.php +++ b/lib/Bitbucket/API/Http/ClientInterface.php @@ -16,6 +16,7 @@ /** * @author Alexandru G. + * @deprecated The ClientInterface will be removed with 3.0, depend on client directly. */ interface ClientInterface { diff --git a/lib/Bitbucket/API/Repositories/Pipelines.php b/lib/Bitbucket/API/Repositories/Pipelines.php index a18e0de..a2f5afd 100644 --- a/lib/Bitbucket/API/Repositories/Pipelines.php +++ b/lib/Bitbucket/API/Repositories/Pipelines.php @@ -47,7 +47,9 @@ public function all($account, $repo) public function create($account, $repo, $params = array()) { // allow developer to directly specify params as json if (s)he wants. - if ('array' !== gettype($params)) { + if (!is_array($params)) { + trigger_deprecation('private-packagist/bitbucket-api', '2.2', 'Calling Pipelines::create() with a string as params argument is deprecated. Pass an array instead.'); + if (empty($params)) { throw new \InvalidArgumentException('Invalid JSON provided.'); }