Skip to content

Commit

Permalink
Replace promise term with future
Browse files Browse the repository at this point in the history
  • Loading branch information
kelunik committed Nov 12, 2022
1 parent 554864d commit fe25dc0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Driver/Http2Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ function (int $bodySize) use ($streamId) {
);
} catch (InvalidHeaderException $exception) {
throw new Http2StreamException(
"Invalid headers field in promises trailers",
"Invalid headers field in trailers",
$streamId,
Http2Parser::PROTOCOL_ERROR,
$exception
Expand Down
2 changes: 1 addition & 1 deletion src/Trailers.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final class Trailers
/**
* @param Future<string[]|string[][]> $future Resolved with the trailer values.
* @param string[] $fields Expected header fields. May be empty, but if provided, the array of
* headers used to resolve the given promise must contain exactly the fields given in this array.
* headers used to complete the given future must contain exactly the fields given in this array.
*
* @throws InvalidHeaderException If the fields list contains a disallowed field.
*/
Expand Down
2 changes: 1 addition & 1 deletion test/Driver/Http1DriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ public function provideWriteResponses(): array
],
];

delay(0.1); // Tick event loop to resolve the Trailers promise.
delay(0.1); // Tick event loop to complete the Trailers future.

return $data;
}
Expand Down
10 changes: 5 additions & 5 deletions test/TrailersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class TrailersTest extends AsyncTestCase
{
public function testMessageHasHeader(): void
{
$promise = Future::complete(['fooHeader' => 'barValue']);
$future = Future::complete(['fooHeader' => 'barValue']);

$trailers = new Trailers($promise, ['fooHeader']);
$trailers = new Trailers($future, ['fooHeader']);
$trailers = $trailers->await();

self::assertTrue($trailers->hasHeader('fooHeader'));
Expand All @@ -22,12 +22,12 @@ public function testMessageHasHeader(): void

public function testHasHeaderReturnsFalseForEmptyArrayValue(): void
{
$promise = Future::complete(['fooHeader' => []]);
$future = Future::complete(['fooHeader' => []]);

$this->expectException(InvalidHeaderException::class);
$this->expectExceptionMessage('Trailers do not contain the expected fields');

$trailers = new Trailers($promise, ['fooHeader']);
$trailers = new Trailers($future, ['fooHeader']);
self::assertFalse(($trailers->await())->hasHeader('fooHeader'));
}

Expand All @@ -39,7 +39,7 @@ public function testDisallowedFieldsInConstructor(): void
$trailers = new Trailers(Future::complete(null), ['content-length']);
}

public function testDisallowedFieldsInPromiseResolution(): void
public function testDisallowedFieldsInFuture(): void
{
$this->expectException(InvalidHeaderException::class);
$this->expectExceptionMessage("Field 'content-length' is not allowed in trailers");
Expand Down

0 comments on commit fe25dc0

Please sign in to comment.