Skip to content

Commit

Permalink
Use property promotion
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Dec 15, 2024
1 parent 56c7cb3 commit f3bf041
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
22 changes: 6 additions & 16 deletions src/Driver/Internal/Http2Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,15 @@ final class Http2Stream
public const REMOTE_CLOSED = 0b0010;
public const LOCAL_CLOSED = 0b0100;

/** @var int Current body size limit. */
public int $bodySizeLimit;

/** @var int Bytes received on the stream. */
public int $receivedByteCount = 0;

public int $serverWindow;

public int $clientWindow;

public ?Future $pendingResponse = null;

public ?Future $pendingWrite = null;

public string $buffer = "";

public int $state;

public ?DeferredFuture $deferredFuture = null;

/** @var int Integer between 1 and 256 */
Expand All @@ -47,13 +38,12 @@ final class Http2Stream

public readonly DeferredCancellation $deferredCancellation;

public function __construct(int $bodySizeLimit, int $serverSize, int $clientSize, int $state = self::OPEN)
{
$this->bodySizeLimit = $bodySizeLimit;
$this->serverWindow = $serverSize;
$this->clientWindow = $clientSize;
$this->state = $state;

public function __construct(
public int $bodySizeLimit,
public int $serverWindow,
public int $clientWindow,
public int $state = self::OPEN,
) {
$this->deferredCancellation = new DeferredCancellation();
}
}
5 changes: 1 addition & 4 deletions src/Push.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,15 @@

final class Push extends HttpMessage
{
private readonly PsrUri $uri;

/**
* @param array<non-empty-string, string|array<string>> $headers
*
* @throws InvalidHeaderException If given headers contain and invalid header name or value.
* @throws \Error If the given headers have a colon-prefixed header or a Host header.
*/
public function __construct(PsrUri $uri, array $headers = [])
public function __construct(private readonly PsrUri $uri, array $headers = [])
{
$this->setHeaders($headers);
$this->uri = $uri;
}

protected function setHeader(string $name, array|string $value): void
Expand Down

0 comments on commit f3bf041

Please sign in to comment.