diff --git a/src/Controller/Controller.php b/src/Controller/Controller.php index 9c643883..38d303d8 100644 --- a/src/Controller/Controller.php +++ b/src/Controller/Controller.php @@ -255,7 +255,6 @@ protected function process(): Data * * @return void * @throws ControllerException - * @throws ReflectionException */ protected function findFile(): void { @@ -274,7 +273,6 @@ protected function findFile(): void * * @return string * @throws ControllerException - * @throws ReflectionException */ protected function getFile(): string { diff --git a/src/Response/Response.php b/src/Response/Response.php index 4c9b3f9a..b1605cc5 100644 --- a/src/Response/Response.php +++ b/src/Response/Response.php @@ -11,12 +11,13 @@ namespace Bluz\Response; -use Bluz\Http\Exception\NotAcceptableException; use Bluz\Common\Options; use Bluz\Controller\Controller; use Bluz\Http\StatusCode; use Bluz\Layout\Layout; use Bluz\Proxy\Messages; +use DateTime; +use InvalidArgumentException; use Laminas\Diactoros\Response\EmptyResponse; use Laminas\Diactoros\Response\HtmlResponse; use Laminas\Diactoros\Response\JsonResponse; @@ -144,7 +145,7 @@ public function getType(): string /** * Set Response Type, one of JSON, HTML or CLI * - * @param $type + * @param string $type */ public function setType(string $type): void { @@ -285,7 +286,7 @@ public function hasHeader(string $header): bool * or an array of strings. * * @param string $header header name - * @param string|string[] $value header value(s) + * @param int|int[]|string|string[] $value header value(s) * * @return void */ @@ -301,11 +302,11 @@ public function setHeader(string $header, $value): void * value will be appended to the existing list. * * @param string $header header name to add - * @param string $value value of the header + * @param string|int $value value of the header * * @return void */ - public function addHeader(string $header, string $value): void + public function addHeader(string $header, $value): void { if ($this->hasHeader($header)) { $this->headers[$header][] = $value; @@ -424,14 +425,14 @@ public function clearBody(): void * * @param string $name * @param string $value - * @param int|string|\DateTime $expire + * @param int|string|DateTime $expire * @param string $path * @param string $domain * @param bool $secure * @param bool $httpOnly * * @return void - * @throws \InvalidArgumentException + * @throws InvalidArgumentException */ public function setCookie( string $name, @@ -444,20 +445,20 @@ public function setCookie( ): void { // from PHP source code if (preg_match("/[=,; \t\r\n\013\014]/", $name)) { - throw new \InvalidArgumentException('The cookie name contains invalid characters.'); + throw new InvalidArgumentException('The cookie name contains invalid characters.'); } if (empty($name)) { - throw new \InvalidArgumentException('The cookie name cannot be empty.'); + throw new InvalidArgumentException('The cookie name cannot be empty.'); } // convert expiration time to a Unix timestamp - if ($expire instanceof \DateTime) { + if ($expire instanceof DateTime) { $expire = $expire->format('U'); } elseif (!is_numeric($expire)) { $expire = strtotime($expire); if (false === $expire || -1 === $expire) { - throw new \InvalidArgumentException('The cookie expiration time is not valid.'); + throw new InvalidArgumentException('The cookie expiration time is not valid.'); } } @@ -467,8 +468,8 @@ public function setCookie( 'expire' => $expire, 'path' => $path, 'domain' => $domain, - 'secure' => (bool)$secure, - 'httpOnly' => (bool)$httpOnly + 'secure' => $secure, + 'httpOnly' => $httpOnly ]; }