Skip to content

Commit df5bf35

Browse files
committed
fix: change default values to null
For consistency with previous implementations.
1 parent 72f76a6 commit df5bf35

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

system/HTTP/SiteURI.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,18 @@ class SiteURI extends URI
7171
private string $routePath;
7272

7373
/**
74-
* @param string $relativePath URI path relative to baseURL. May include
75-
* queries or fragments.
76-
* @param string $host Optional hostname. If it is not in $allowedHostnames,
77-
* just be ignored.
78-
* @param string $scheme Optional scheme. 'http' or 'https'.
79-
* @phpstan-param 'http'|'https'|'' $scheme
74+
* @param string $relativePath URI path relative to baseURL. May include
75+
* queries or fragments.
76+
* @param string|null $host Optional hostname. If it is not in
77+
* $allowedHostnames, just be ignored.
78+
* @param string|null $scheme Optional scheme. 'http' or 'https'.
79+
* @phpstan-param 'http'|'https'|null $scheme
8080
*/
8181
public function __construct(
8282
App $configApp,
8383
string $relativePath = '',
84-
string $host = '',
85-
string $scheme = ''
84+
?string $host = null,
85+
?string $scheme = null
8686
) {
8787
$this->baseURL = $this->normalizeBaseURL($configApp);
8888
$this->indexPage = $configApp->indexPage;
@@ -106,14 +106,14 @@ public function __construct(
106106
$uri = new URI($tempUri);
107107

108108
// Update scheme
109-
if ($scheme !== '') {
109+
if ($scheme !== null) {
110110
$uri->setScheme($scheme);
111111
} elseif ($configApp->forceGlobalSecureRequests) {
112112
$uri->setScheme('https');
113113
}
114114

115115
// Update host
116-
if ($host !== '' && $this->checkHost($host, $configApp->allowedHostnames)) {
116+
if ($host !== null && $this->checkHost($host, $configApp->allowedHostnames)) {
117117
$uri->setHost($host);
118118
}
119119

tests/system/HTTP/SiteURITest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function testConstructorScheme()
7474
{
7575
$config = new App();
7676

77-
$uri = new SiteURI($config, '', '', 'https');
77+
$uri = new SiteURI($config, '', null, 'https');
7878

7979
$this->assertInstanceOf(SiteURI::class, $uri);
8080
$this->assertSame('https://example.com/index.php/', (string) $uri);

0 commit comments

Comments
 (0)