Skip to content

Commit

Permalink
Update header docblock types
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Apr 27, 2023
1 parent de95d50 commit 30511ee
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
15 changes: 11 additions & 4 deletions src/BufferedFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@

use Amp\ForbidCloning;
use Amp\ForbidSerialization;
use Amp\Http\Http1\Rfc7230;
use Amp\Http\HttpMessage;

/**
* @psalm-import-type HeaderPairsType from HttpMessage
* @psalm-import-type HeaderMapType from HttpMessage
*/
final class BufferedFile
{
use ForbidCloning;
Expand All @@ -14,8 +19,7 @@ final class BufferedFile
private readonly HttpMessage $message;

/**
* @param list<array{non-empty-string, string}> $headerPairs Headers produced by
* {@see \Amp\Http\Http1\Rfc7230::parseHeaderPairs()}
* @param HeaderPairsType $headerPairs Headers produced by {@see Rfc7230::parseHeaderPairs()}.
*/
public function __construct(
private readonly string $name,
Expand Down Expand Up @@ -47,7 +51,7 @@ public function getMimeType(): string
}

/**
* @return array<non-empty-string, list<string>>
* @return HeaderMapType
*
* @see HttpMessage::getHeaders()
*/
Expand All @@ -57,7 +61,7 @@ public function getHeaders(): array
}

/**
* @return list<array{non-empty-string, string}>
* @return HeaderPairsType
*
* @see HttpMessage::getHeaderPairs()
*/
Expand All @@ -66,6 +70,9 @@ public function getHeaderPairs(): array
return $this->message->getHeaderPairs();
}

/**
* @see HttpMessage::getHeader()
*/
public function getHeader(string $name): ?string
{
return $this->message->getHeader($name);
Expand Down
10 changes: 6 additions & 4 deletions src/StreamedField.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
use Amp\Http\HttpMessage;

/**
* @psalm-import-type HeaderPairsType from HttpMessage
* @psalm-import-type HeaderMapType from HttpMessage
*
* @implements \IteratorAggregate<int, string>
*/
final class StreamedField implements ReadableStream, \IteratorAggregate
Expand All @@ -28,8 +31,7 @@ final class StreamedField implements ReadableStream, \IteratorAggregate
private readonly Payload $payload;

/**
* @param list<array{non-empty-string, string}> $headerPairs Headers produced by
* {@see Rfc7230::parseHeaderPairs()}
* @param HeaderPairsType $headerPairs Headers produced by {@see Rfc7230::parseHeaderPairs()}.
*/
public function __construct(
private readonly string $name,
Expand Down Expand Up @@ -63,7 +65,7 @@ public function isFile(): bool
}

/**
* @return array<non-empty-string, list<string>>
* @return HeaderMapType
*
* @see HttpMessage::getHeaders()
*/
Expand All @@ -73,7 +75,7 @@ public function getHeaders(): array
}

/**
* @return list<array{non-empty-string, string}>
* @return HeaderPairsType
*
* @see HttpMessage::getHeaderPairs()
*/
Expand Down

0 comments on commit 30511ee

Please sign in to comment.