Skip to content

Commit

Permalink
Merge pull request #161 from ChiragAgg5k/fix-tests
Browse files Browse the repository at this point in the history
fix: implicit null warnings for test
  • Loading branch information
christyjacob4 authored Jan 4, 2025
2 parents aa2c4ee + f982871 commit 40a6e37
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/Http/Adapter/FPM/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function getRawPayload(): string
* @param string|null $default
* @return string|null
*/
public function getServer(string $key, string $default = null): ?string
public function getServer(string $key, ?string $default = null): ?string
{
return $_SERVER[$key] ?? $default;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Adapter/Swoole/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function getRawPayload(): string
* @param string|null $default
* @return string|null
*/
public function getServer(string $key, string $default = null): ?string
public function getServer(string $key, ?string $default = null): ?string
{
return $this->swoole->server[$key] ?? $default;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Adapter/Swoole/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Server extends Adapter
{
protected SwooleServer $server;

public function __construct(string $host, string $port = null, array $settings = [])
public function __construct(string $host, ?string $port = null, array $settings = [])
{
$this->server = new SwooleServer($host, $port);
$this->server->set(\array_merge($settings, [
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Adapter/SwooleCoroutine/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Server extends Adapter
{
protected SwooleServer $server;

public function __construct(string $host, string $port = null, array $settings = [])
public function __construct(string $host, ?string $port = null, array $settings = [])
{
$this->server = new SwooleServer($host, $port, false, true);
$this->server->set(\array_merge($settings, [
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Files.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function getCount(): int
*
* @throws \Exception
*/
public function load(string $directory, string $root = null): void
public function load(string $directory, ?string $root = null): void
{
if (!is_readable($directory)) {
throw new Exception("Failed to load directory: {$directory}");
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public static function addRoute(string $method, string $url): Route
*
* @throws \Exception
*/
public function loadFiles(string $directory, string $root = null): void
public function loadFiles(string $directory, ?string $root = null): void
{
$this->files->load($directory, $root);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ abstract public function getRawPayload(): string;
* @param string|null $default
* @return string|null
*/
abstract public function getServer(string $key, string $default = null): ?string;
abstract public function getServer(string $key, ?string $default = null): ?string;

/**
* Set server
Expand Down
4 changes: 2 additions & 2 deletions src/Http/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ public function enablePayload(): static
* @param string $key
* @param string $value
*/
public function addHeader(string $key, string $value): static
public function addHeader(string $key, ?string $value): static
{
$this->headers[$key] = $value;

Expand Down Expand Up @@ -413,7 +413,7 @@ public function getHeaders(): array
* @param bool $httponly
* @param string $sameSite
*/
public function addCookie(string $name, string $value = null, int $expire = null, string $path = null, string $domain = null, bool $secure = null, bool $httponly = null, string $sameSite = null): static
public function addCookie(string $name, ?string $value = null, ?int $expire = null, ?string $path = null, ?string $domain = null, ?bool $secure = null, ?bool $httponly = null, ?string $sameSite = null): static
{
$name = strtolower($name);

Expand Down
2 changes: 1 addition & 1 deletion tests/HttpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ public function providerRouteMatching(): array
/**
* @dataProvider providerRouteMatching
*/
public function testCanMatchRoute(string $method, string $path, string $url = null): void
public function testCanMatchRoute(string $method, string $path, ?string $url = null): void
{
$url ??= $path;
$expected = null;
Expand Down

0 comments on commit 40a6e37

Please sign in to comment.