Skip to content

Commit

Permalink
Release v4.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jul 30, 2023
1 parent e392123 commit 7c663e1
Show file tree
Hide file tree
Showing 98 changed files with 513 additions and 357 deletions.
2 changes: 1 addition & 1 deletion app/Config/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class App extends BaseConfig

/**
* --------------------------------------------------------------------------
* URI PROTOCOL
* Force Global Secure Requests
* --------------------------------------------------------------------------
*
* If true, this will force every request made to this application to be
Expand Down
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
17 changes: 10 additions & 7 deletions app/Config/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Config;

use CodeIgniter\Cache\CacheInterface;
use CodeIgniter\Cache\Handlers\DummyHandler;
use CodeIgniter\Cache\Handlers\FileHandler;
use CodeIgniter\Cache\Handlers\MemcachedHandler;
Expand Down Expand Up @@ -53,12 +54,12 @@ class Cache extends BaseConfig
* Whether to take the URL query string into consideration when generating
* output cache files. Valid options are:
*
* false = Disabled
* true = Enabled, take all query parameters into account.
* Please be aware that this may result in numerous cache
* files generated for the same page over and over again.
* array('q') = Enabled, but only take into account the specified list
* of query parameters.
* false = Disabled
* true = Enabled, take all query parameters into account.
* Please be aware that this may result in numerous cache
* files generated for the same page over and over again.
* ['q'] = Enabled, but only take into account the specified list
* of query parameters.
*
* @var bool|string[]
*/
Expand Down Expand Up @@ -95,7 +96,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 Expand Up @@ -157,6 +159,7 @@ class Cache extends BaseConfig
* that are listed here are allowed to be used.
*
* @var array<string, string>
* @phpstan-var array<string, class-string<CacheInterface>>
*/
public array $validHandlers = [
'dummy' => DummyHandler::class,
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/Filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Filters extends BaseConfig
*
* If you use this, you should disable auto-routing because auto-routing
* permits any HTTP method to access a controller. Accessing the controller
* with a method you dont expect could bypass the filter.
* with a method you don't expect could bypass the filter.
*/
public array $methods = [];

Expand Down
18 changes: 18 additions & 0 deletions app/Config/Kint.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
namespace Config;

use CodeIgniter\Config\BaseConfig;
use Kint\Parser\ConstructablePluginInterface;
use Kint\Renderer\AbstractRenderer;
use Kint\Renderer\Rich\TabPluginInterface;
use Kint\Renderer\Rich\ValuePluginInterface;

/**
* --------------------------------------------------------------------------
Expand All @@ -23,7 +26,12 @@ class Kint extends BaseConfig
|--------------------------------------------------------------------------
*/

/**
* @var array<int, ConstructablePluginInterface|string>
* @phpstan-var list<class-string<ConstructablePluginInterface>|ConstructablePluginInterface>
*/
public $plugins;

public int $maxDepth = 6;
public bool $displayCalledFrom = true;
public bool $expanded = false;
Expand All @@ -36,7 +44,17 @@ class Kint extends BaseConfig
public string $richTheme = 'aante-light.css';
public bool $richFolder = false;
public int $richSort = AbstractRenderer::SORT_FULL;

/**
* @var array<string, string>
* @phpstan-var array<string, class-string<ValuePluginInterface>>
*/
public $richObjectPlugins;

/**
* @var array<string, string>
* @phpstan-var array<string, class-string<TabPluginInterface>>
*/
public $richTabPlugins;

/*
Expand Down
4 changes: 1 addition & 3 deletions app/Config/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,12 @@ class Logger extends BaseConfig
* the handler on top and continuing down.
*/
public array $handlers = [

/*
* --------------------------------------------------------------------
* File Handler
* --------------------------------------------------------------------
*/
FileHandler::class => [

// The log levels that this handler will handle.
'handles' => [
'critical',
Expand All @@ -99,7 +97,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
2 changes: 1 addition & 1 deletion app/Controllers/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ abstract class BaseController extends Controller
// protected $session;

/**
* Constructor.
* @return void
*/
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
Expand Down
2 changes: 1 addition & 1 deletion app/Controllers/Home.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class Home extends BaseController
{
public function index()
public function index(): string
{
return view('welcome_message');
}
Expand Down
4 changes: 4 additions & 0 deletions system/Autoloader/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ private function loadComposerInfo(Modules $modules): void

/**
* Register the loader with the SPL autoloader stack.
*
* @return void
*/
public function register()
{
Expand Down Expand Up @@ -445,6 +447,8 @@ private function loadComposerClassmap(ClassLoader $composer): void
* Locates autoload information from Composer, if available.
*
* @deprecated No longer used.
*
* @return void
*/
protected function discoverComposerNamespaces()
{
Expand Down
21 changes: 17 additions & 4 deletions system/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,7 @@ public function skipValidation(bool $skip = true)
}

/**
* Allows to set validation messages.
* Allows to set (and reset) validation messages.
* It could be used when you have to change default or override current validate messages.
*
* @param array $validationMessages Value
Expand Down Expand Up @@ -1376,7 +1376,7 @@ public function setValidationMessage(string $field, array $fieldMessages)
}

/**
* Allows to set validation rules.
* Allows to set (and reset) validation rules.
* It could be used when you have to change default or override current validate rules.
*
* @param array $validationRules Value
Expand All @@ -1401,6 +1401,17 @@ public function setValidationRules(array $validationRules)
*/
public function setValidationRule(string $field, $fieldRules)
{
$rules = $this->validationRules;

// ValidationRules can be either a string, which is the group name,
// or an array of rules.
if (is_string($rules)) {
[$rules, $customErrors] = $this->validation->loadRuleGroup($rules);

$this->validationRules = $rules;
$this->validationMessages = $this->validationMessages + $customErrors;
}

$this->validationRules[$field] = $fieldRules;

return $this;
Expand Down Expand Up @@ -1466,7 +1477,9 @@ public function getValidationRules(array $options = []): array
// ValidationRules can be either a string, which is the group name,
// or an array of rules.
if (is_string($rules)) {
$rules = $this->validation->loadRuleGroup($rules);
[$rules, $customErrors] = $this->validation->loadRuleGroup($rules);

$this->validationMessages = $this->validationMessages + $customErrors;
}

if (isset($options['except'])) {
Expand Down Expand Up @@ -1711,7 +1724,7 @@ protected function transformDataToArray($data, string $type): array
*
* @param string $name Name
*
* @return mixed
* @return array|bool|float|int|object|string|null
*/
public function __get(string $name)
{
Expand Down
3 changes: 2 additions & 1 deletion system/CLI/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace CodeIgniter\CLI;

use Config\Exceptions;
use Psr\Log\LoggerInterface;
use ReflectionException;
use Throwable;
Expand Down Expand Up @@ -121,7 +122,7 @@ protected function showError(Throwable $e)
{
$exception = $e;
$message = $e->getMessage();
$config = config('Exceptions');
$config = config(Exceptions::class);

require $config->errorViewPath . '/cli/error_exception.php';
}
Expand Down
2 changes: 1 addition & 1 deletion system/CLI/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ public static function wait(int $seconds, bool $countdown = false)
/**
* if operating system === windows
*
* @deprecated v4.3 Use `is_windows()` instead
* @deprecated 4.3.0 Use `is_windows()` instead
*/
public static function isWindows(): bool
{
Expand Down
3 changes: 2 additions & 1 deletion system/CLI/GeneratorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace CodeIgniter\CLI;

use Config\Generators;
use Config\Services;
use Throwable;

Expand Down Expand Up @@ -267,7 +268,7 @@ protected function qualifyClassName(): string
protected function renderTemplate(array $data = []): string
{
try {
return view(config('Generators')->views[$this->name], $data, ['debug' => false]);
return view(config(Generators::class)->views[$this->name], $data, ['debug' => false]);
} catch (Throwable $e) {
log_message('error', (string) $e);

Expand Down
3 changes: 2 additions & 1 deletion system/Cache/Handlers/BaseHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Closure;
use CodeIgniter\Cache\CacheInterface;
use Config\Cache;
use Exception;
use InvalidArgumentException;

Expand Down Expand Up @@ -61,7 +62,7 @@ public static function validateKey($key, $prefix = ''): string
throw new InvalidArgumentException('Cache key cannot be empty.');
}

$reserved = config('Cache')->reservedCharacters ?? self::RESERVED_CHARACTERS;
$reserved = config(Cache::class)->reservedCharacters ?? self::RESERVED_CHARACTERS;
if ($reserved && strpbrk($key, $reserved) !== false) {
throw new InvalidArgumentException('Cache key contains reserved characters ' . $reserved);
}
Expand Down
Loading

0 comments on commit 7c663e1

Please sign in to comment.