Skip to content

Commit 2acae1a

Browse files
committed
adjust to promise template annotations
1 parent 625ad74 commit 2acae1a

File tree

6 files changed

+13
-23
lines changed

6 files changed

+13
-23
lines changed

.github/workflows/static.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ jobs:
1515
- name: Checkout code
1616
uses: actions/checkout@v3
1717

18+
- name: Remove phpspec
19+
run: composer remove phpspec/phpspec
20+
1821
- name: PHPStan
1922
uses: docker://oskarstark/phpstan-ga
2023
with:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
],
2121
"require": {
2222
"php": "^7.1 || ^8.0",
23-
"php-http/promise": "^1.1",
23+
"php-http/promise": "dev-template-exception as 1.2.2",
2424
"psr/http-client": "^1.0",
2525
"psr/http-message": "^1.0 || ^2.0"
2626
},

src/Exception/RequestAwareTrait.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ private function setRequest(RequestInterface $request)
1616
$this->request = $request;
1717
}
1818

19-
/**
20-
* {@inheritdoc}
21-
*/
2219
public function getRequest(): RequestInterface
2320
{
2421
return $this->request;

src/HttpAsyncClient.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Http\Promise\Promise;
66
use Psr\Http\Message\RequestInterface;
7+
use Psr\Http\Message\ResponseInterface;
78

89
/**
910
* Sends a PSR-7 Request in an asynchronous way by returning a Promise.
@@ -17,7 +18,7 @@ interface HttpAsyncClient
1718
*
1819
* Exceptions related to processing the request are available from the returned Promise.
1920
*
20-
* @return Promise resolves a PSR-7 Response or fails with an Http\Client\Exception
21+
* @return Promise<ResponseInterface, Exception> resolves a PSR-7 Response or fails with an Http\Client\Exception
2122
*
2223
* @throws \Exception If processing the request is impossible (eg. bad configuration).
2324
*/

src/Promise/HttpFulfilledPromise.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
use Http\Promise\Promise;
77
use Psr\Http\Message\ResponseInterface;
88

9+
/**
10+
* @implements Promise<ResponseInterface, Exception>
11+
*/
912
final class HttpFulfilledPromise implements Promise
1013
{
1114
/**
@@ -18,9 +21,6 @@ public function __construct(ResponseInterface $response)
1821
$this->response = $response;
1922
}
2023

21-
/**
22-
* {@inheritdoc}
23-
*/
2424
public function then(callable $onFulfilled = null, callable $onRejected = null)
2525
{
2626
if (null === $onFulfilled) {
@@ -34,17 +34,11 @@ public function then(callable $onFulfilled = null, callable $onRejected = null)
3434
}
3535
}
3636

37-
/**
38-
* {@inheritdoc}
39-
*/
4037
public function getState()
4138
{
4239
return Promise::FULFILLED;
4340
}
4441

45-
/**
46-
* {@inheritdoc}
47-
*/
4842
public function wait($unwrap = true)
4943
{
5044
if ($unwrap) {

src/Promise/HttpRejectedPromise.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44

55
use Http\Client\Exception;
66
use Http\Promise\Promise;
7+
use Psr\Http\Message\ResponseInterface;
78

9+
/**
10+
* @implements Promise<ResponseInterface, Exception>
11+
*/
812
final class HttpRejectedPromise implements Promise
913
{
1014
/**
@@ -17,9 +21,6 @@ public function __construct(Exception $exception)
1721
$this->exception = $exception;
1822
}
1923

20-
/**
21-
* {@inheritdoc}
22-
*/
2324
public function then(callable $onFulfilled = null, callable $onRejected = null)
2425
{
2526
if (null === $onRejected) {
@@ -38,17 +39,11 @@ public function then(callable $onFulfilled = null, callable $onRejected = null)
3839
}
3940
}
4041

41-
/**
42-
* {@inheritdoc}
43-
*/
4442
public function getState()
4543
{
4644
return Promise::REJECTED;
4745
}
4846

49-
/**
50-
* {@inheritdoc}
51-
*/
5247
public function wait($unwrap = true)
5348
{
5449
if ($unwrap) {

0 commit comments

Comments
 (0)