Skip to content

Commit a16bc40

Browse files
committed
Deprecate lastCallFailed.
1 parent 1e98775 commit a16bc40

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased](https://github.com/kbsali/php-redmine-api/compare/v2.0.1...v2.x)
99

10+
### Changed
11+
12+
- `Redmine\Api\AbstractApi::lastCallFailed()` is deprecated, use `Redmine\Client\Client::getLastResponseStatusCode()` instead
13+
1014
## [v2.0.1](https://github.com/kbsali/php-redmine-api/compare/v2.0.0...v2.0.1) - 2021-09-22
1115

1216
### Fixed

docs/usage.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ $client->stopImpersonateUser();
199199

200200
You can now use the `getApi()` method to create and get a specific Redmine API.
201201

202+
To check for failed requests you can afterwards check the status code via `$client->getLastResponseStatusCode()`.
203+
202204
```php
203205
// ----------------------------
204206
// Trackers

src/Redmine/Api/AbstractApi.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,14 @@ public function __construct(Client $client)
2828
* Returns whether or not the last api call failed.
2929
*
3030
* @return bool
31+
*
32+
* @deprecated This method does not correctly handle 2xx codes that are not 200 or 201, use \Redmine\Client\Client::getLastResponseStatusCode() instead
33+
* @see Client::getLastResponseStatusCode() for checking the status code directly
3134
*/
3235
public function lastCallFailed()
3336
{
37+
@trigger_error('The '.__METHOD__.' method is deprecated, use \Redmine\Client\Client::getLastResponseStatusCode() instead.', E_USER_DEPRECATED);
38+
3439
$code = $this->client->getLastResponseStatusCode();
3540

3641
return 200 !== $code && 201 !== $code;

0 commit comments

Comments
 (0)