Skip to content

Commit e37b134

Browse files
authored
Merge pull request #7702 from kenjis/refactor-config-Paths
refactor: replace `config(Paths::class)`
2 parents c9c82b2 + a2fed68 commit e37b134

File tree

8 files changed

+22
-7
lines changed

8 files changed

+22
-7
lines changed

app/Config/Autoload.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
* can find the files as needed.
1414
*
1515
* NOTE: If you use an identical key in $psr4 or $classmap, then
16-
* the values in this file will overwrite the framework's values.
16+
* the values in this file will overwrite the framework's values.
17+
*
18+
* NOTE: This class is required prior to Autoloader instantiation,
19+
* and does not extend BaseConfig.
1720
*/
1821
class Autoload extends AutoloadConfig
1922
{

app/Config/Cache.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ class Cache extends BaseConfig
9595
* A string of reserved characters that will not be allowed in keys or tags.
9696
* Strings that violate this restriction will cause handlers to throw.
9797
* Default: {}()/\@:
98-
* Note: The default set is required for PSR-6 compliance.
98+
*
99+
* NOTE: The default set is required for PSR-6 compliance.
99100
*/
100101
public string $reservedCharacters = '{}()/\@:';
101102

app/Config/ContentSecurityPolicy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ContentSecurityPolicy extends BaseConfig
3939

4040
// -------------------------------------------------------------------------
4141
// Sources allowed
42-
// Note: once you set a policy to 'none', it cannot be further restricted
42+
// NOTE: once you set a policy to 'none', it cannot be further restricted
4343
// -------------------------------------------------------------------------
4444

4545
/**

app/Config/Logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class Logger extends BaseConfig
9999
* An extension of 'php' allows for protecting the log files via basic
100100
* scripting, when they are to be stored under a publicly accessible directory.
101101
*
102-
* Note: Leaving it blank will default to 'log'.
102+
* NOTE: Leaving it blank will default to 'log'.
103103
*/
104104
'fileExtension' => '',
105105

app/Config/Migrations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Migrations extends BaseConfig
4040
* using the CLI command:
4141
* > php spark make:migration
4242
*
43-
* Note: if you set an unsupported format, migration runner will not find
43+
* NOTE: if you set an unsupported format, migration runner will not find
4444
* your migration files.
4545
*
4646
* Supported formats:

app/Config/Modules.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
use CodeIgniter\Modules\Modules as BaseModules;
66

7+
/**
8+
* Modules Configuration.
9+
*
10+
* NOTE: This class is required prior to Autoloader instantiation,
11+
* and does not extend BaseConfig.
12+
*/
713
class Modules extends BaseModules
814
{
915
/**

app/Config/Paths.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
* share a system folder between multiple applications, and more.
1313
*
1414
* All paths are relative to the project's root folder.
15+
*
16+
* NOTE: This class is required prior to Autoloader instantiation,
17+
* and does not extend BaseConfig.
18+
*
19+
* @immutable
1520
*/
1621
class Paths
1722
{

system/Config/Services.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ public static function parser(?string $viewPath = null, ?ViewConfig $config = nu
461461
return static::getSharedInstance('parser', $viewPath, $config);
462462
}
463463

464-
$viewPath = $viewPath ?: config(Paths::class)->viewDirectory;
464+
$viewPath = $viewPath ?: (new Paths())->viewDirectory;
465465
$config ??= config(ViewConfig::class);
466466

467467
return new Parser($config, $viewPath, AppServices::locator(), CI_DEBUG, AppServices::logger());
@@ -480,7 +480,7 @@ public static function renderer(?string $viewPath = null, ?ViewConfig $config =
480480
return static::getSharedInstance('renderer', $viewPath, $config);
481481
}
482482

483-
$viewPath = $viewPath ?: config(Paths::class)->viewDirectory;
483+
$viewPath = $viewPath ?: (new Paths())->viewDirectory;
484484
$config ??= config(ViewConfig::class);
485485

486486
return new View($config, $viewPath, AppServices::locator(), CI_DEBUG, AppServices::logger());

0 commit comments

Comments
 (0)