Skip to content

Commit

Permalink
Merge pull request codeigniter4#7702 from kenjis/refactor-config-Paths
Browse files Browse the repository at this point in the history
refactor:  replace `config(Paths::class)`
  • Loading branch information
kenjis authored Jul 16, 2023
2 parents c9c82b2 + a2fed68 commit e37b134
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 7 deletions.
5 changes: 4 additions & 1 deletion app/Config/Autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
* can find the files as needed.
*
* NOTE: If you use an identical key in $psr4 or $classmap, then
* the values in this file will overwrite the framework's values.
* the values in this file will overwrite the framework's values.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*/
class Autoload extends AutoloadConfig
{
Expand Down
3 changes: 2 additions & 1 deletion app/Config/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ class Cache extends BaseConfig
* A string of reserved characters that will not be allowed in keys or tags.
* Strings that violate this restriction will cause handlers to throw.
* Default: {}()/\@:
* Note: The default set is required for PSR-6 compliance.
*
* NOTE: The default set is required for PSR-6 compliance.
*/
public string $reservedCharacters = '{}()/\@:';

Expand Down
2 changes: 1 addition & 1 deletion app/Config/ContentSecurityPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ContentSecurityPolicy extends BaseConfig

// -------------------------------------------------------------------------
// Sources allowed
// Note: once you set a policy to 'none', it cannot be further restricted
// NOTE: once you set a policy to 'none', it cannot be further restricted
// -------------------------------------------------------------------------

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Config/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Logger extends BaseConfig
* An extension of 'php' allows for protecting the log files via basic
* scripting, when they are to be stored under a publicly accessible directory.
*
* Note: Leaving it blank will default to 'log'.
* NOTE: Leaving it blank will default to 'log'.
*/
'fileExtension' => '',

Expand Down
2 changes: 1 addition & 1 deletion app/Config/Migrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Migrations extends BaseConfig
* using the CLI command:
* > php spark make:migration
*
* Note: if you set an unsupported format, migration runner will not find
* NOTE: if you set an unsupported format, migration runner will not find
* your migration files.
*
* Supported formats:
Expand Down
6 changes: 6 additions & 0 deletions app/Config/Modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

use CodeIgniter\Modules\Modules as BaseModules;

/**
* Modules Configuration.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*/
class Modules extends BaseModules
{
/**
Expand Down
5 changes: 5 additions & 0 deletions app/Config/Paths.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
* share a system folder between multiple applications, and more.
*
* All paths are relative to the project's root folder.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*
* @immutable
*/
class Paths
{
Expand Down
4 changes: 2 additions & 2 deletions system/Config/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ public static function parser(?string $viewPath = null, ?ViewConfig $config = nu
return static::getSharedInstance('parser', $viewPath, $config);
}

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

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

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

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

0 comments on commit e37b134

Please sign in to comment.