From cb208494947fd1dec75f4d17a937bac565e0d2df Mon Sep 17 00:00:00 2001 From: whwyy Date: Tue, 12 Dec 2023 16:06:49 +0800 Subject: [PATCH] eee --- src/Constrict/ConstrictRequest.php | 12 ++++++++++++ src/Request.php | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/Constrict/ConstrictRequest.php b/src/Constrict/ConstrictRequest.php index 6021511..adcc476 100644 --- a/src/Constrict/ConstrictRequest.php +++ b/src/Constrict/ConstrictRequest.php @@ -3,6 +3,7 @@ declare(strict_types=1); namespace Kiri\Router\Constrict; +use JetBrains\PhpStorm\ArrayShape; use Kiri\Core\Xml; use Kiri\Router\Base\AuthorizationInterface; use Psr\Http\Message\RequestInterface; @@ -61,6 +62,17 @@ class ConstrictRequest extends Message implements RequestInterface, ServerReques } + /** + * @param string $name + * @return array|null + */ + #[ArrayShape(['name' => 'string', 'type' => 'string', 'tmp_name' => 'string', 'error' => 'int', 'size' => 'int'])] + public function file(string $name): ?array + { + return $this->files[$name] ?? null; + } + + /** * @return bool */ diff --git a/src/Request.php b/src/Request.php index dfd94f8..295bb84 100644 --- a/src/Request.php +++ b/src/Request.php @@ -3,6 +3,7 @@ declare(strict_types=1); namespace Kiri\Router; +use JetBrains\PhpStorm\ArrayShape; use Kiri\Router\Base\AuthorizationInterface; use Kiri\Router\Base\ExceptionHandlerDispatcher; use Psr\Http\Message\RequestInterface; @@ -644,6 +645,17 @@ class Request implements ServerRequestInterface } + /** + * @param string $name + * @return array|null + */ + #[ArrayShape(['name' => 'string', 'type' => 'string', 'tmp_name' => 'string', 'error' => 'int', 'size' => 'int'])] + public function file(string $name): ?array + { + return $this->__call__(__FUNCTION__, $name); + } + + /** * @return bool */