Skip to content

Commit 92acfbf

Browse files
committed
Merge branch '2.x'
* 2.x: bug KnpLabs#992 fixed php warning in GithubExceptionThrower (clxmstaab, acrobat) phpdoc: fix typo Update changelog for 2.19.2 release
2 parents 63f7d10 + e9576a6 commit 92acfbf

File tree

4 files changed

+40
-3
lines changed

4 files changed

+40
-3
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Changelog
22

3+
## 2.19.2
4+
5+
### Changed
6+
- Improved bc check ([acrobat](https://github.com/acrobat)) [#982](https://github.com/KnpLabs/php-github-api/issues/982)
7+
- Correctly link to github actions docs and fix backlinks ([acrobat](https://github.com/acrobat)) [#983](https://github.com/KnpLabs/php-github-api/issues/983)
8+
- Add missing repo hooks documentation ([acrobat](https://github.com/acrobat)) [#987](https://github.com/KnpLabs/php-github-api/issues/987)
9+
- Fix incorrect public key documentation ([acrobat](https://github.com/acrobat)) [#988](https://github.com/KnpLabs/php-github-api/issues/988)
10+
- Fixed incorrect parameters in apps docs ([acrobat](https://github.com/acrobat)) [#989](https://github.com/KnpLabs/php-github-api/issues/989)
11+
12+
### Fixed
13+
- Deployments: use proper media-type for in_progress/queued, inactive state ([staabm](https://github.com/staabm)) [#979](https://github.com/KnpLabs/php-github-api/issues/979)
14+
- backported #979 into 2.x ([staabm](https://github.com/staabm)) [#981](https://github.com/KnpLabs/php-github-api/issues/981)
15+
- [952] doc - Specify lcobucci/jwt version, fix deprecation ([amacrobert-meq](https://github.com/amacrobert-meq), [acrobat](https://github.com/acrobat)) [#953](https://github.com/KnpLabs/php-github-api/issues/953)
16+
- Replace deprecated organization team repository add/remove urls ([acrobat](https://github.com/acrobat)) [#985](https://github.com/KnpLabs/php-github-api/issues/985)
17+
318
## 2.19.1
419

520
### Fixed

lib/Github/Api/Deployment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function create($username, $repository, array $params)
7878
* @param int $id the deployment number
7979
* @param array $params The information about the deployment update.
8080
* Must include a "state" field of pending, success, error, or failure.
81-
* May also be given a target_url and description, ßee link for more details.
81+
* May also be given a target_url and description, see link for more details.
8282
*
8383
* @throws MissingArgumentException
8484
*

lib/Github/HttpClient/Plugin/GithubExceptionThrower.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
5656
if (422 === $response->getStatusCode() && isset($content['errors'])) {
5757
$errors = [];
5858
foreach ($content['errors'] as $error) {
59-
switch ($error['code']) {
59+
switch ($error['code'] ?? null) {
6060
case 'missing':
6161
$errors[] = sprintf('The %s %s does not exist, for resource "%s"', $error['field'], $error['value'], $error['resource']);
6262
break;
@@ -78,6 +78,12 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
7878
break;
7979

8080
default:
81+
if (is_string($error)) {
82+
$errors[] = $error;
83+
84+
break;
85+
}
86+
8187
if (isset($error['message'])) {
8288
$errors[] = $error['message'];
8389
}

test/Github/Tests/HttpClient/Plugin/GithubExceptionThrowerTest.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function (RequestInterface $request) use ($promise) {
4949
if ($exception) {
5050
$this->expectException(get_class($exception));
5151
$this->expectExceptionCode($exception->getCode());
52-
$this->expectExceptionMessage($exception->getMessage());
52+
$this->expectExceptionMessageRegExp('/'.preg_quote($exception->getMessage(), '/').'$/');
5353
}
5454

5555
$result->wait();
@@ -200,6 +200,22 @@ public static function responseProvider()
200200
),
201201
'exception' => new \Github\Exception\RuntimeException('This endpoint requires you to be authenticated.', 401),
202202
],
203+
'Cannot delete active deployment' => [
204+
'response' => new Response(
205+
422,
206+
[
207+
'content-type' => 'application/json',
208+
],
209+
json_encode(
210+
[
211+
'message' => 'Validation Failed',
212+
'errors' => ['We cannot delete an active deployment unless it is the only deployment in a given environment.'],
213+
'documentation_url' => 'https://docs.github.com/rest/reference/repos#delete-a-deployment',
214+
]
215+
)
216+
),
217+
'exception' => new \Github\Exception\ValidationFailedException('Validation Failed: We cannot delete an active deployment unless it is the only deployment in a given environment.', 422),
218+
],
203219
];
204220
}
205221
}

0 commit comments

Comments
 (0)