Skip to content

Commit 7c663e1

Browse files
committed
Release v4.3.7
1 parent e392123 commit 7c663e1

File tree

98 files changed

+513
-357
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+513
-357
lines changed

app/Config/App.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class App extends BaseConfig
126126

127127
/**
128128
* --------------------------------------------------------------------------
129-
* URI PROTOCOL
129+
* Force Global Secure Requests
130130
* --------------------------------------------------------------------------
131131
*
132132
* If true, this will force every request made to this application to be

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: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Config;
44

5+
use CodeIgniter\Cache\CacheInterface;
56
use CodeIgniter\Cache\Handlers\DummyHandler;
67
use CodeIgniter\Cache\Handlers\FileHandler;
78
use CodeIgniter\Cache\Handlers\MemcachedHandler;
@@ -53,12 +54,12 @@ class Cache extends BaseConfig
5354
* Whether to take the URL query string into consideration when generating
5455
* output cache files. Valid options are:
5556
*
56-
* false = Disabled
57-
* true = Enabled, take all query parameters into account.
58-
* Please be aware that this may result in numerous cache
59-
* files generated for the same page over and over again.
60-
* array('q') = Enabled, but only take into account the specified list
61-
* of query parameters.
57+
* false = Disabled
58+
* true = Enabled, take all query parameters into account.
59+
* Please be aware that this may result in numerous cache
60+
* files generated for the same page over and over again.
61+
* ['q'] = Enabled, but only take into account the specified list
62+
* of query parameters.
6263
*
6364
* @var bool|string[]
6465
*/
@@ -95,7 +96,8 @@ class Cache extends BaseConfig
9596
* A string of reserved characters that will not be allowed in keys or tags.
9697
* Strings that violate this restriction will cause handlers to throw.
9798
* Default: {}()/\@:
98-
* Note: The default set is required for PSR-6 compliance.
99+
*
100+
* NOTE: The default set is required for PSR-6 compliance.
99101
*/
100102
public string $reservedCharacters = '{}()/\@:';
101103

