Skip to content

Commit 40a6e37

Browse files
Merge pull request #161 from ChiragAgg5k/fix-tests
fix: implicit null warnings for test
2 parents aa2c4ee + f982871 commit 40a6e37

File tree

9 files changed

+10
-10
lines changed

9 files changed

+10
-10
lines changed

src/Http/Adapter/FPM/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function getRawPayload(): string
3636
* @param string|null $default
3737
* @return string|null
3838
*/
39-
public function getServer(string $key, string $default = null): ?string
39+
public function getServer(string $key, ?string $default = null): ?string
4040
{
4141
return $_SERVER[$key] ?? $default;
4242
}

src/Http/Adapter/Swoole/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function getRawPayload(): string
4343
* @param string|null $default
4444
* @return string|null
4545
*/
46-
public function getServer(string $key, string $default = null): ?string
46+
public function getServer(string $key, ?string $default = null): ?string
4747
{
4848
return $this->swoole->server[$key] ?? $default;
4949
}

src/Http/Adapter/Swoole/Server.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Server extends Adapter
1010
{
1111
protected SwooleServer $server;
1212

13-
public function __construct(string $host, string $port = null, array $settings = [])
13+
public function __construct(string $host, ?string $port = null, array $settings = [])
1414
{
1515
$this->server = new SwooleServer($host, $port);
1616
$this->server->set(\array_merge($settings, [

src/Http/Adapter/SwooleCoroutine/Server.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Server extends Adapter
99
{
1010
protected SwooleServer $server;
1111

12-
public function __construct(string $host, string $port = null, array $settings = [])
12+
public function __construct(string $host, ?string $port = null, array $settings = [])
1313
{
1414
$this->server = new SwooleServer($host, $port, false, true);
1515
$this->server->set(\array_merge($settings, [

src/Http/Files.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function getCount(): int
8383
*
8484
* @throws \Exception
8585
*/
86-
public function load(string $directory, string $root = null): void
86+
public function load(string $directory, ?string $root = null): void
8787
{
8888
if (!is_readable($directory)) {
8989
throw new Exception("Failed to load directory: {$directory}");

src/Http/Http.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ public static function addRoute(string $method, string $url): Route
264264
*
265265
* @throws \Exception
266266
*/
267-
public function loadFiles(string $directory, string $root = null): void
267+
public function loadFiles(string $directory, ?string $root = null): void
268268
{
269269
$this->files->load($directory, $root);
270270
}

src/Http/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ abstract public function getRawPayload(): string;
137137
* @param string|null $default
138138
* @return string|null
139139
*/
140-
abstract public function getServer(string $key, string $default = null): ?string;
140+
abstract public function getServer(string $key, ?string $default = null): ?string;
141141

142142
/**
143143
* Set server

src/Http/Response.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ public function enablePayload(): static
364364
* @param string $key
365365
* @param string $value
366366
*/
367-
public function addHeader(string $key, string $value): static
367+
public function addHeader(string $key, ?string $value): static
368368
{
369369
$this->headers[$key] = $value;
370370

@@ -413,7 +413,7 @@ public function getHeaders(): array
413413
* @param bool $httponly
414414
* @param string $sameSite
415415
*/
416-
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
416+
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
417417
{
418418
$name = strtolower($name);
419419

tests/HttpTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ public function providerRouteMatching(): array
578578
/**
579579
* @dataProvider providerRouteMatching
580580
*/
581-
public function testCanMatchRoute(string $method, string $path, string $url = null): void
581+
public function testCanMatchRoute(string $method, string $path, ?string $url = null): void
582582
{
583583
$url ??= $path;
584584
$expected = null;

0 commit comments

Comments
 (0)