Skip to content

Commit

Permalink
Request::__construct() use real default values instead of nulls (BC b…
Browse files Browse the repository at this point in the history
…reak)
  • Loading branch information
dg committed Dec 14, 2023
1 parent 6d17336 commit d2f526e
Showing 1 changed file with 9 additions and 23 deletions.
32 changes: 9 additions & 23 deletions src/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,38 +33,24 @@ class Request implements IRequest
{
use Nette\SmartObject;

private string $method;
private UrlScript $url;
private array $post;
private array $files;
private array $cookies;
private array $headers;
private ?string $remoteAddress;
private ?string $remoteHost;

/** @var ?callable */
private $rawBodyCallback;


public function __construct(
UrlScript $url,
?array $post = null,
?array $files = null,
?array $cookies = null,
?array $headers = null,
?string $method = null,
?string $remoteAddress = null,
?string $remoteHost = null,
private UrlScript $url,
private array $post = [],
private array $files = [],
private array $cookies = [],
array $headers = [],
private string $method = 'GET',
private ?string $remoteAddress = null,
private ?string $remoteHost = null,
?callable $rawBodyCallback = null,
) {
$this->url = $url;
$this->post = (array) $post;
$this->files = (array) $files;
$this->cookies = (array) $cookies;
$this->headers = array_change_key_case((array) $headers, CASE_LOWER);
$this->method = $method ?: 'GET';
$this->remoteAddress = $remoteAddress;
$this->remoteHost = $remoteHost;
$this->headers = array_change_key_case($headers, CASE_LOWER);
$this->rawBodyCallback = $rawBodyCallback;
}

Expand Down

0 comments on commit d2f526e

Please sign in to comment.