Skip to content

Commit 7cd8519

Browse files
authored
Merge pull request #7003 from kenjis/fix-config-property-type
fix: Config property type
2 parents 13d8246 + 9058aa5 commit 7cd8519

11 files changed

Lines changed: 13 additions & 17 deletions

File tree

app/Config/App.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,9 @@ class App extends BaseConfig
148148
* - `CodeIgniter\Session\Handlers\MemcachedHandler`
149149
* - `CodeIgniter\Session\Handlers\RedisHandler`
150150
*
151-
* @var string
152-
*
153151
* @deprecated use Config\Session::$driver instead.
154152
*/
155-
public $sessionDriver = FileHandler::class;
153+
public string $sessionDriver = FileHandler::class;
156154

157155
/**
158156
* --------------------------------------------------------------------------
@@ -345,7 +343,7 @@ class App extends BaseConfig
345343
*
346344
* @var array<string, string>
347345
*/
348-
public $proxyIPs = [];
346+
public array $proxyIPs = [];
349347

350348
/**
351349
* --------------------------------------------------------------------------

system/Test/Mock/MockAppConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class MockAppConfig extends App
2323
public bool $cookieSecure = false;
2424
public bool $cookieHTTPOnly = false;
2525
public ?string $cookieSameSite = 'Lax';
26-
public $proxyIPs = [];
26+
public array $proxyIPs = [];
2727
public string $CSRFTokenName = 'csrf_test_name';
2828
public string $CSRFHeaderName = 'X-CSRF-TOKEN';
2929
public string $CSRFCookieName = 'csrf_cookie_name';

system/Test/Mock/MockCLIConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class MockCLIConfig extends App
2323
public bool $cookieSecure = false;
2424
public bool $cookieHTTPOnly = false;
2525
public ?string $cookieSameSite = 'Lax';
26-
public $proxyIPs = [];
26+
public array $proxyIPs = [];
2727
public string $CSRFTokenName = 'csrf_test_name';
2828
public string $CSRFCookieName = 'csrf_cookie_name';
2929
public int $CSRFExpire = 7200;

tests/system/HTTP/IncomingRequestTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use CodeIgniter\HTTP\Files\UploadedFile;
1717
use CodeIgniter\Test\CIUnitTestCase;
1818
use Config\App;
19+
use TypeError;
1920

2021
/**
2122
* @backupGlobals enabled
@@ -1072,10 +1073,7 @@ public function testGetIPAddressThruProxyBothIPv4AndIPv6()
10721073

10731074
public function testGetIPAddressThruProxyInvalidConfigString()
10741075
{
1075-
$this->expectException(ConfigException::class);
1076-
$this->expectExceptionMessage(
1077-
'You must set an array with Proxy IP address key and HTTP header name value in Config\App::$proxyIPs.'
1078-
);
1076+
$this->expectException(TypeError::class);
10791077

10801078
$config = new App();
10811079
$config->proxyIPs = '192.168.5.0/28';

user_guide_src/source/installation/troubleshooting/001.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class App extends BaseConfig
88
{
99
// ...
1010

11-
public $indexPage = 'index.php';
11+
public string $indexPage = 'index.php';
1212

1313
// ...
1414
}

user_guide_src/source/installation/troubleshooting/002.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class App extends BaseConfig
88
{
99
// ...
1010

11-
public $indexPage = 'index.php?';
11+
public string $indexPage = 'index.php?';
1212

1313
// ...
1414
}

user_guide_src/source/installation/upgrade_localization/001.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class App extends BaseConfig
88
{
99
// ...
1010

11-
public $defaultLocale = 'en';
11+
public string $defaultLocale = 'en';
1212

1313
// ...
1414
}

user_guide_src/source/outgoing/localization/001.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class App extends BaseConfig
88
{
9-
public $defaultLocale = 'en';
9+
public string $defaultLocale = 'en';
1010

1111
// ...
1212
}

user_guide_src/source/outgoing/localization/002.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class App extends BaseConfig
88
{
9-
public $negotiateLocale = true;
9+
public bool $negotiateLocale = true;
1010

1111
// ...
1212
}

user_guide_src/source/outgoing/localization/003.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class App extends BaseConfig
88
{
9-
public $supportedLocales = ['en', 'es', 'fr-FR'];
9+
public array $supportedLocales = ['en', 'es', 'fr-FR'];
1010

1111
// ...
1212
}

0 commit comments

Comments
 (0)