From 2ca8d0118c5d6a76137cdcbe7a7443d5229d7146 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Wed, 10 Sep 2025 06:51:07 +0200 Subject: [PATCH 1/2] IRequest, Request: improved return type of getQuery() --- src/Http/IRequest.php | 2 ++ src/Http/Request.php | 1 + 2 files changed, 3 insertions(+) diff --git a/src/Http/IRequest.php b/src/Http/IRequest.php index 434682c1..a3e6197e 100644 --- a/src/Http/IRequest.php +++ b/src/Http/IRequest.php @@ -58,12 +58,14 @@ function getUrl(): UrlScript; /** * Returns variable provided to the script via URL query ($_GET). * If no key is passed, returns the entire array. + * @return ($key is null ? array : mixed) */ function getQuery(?string $key = null): mixed; /** * Returns variable provided to the script via POST method ($_POST). * If no key is passed, returns the entire array. + * @return ($key is null ? array : mixed) */ function getPost(?string $key = null): mixed; diff --git a/src/Http/Request.php b/src/Http/Request.php index af3ad2a7..75d6a7ad 100644 --- a/src/Http/Request.php +++ b/src/Http/Request.php @@ -82,6 +82,7 @@ public function getUrl(): UrlScript /** * Returns variable provided to the script via URL query ($_GET). * If no key is passed, returns the entire array. + * @return ($key is null ? array : mixed) */ public function getQuery(?string $key = null): mixed { From 002027986626dc6065219829d5c3d35e7d3bfdc4 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Wed, 10 Sep 2025 06:54:23 +0200 Subject: [PATCH 2/2] Url, UrlImmutable: fixed type of $query --- src/Http/Url.php | 2 +- src/Http/UrlImmutable.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Http/Url.php b/src/Http/Url.php index b1de6db2..5939c94b 100644 --- a/src/Http/Url.php +++ b/src/Http/Url.php @@ -33,7 +33,7 @@ * @property string $host * @property int $port * @property string $path - * @property string $query + * @property array $query * @property string $fragment * @property-read string $absoluteUrl * @property-read string $authority diff --git a/src/Http/UrlImmutable.php b/src/Http/UrlImmutable.php index 7c12bf94..2c642cd0 100644 --- a/src/Http/UrlImmutable.php +++ b/src/Http/UrlImmutable.php @@ -33,7 +33,7 @@ * @property-read string $host * @property-read int $port * @property-read string $path - * @property-read string $query + * @property-read array $query * @property-read string $fragment * @property-read string $absoluteUrl * @property-read string $authority