Skip to content

Commit

Permalink
Merge pull request #14 from packagist/deprecations
Browse files Browse the repository at this point in the history
More deprecations
  • Loading branch information
glaubinix committed Dec 5, 2022
2 parents 450814a + 0e24cb4 commit cc8f9dc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions lib/Bitbucket/API/Http/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions lib/Bitbucket/API/Http/ClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

/**
* @author Alexandru G. <alex@gentle.ro>
* @deprecated The ClientInterface will be removed with 3.0, depend on client directly.
*/
interface ClientInterface
{
Expand Down
4 changes: 3 additions & 1 deletion lib/Bitbucket/API/Repositories/Pipelines.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}
Expand Down

0 comments on commit cc8f9dc

Please sign in to comment.