From 115d228158e60e16baff7ff95fd66bc452dbe2b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Tue, 24 Oct 2023 17:22:29 +0800 Subject: [PATCH] eee --- src/Constrict/Stream.php | 13 +++++++------ src/ControllerInterpreter.php | 2 -- src/Format/OtherFormat.php | 1 - src/Format/ResponseFormat.php | 3 ++- src/Interface/ValidatorInterface.php | 5 +++++ src/Request.php | 1 - src/Response.php | 2 -- src/Router.php | 1 - src/StreamResponse.php | 1 - 9 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/Constrict/Stream.php b/src/Constrict/Stream.php index 3cab2c4..4ead26f 100644 --- a/src/Constrict/Stream.php +++ b/src/Constrict/Stream.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Kiri\Router\Constrict; use Psr\Http\Message\StreamInterface; +use RuntimeException; class Stream implements StreamInterface { @@ -93,7 +94,7 @@ class Stream implements StreamInterface * Returns the current position of the file read/write pointer * * @return int Position of the file pointer - * @throws \RuntimeException on error. + * @throws RuntimeException on error. */ public function tell(): int { @@ -133,7 +134,7 @@ class Stream implements StreamInterface * PHP $whence values for `fseek()`. SEEK_SET: Set position equal to * offset bytes SEEK_CUR: Set position to current location plus offset * SEEK_END: Set position to end-of-stream plus offset. - * @throws \RuntimeException on failure. + * @throws RuntimeException on failure. */ public function seek(int $offset, int $whence = SEEK_SET): void { @@ -149,7 +150,7 @@ class Stream implements StreamInterface * If the stream is not seekable, this method will raise an exception; * otherwise, it will perform a seek(0). * - * @throws \RuntimeException on failure. + * @throws RuntimeException on failure. * @link http://www.php.net/manual/en/function.fseek.php * @see seek() */ @@ -178,7 +179,7 @@ class Stream implements StreamInterface * * @param string $string The string that is to be written. * @return int Returns the number of bytes written to the stream. - * @throws \RuntimeException on failure. + * @throws RuntimeException on failure. */ public function write(string $string): int { @@ -215,7 +216,7 @@ class Stream implements StreamInterface * call returns fewer bytes. * @return string Returns the data read from the stream, or an empty string * if no bytes are available. - * @throws \RuntimeException if an error occurs. + * @throws RuntimeException if an error occurs. */ public function read(int $length): string { @@ -231,7 +232,7 @@ class Stream implements StreamInterface * Returns the remaining contents in a string * * @return string - * @throws \RuntimeException if unable to read or an error occurs while + * @throws RuntimeException if unable to read or an error occurs while * reading. */ public function getContents(): string diff --git a/src/ControllerInterpreter.php b/src/ControllerInterpreter.php index 0e80e04..a4db35f 100644 --- a/src/ControllerInterpreter.php +++ b/src/ControllerInterpreter.php @@ -5,8 +5,6 @@ namespace Kiri\Router; use Closure; use Exception; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; use ReflectionClass; use ReflectionException; use ReflectionMethod; diff --git a/src/Format/OtherFormat.php b/src/Format/OtherFormat.php index 92d55dc..9059324 100644 --- a/src/Format/OtherFormat.php +++ b/src/Format/OtherFormat.php @@ -3,7 +3,6 @@ namespace Kiri\Router\Format; use Kiri\Router\Constrict\Stream; -use Kiri\Router\ContentType; use Psr\Http\Message\ResponseInterface; class OtherFormat implements IFormat diff --git a/src/Format/ResponseFormat.php b/src/Format/ResponseFormat.php index 29110d1..7cf2a65 100644 --- a/src/Format/ResponseFormat.php +++ b/src/Format/ResponseFormat.php @@ -8,7 +8,8 @@ class ResponseFormat implements IFormat { /** - * @inheritDoc + * @param $result + * @return ResponseInterface */ public function call($result): ResponseInterface { diff --git a/src/Interface/ValidatorInterface.php b/src/Interface/ValidatorInterface.php index 214ae23..d73414f 100644 --- a/src/Interface/ValidatorInterface.php +++ b/src/Interface/ValidatorInterface.php @@ -7,6 +7,11 @@ interface ValidatorInterface { + /** + * @param object $class + * @param string $name + * @return bool + */ public function dispatch(object $class, string $name): bool; } diff --git a/src/Request.php b/src/Request.php index 85f6f5f..187189b 100644 --- a/src/Request.php +++ b/src/Request.php @@ -3,7 +3,6 @@ declare(strict_types=1); namespace Kiri\Router; -use Kiri\Di\Context; use Kiri\Router\Base\AuthorizationInterface; use Kiri\Router\Base\ExceptionHandlerDispatcher; use Psr\Http\Message\RequestInterface; diff --git a/src/Response.php b/src/Response.php index 42b3e3d..33febee 100644 --- a/src/Response.php +++ b/src/Response.php @@ -4,9 +4,7 @@ declare(strict_types=1); namespace Kiri\Router; use InvalidArgumentException; -use Kiri\Di\Context; use Kiri\Di\Interface\ResponseEmitterInterface; -use Kiri\Router\Constrict\ConstrictResponse; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; use ReflectionException; diff --git a/src/Router.php b/src/Router.php index ecf083a..bfb9ef0 100644 --- a/src/Router.php +++ b/src/Router.php @@ -8,7 +8,6 @@ use Exception; use Kiri; use Kiri\Router\Base\Middleware as MiddlewareManager; use Kiri\Router\Constrict\RequestMethod; -use Kiri\Server\Events\OnWorkerStart; use ReflectionException; /** diff --git a/src/StreamResponse.php b/src/StreamResponse.php index 2982de5..24f9dba 100644 --- a/src/StreamResponse.php +++ b/src/StreamResponse.php @@ -36,7 +36,6 @@ class StreamResponse extends Response $response->write($body->read($this->limit)); } $response->end(); -// event(new OnAfterRequest()); } }