From 19f11de5345e93bdc6c6eb95b62f2ec479f6b29c Mon Sep 17 00:00:00 2001 From: Dawid Parafinski Date: Fri, 8 Nov 2024 09:31:51 +0100 Subject: [PATCH] Improved SimplifiedRequest constructor --- src/lib/MVC/Symfony/Routing/SimplifiedRequest.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/lib/MVC/Symfony/Routing/SimplifiedRequest.php b/src/lib/MVC/Symfony/Routing/SimplifiedRequest.php index 9ab9766b83..ee1dfb539f 100644 --- a/src/lib/MVC/Symfony/Routing/SimplifiedRequest.php +++ b/src/lib/MVC/Symfony/Routing/SimplifiedRequest.php @@ -34,29 +34,34 @@ class SimplifiedRequest extends ValueObject /** * Array of parameters extracted from the query string. + * + * @var array|null */ protected ?array $queryParams = null; /** * List of languages acceptable by the client browser. * The languages are ordered in the user browser preferences. + * + * @var string[]|null */ protected ?array $languages = null; /** * Hash of request headers. + * + * @var array>|null */ protected ?array $headers = null; public function __construct( //string $scheme = 'http', string $host = '', int $port = 80, string $pathinfo = '', array $queryParams = [], array $languages = [], array $headers = [] - $properties = [], ) { $args = func_get_args(); if ( - (func_num_args() === 1 && is_array($args[0])) || - empty($args) + empty($args) || + (func_num_args() === 1 && is_array($args[0])) ) { if (!empty($args)) { trigger_deprecation( @@ -66,7 +71,7 @@ public function __construct( __METHOD__ ); } - parent::__construct($properties); + parent::__construct($args[0] ?? []); } else { $this->scheme = $args[0] ?? null; $this->host = $args[1] ?? null;