@@ -157,6 +159,7 @@ class Cache extends BaseConfig
157159
* that are listed here are allowed to be used.
158160
*
159161
* @var array<string, string>
162+
* @phpstan-var array<string, class-string<CacheInterface>>
160163
*/
161164
public array $validHandlers = [
162165
'dummy' => DummyHandler::class,

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/Filters.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Filters extends BaseConfig
4949
*
5050
* If you use this, you should disable auto-routing because auto-routing
5151
* permits any HTTP method to access a controller. Accessing the controller
52-
* with a method you dont expect could bypass the filter.
52+
* with a method you don't expect could bypass the filter.
5353
*/
5454
public array $methods = [];
5555

app/Config/Kint.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
namespace Config;
44

55
use CodeIgniter\Config\BaseConfig;
6+
use Kint\Parser\ConstructablePluginInterface;
67
use Kint\Renderer\AbstractRenderer;
8+
use Kint\Renderer\Rich\TabPluginInterface;
9+
use Kint\Renderer\Rich\ValuePluginInterface;
710

811
/**
912
* --------------------------------------------------------------------------
@@ -23,7 +26,12 @@ class Kint extends BaseConfig
2326
|--------------------------------------------------------------------------
2427
*/
2528

29+
/**
30+
* @var array<int, ConstructablePluginInterface|string>
31+
* @phpstan-var list<class-string<ConstructablePluginInterface>|ConstructablePluginInterface>
32+
*/
2633
public $plugins;
34+
2735
public int $maxDepth = 6;
2836
public bool $displayCalledFrom = true;
2937
public bool $expanded = false;
@@ -36,7 +44,17 @@ class Kint extends BaseConfig
3644
public string $richTheme = 'aante-light.css';
3745
public bool $richFolder = false;
3846
public int $richSort = AbstractRenderer::SORT_FULL;
47+
48+
/**
49+
* @var array<string, string>
50+
* @phpstan-var array<string, class-string<ValuePluginInterface>>
51+
*/
3952
public $richObjectPlugins;
53+
54+
/**
55+
* @var array<string, string>
56+
* @phpstan-var array<string, class-string<TabPluginInterface>>
57+
*/
4058
public $richTabPlugins;
4159

4260
/*

app/Config/Logger.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,12 @@ class Logger extends BaseConfig
7474
* the handler on top and continuing down.
7575
*/
7676
public array $handlers = [
77-
7877
/*
7978
* --------------------------------------------------------------------
8079
* File Handler
8180
* --------------------------------------------------------------------
8281
*/
8382
FileHandler::class => [
84-
8583
// The log levels that this handler will handle.
8684
'handles' => [
8785
'critical',
@@ -99,7 +97,7 @@ class Logger extends BaseConfig
9997
* An extension of 'php' allows for protecting the log files via basic
10098
* scripting, when they are to be stored under a publicly accessible directory.
10199
*
102-
* Note: Leaving it blank will default to 'log'.
100+
* NOTE: Leaving it blank will default to 'log'.
103101
*/
104102
'fileExtension' => '',
105103

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
{

app/Controllers/BaseController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ abstract class BaseController extends Controller
4444
// protected $session;
4545

4646
/**
47-
* Constructor.
47+
* @return void
4848
*/
4949
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
5050
{

app/Controllers/Home.php

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

55
class Home extends BaseController
66
{
7-
public function index()
7+
public function index(): string
88
{
99
return view('welcome_message');
1010
}

system/Autoloader/Autoloader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ private function loadComposerInfo(Modules $modules): void
148148

149149
/**
150150
* Register the loader with the SPL autoloader stack.
151+
*
152+
* @return void
151153
*/
152154
public function register()
153155
{
@@ -445,6 +447,8 @@ private function loadComposerClassmap(ClassLoader $composer): void
445447
* Locates autoload information from Composer, if available.
446448
*
447449
* @deprecated No longer used.
450+
*
451+
* @return void
448452
*/
449453
protected function discoverComposerNamespaces()
450454
{

system/BaseModel.php

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,7 @@ public function skipValidation(bool $skip = true)
13451345
}
13461346

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

13781378
/**
1379-
* Allows to set validation rules.
1379+
* Allows to set (and reset) validation rules.
13801380
* It could be used when you have to change default or override current validate rules.
13811381
*
13821382
* @param array $validationRules Value
@@ -1401,6 +1401,17 @@ public function setValidationRules(array $validationRules)
14011401
*/
14021402
public function setValidationRule(string $field, $fieldRules)
14031403
{
1404+
$rules = $this->validationRules;
1405+
1406+
// ValidationRules can be either a string, which is the group name,
1407+
// or an array of rules.
1408+
if (is_string($rules)) {
1409+
[$rules, $customErrors] = $this->validation->loadRuleGroup($rules);
1410+
1411+
$this->validationRules = $rules;
1412+
$this->validationMessages = $this->validationMessages + $customErrors;
1413+
}
1414+
14041415
$this->validationRules[$field] = $fieldRules;
14051416

14061417
return $this;
@@ -1466,7 +1477,9 @@ public function getValidationRules(array $options = []): array
14661477
// ValidationRules can be either a string, which is the group name,
14671478
// or an array of rules.
14681479
if (is_string($rules)) {
1469-
$rules = $this->validation->loadRuleGroup($rules);
1480+
[$rules, $customErrors] = $this->validation->loadRuleGroup($rules);
1481+
1482+
$this->validationMessages = $this->validationMessages + $customErrors;
14701483
}
14711484

14721485
if (isset($options['except'])) {
@@ -1711,7 +1724,7 @@ protected function transformDataToArray($data, string $type): array
17111724
*
17121725
* @param string $name Name
17131726
*
1714-
* @return mixed
1727+
* @return array|bool|float|int|object|string|null
17151728
*/
17161729
public function __get(string $name)
17171730
{

system/CLI/BaseCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace CodeIgniter\CLI;
1313

14+
use Config\Exceptions;
1415
use Psr\Log\LoggerInterface;
1516
use ReflectionException;
1617
use Throwable;
@@ -121,7 +122,7 @@ protected function showError(Throwable $e)
121122
{
122123
$exception = $e;
123124
$message = $e->getMessage();
124-
$config = config('Exceptions');
125+
$config = config(Exceptions::class);
125126

126127
require $config->errorViewPath . '/cli/error_exception.php';
127128
}

system/CLI/CLI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ public static function wait(int $seconds, bool $countdown = false)
520520
/**
521521
* if operating system === windows
522522
*
523-
* @deprecated v4.3 Use `is_windows()` instead
523+
* @deprecated 4.3.0 Use `is_windows()` instead
524524
*/
525525
public static function isWindows(): bool
526526
{

system/CLI/GeneratorTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace CodeIgniter\CLI;
1313

14+
use Config\Generators;
1415
use Config\Services;
1516
use Throwable;
1617

@@ -267,7 +268,7 @@ protected function qualifyClassName(): string
267268
protected function renderTemplate(array $data = []): string
268269
{
269270
try {
270-
return view(config('Generators')->views[$this->name], $data, ['debug' => false]);
271+
return view(config(Generators::class)->views[$this->name], $data, ['debug' => false]);
271272
} catch (Throwable $e) {
272273
log_message('error', (string) $e);
273274

system/Cache/Handlers/BaseHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Closure;
1515
use CodeIgniter\Cache\CacheInterface;
16+
use Config\Cache;
1617
use Exception;
1718
use InvalidArgumentException;
1819

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

64-
$reserved = config('Cache')->reservedCharacters ?? self::RESERVED_CHARACTERS;
65+
$reserved = config(Cache::class)->reservedCharacters ?? self::RESERVED_CHARACTERS;
6566
if ($reserved && strpbrk($key, $reserved) !== false) {
6667
throw new InvalidArgumentException('Cache key contains reserved characters ' . $reserved);
6768
}

0 commit comments

Comments
 (0)