This commit is contained in:
Javier Casares 2026-08-24 13:41:08 +00:00
commit 476389b914
93 changed files with 1864 additions and 305 deletions

View file

@ -1,6 +1,13 @@
# CHANGELOG
## 3.0.2 - 2026-08-24
### Added
- Added support for PHP 8.6
## 3.0.1 - 2026-08-05
### Changed

View file

@ -19,8 +19,8 @@ composer require guzzlehttp/promises
| Version | Status | PHP Version |
|---------|--------------|--------------|
| 3.0 | Latest | >=7.4,<8.6 |
| 2.5 | Maintenance | >=7.2.5,<8.6 |
| 3.0 | Latest | >=7.4,<8.7 |
| 2.5 | Maintenance | >=7.2.5,<8.7 |
| 1.5 | End of Life | >=5.5,<8.3 |
## Quick Start
@ -50,6 +50,14 @@ You can wait for a promise to complete synchronously:
$value = $promise->wait();
```
A promise's `getState()` describes how it was settled, not the eventual
outcome: a promise that was resolved with another promise, directly or by
returning one from a `then()` handler, reports `fulfilled` while the inner
promise may still be pending, and `wait()` can still throw if the inner
promise rejects. Poll the state only on promises settled with plain values,
or call `wait()` first (see
[guzzle/promises#101](https://github.com/guzzle/promises/issues/101)).
When using Guzzle HTTP requests, asynchronous methods return
`GuzzleHttp\Promise\PromiseInterface` instances:

View file

@ -62,7 +62,16 @@ interface PromiseInterface
* The three states can be checked against the constants defined on
* PromiseInterface: PENDING, FULFILLED, and REJECTED.
*
* The state describes how this promise was settled, not the eventual
* outcome: a promise that was resolved with another promise, directly or
* by returning one from a then() handler, reports FULFILLED while the
* inner promise may still be pending, and wait() can still throw if the
* inner promise rejects. Poll the state only on promises settled with
* plain values, or call wait() first.
*
* @return self::PENDING|self::FULFILLED|self::REJECTED
*
* @see https://github.com/guzzle/promises/issues/101
*/
public function getState(): string;
@ -71,7 +80,8 @@ interface PromiseInterface
*
* @param TValue|PromiseInterface<TValue, TReason>|null $value
*
* @throws \RuntimeException if the promise is already resolved.
* @throws \LogicException if the promise is already settled with a
* conflicting resolution.
*/
public function resolve($value = null): void;
@ -80,7 +90,8 @@ interface PromiseInterface
*
* @param TReason $reason
*
* @throws \RuntimeException if the promise is already resolved.
* @throws \LogicException if the promise is already settled with a
* conflicting resolution.
*/
public function reject($reason): void;