Skip to content

Commit

Permalink
Add Override attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
natanfelles committed Apr 24, 2024
1 parent 1084788 commit 6f2e86d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use JetBrains\PhpStorm\ArrayShape;
use JetBrains\PhpStorm\Pure;
use LogicException;
use Override;
use stdClass;
use UnexpectedValueException;

Expand Down Expand Up @@ -106,6 +107,7 @@ public function __call(string $method, array $arguments)
throw new BadMethodCallException("Method not found: {$method}");
}

#[Override]
public function __toString() : string
{
if ($this->parseContentType() === 'multipart/form-data') {
Expand Down Expand Up @@ -823,6 +825,7 @@ public function getIp() : string
return $_SERVER['REMOTE_ADDR'];
}

#[Override]
#[Pure]
public function getMethod() : string
{
Expand All @@ -836,6 +839,7 @@ public function getMethod() : string
*
* @return bool
*/
#[Override]
public function isMethod(string $method) : bool
{
return parent::isMethod($method);
Expand Down Expand Up @@ -985,6 +989,7 @@ public function getServer(
*
* @return URL
*/
#[Override]
#[Pure]
public function getUrl() : URL
{
Expand Down
16 changes: 16 additions & 0 deletions src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use JetBrains\PhpStorm\Pure;
use JsonException;
use LogicException;
use Override;

/**
* Class Response.
Expand Down Expand Up @@ -60,6 +61,7 @@ public function __construct(Request $request)
$this->setProtocol($this->request->getProtocol());
}

#[Override]
public function __toString() : string
{
if ($this->getHeader(ResponseHeader::DATE) === null) {
Expand Down Expand Up @@ -91,6 +93,7 @@ public function getRequest() : Request
*
* @return string
*/
#[Override]
public function getBody() : string
{
if ($this->sendedBody !== null) {
Expand All @@ -111,6 +114,7 @@ public function getBody() : string
*
* @return static
*/
#[Override]
public function setBody(string $body) : static
{
if (\ob_get_length()) {
Expand Down Expand Up @@ -143,46 +147,55 @@ public function appendBody(string $content) : static
return parent::setBody($this->getBody() . $content);
}

#[Override]
public function setCookie(Cookie $cookie) : static
{
return parent::setCookie($cookie);
}

#[Override]
public function setCookies(array $cookies) : static
{
return parent::setCookies($cookies);
}

#[Override]
public function removeCookie(string $name) : static
{
return parent::removeCookie($name);
}

#[Override]
public function removeCookies(array $names) : static
{
return parent::removeCookies($names);
}

#[Override]
public function setHeader(string $name, string $value) : static
{
return parent::setHeader($name, $value);
}

#[Override]
public function setHeaders(array $headers) : static
{
return parent::setHeaders($headers);
}

#[Override]
public function appendHeader(string $name, string $value) : static
{
return parent::appendHeader($name, $value);
}

#[Override]
public function removeHeader(string $name) : static
{
return parent::removeHeader($name);
}

#[Override]
public function removeHeaders() : static
{
return parent::removeHeaders();
Expand Down Expand Up @@ -317,6 +330,7 @@ public function setStatus(int $code, string $reason = null) : static
*
* @return static
*/
#[Override]
public function setStatusCode(int $code) : static
{
return parent::setStatusCode($code);
Expand All @@ -327,6 +341,7 @@ public function setStatusCode(int $code) : static
*
* @return int
*/
#[Override]
#[Pure]
public function getStatusCode() : int
{
Expand All @@ -340,6 +355,7 @@ public function getStatusCode() : int
*
* @return bool
*/
#[Override]
public function isStatusCode(int $code) : bool
{
return parent::isStatusCode($code);
Expand Down

0 comments on commit 6f2e86d

Please sign in to comment.