Skip to content

Commit

Permalink
More specific header param types
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Feb 11, 2025
1 parent 2c2f7cb commit 049fd21
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Http1TunnelConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Amp\Cancellation;
use Amp\ForbidCloning;
use Amp\ForbidSerialization;
use Amp\Http\HttpMessage;
use Amp\Http\Tunnel\Internal\TunnelSocket;
use Amp\NullCancellation;
use Amp\Socket\ConnectContext;
Expand All @@ -14,11 +15,17 @@
use function Amp\now;
use function Amp\Socket\socketConnector;

/**
* @psalm-import-type HeaderParamArrayType from HttpMessage
*/
final class Http1TunnelConnector implements SocketConnector
{
use ForbidCloning;
use ForbidSerialization;

/**
* @param HeaderParamArrayType $customHeaders
*/
public function __construct(
private readonly string $proxyAddress,
private readonly array $customHeaders = [],
Expand Down
7 changes: 7 additions & 0 deletions src/Https1TunnelConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Amp\Cancellation;
use Amp\ForbidCloning;
use Amp\ForbidSerialization;
use Amp\Http\HttpMessage;
use Amp\Http\Tunnel\Internal\TunnelSocket;
use Amp\NullCancellation;
use Amp\Socket\ClientTlsContext;
Expand All @@ -20,11 +21,17 @@
use function Amp\Socket\listen;
use function Amp\Socket\socketConnector;

/**
* @psalm-import-type HeaderParamArrayType from HttpMessage
*/
final class Https1TunnelConnector implements SocketConnector
{
use ForbidCloning;
use ForbidSerialization;

/**
* @param HeaderParamArrayType $customHeaders
*/
public function __construct(
private readonly string $proxyAddress,
private readonly ClientTlsContext $proxyTlsContext,
Expand Down

0 comments on commit 049fd21

Please sign in to comment.