Skip to content

Commit 3b91de8

Browse files
committed
Deprecate lastCallFailed.
1 parent 1e98775 commit 3b91de8

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

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 '.Client::class.'::getLastResponseStatusCode() instead.', E_USER_DEPRECATED);
38+
3439
$code = $this->client->getLastResponseStatusCode();
3540

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

0 commit comments

Comments
 (0)