Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ $http->start();

## System Requirements

Utopia Framework requires PHP 7.4 or later. We recommend using the latest PHP version whenever possible.
Utopia Framework requires PHP 8.0 or later. We recommend using the latest PHP version whenever possible.

## Authors

Expand Down
16 changes: 9 additions & 7 deletions src/Swoole/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(SwooleRequest $request)
* @param mixed $default
* @return mixed
*/
public function getParam(string $key, $default = null): mixed
public function getParam(string $key, mixed $default = null): mixed
{
switch($this->getMethod()) {
case self::METHOD_GET:
Expand Down Expand Up @@ -70,8 +70,6 @@ public function getParams(): array
default:
return (!empty($this->swoole->get)) ? $this->swoole->get : [];
}

return [];
}

/**
Expand All @@ -83,7 +81,7 @@ public function getParams(): array
* @param mixed $default
* @return mixed
*/
public function getQuery(string $key, $default = null): mixed
public function getQuery(string $key, mixed $default = null): mixed
{
return (isset($this->swoole->get[$key])) ? $this->swoole->get[$key] : $default;
}
Expand All @@ -97,7 +95,7 @@ public function getQuery(string $key, $default = null): mixed
* @param mixed $default
* @return mixed
*/
public function getPayload(string $key, $default = null): mixed
public function getPayload(string $key, mixed $default = null): mixed
{
$payload = $this->generateInput();

Expand All @@ -113,7 +111,7 @@ public function getPayload(string $key, $default = null): mixed
* @param mixed $default
* @return mixed
*/
public function getServer(string $key, $default = null): mixed
public function getServer(string $key, mixed $default = null): mixed
{
return (isset($this->swoole->server) && isset($this->swoole->server[$key])) ? $this->swoole->server[$key] : $default;
}
Expand Down Expand Up @@ -207,6 +205,7 @@ public function getURI(): string
*
* Return HTTP referer header
*
* @param string $default
* @return string
*/
public function getReferer(string $default = ''): string
Expand All @@ -219,6 +218,7 @@ public function getReferer(string $default = ''): string
*
* Return HTTP origin header
*
* @param string $default
* @return string
*/
public function getOrigin(string $default = ''): string
Expand All @@ -231,6 +231,7 @@ public function getOrigin(string $default = ''): string
*
* Return HTTP user agent header
*
* @param string $default
* @return string
*/
public function getUserAgent(string $default = ''): string
Expand All @@ -243,6 +244,7 @@ public function getUserAgent(string $default = ''): string
*
* Return HTTP accept header
*
* @param string $default
* @return string
*/
public function getAccept(string $default = ''): string
Expand All @@ -258,7 +260,7 @@ public function getAccept(string $default = ''): string
* @param string $key
* @return array
*/
public function getFiles($key): array
public function getFiles(string $key): array
{
$key = strtolower($key);
return (isset($this->swoole->files[$key])) ? $this->swoole->files[$key] : [];
Expand Down