Skip to content

Commit d021b04

Browse files
committed
Release v4.6.1
1 parent 96a1e60 commit d021b04

File tree

99 files changed

+852
-447
lines changed

Some content is hidden

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

99 files changed

+852
-447
lines changed

.gitignore

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@ _modules/*
100100
.idea/
101101
*.iml
102102

103-
# Netbeans
104-
nbproject/
105-
build/
106-
nbbuild/
107-
dist/
108-
nbdist/
109-
nbactions.xml
110-
nb-configuration.xml
111-
.nb-gradle/
103+
# NetBeans
104+
/nbproject/
105+
/build/
106+
/nbbuild/
107+
/dist/
108+
/nbdist/
109+
/nbactions.xml
110+
/nb-configuration.xml
111+
/.nb-gradle/
112112

113113
# Sublime Text
114114
*.tmlanguage.cache

app/Config/Autoload.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
*
1818
* NOTE: This class is required prior to Autoloader instantiation,
1919
* and does not extend BaseConfig.
20-
*
21-
* @immutable
2220
*/
2321
class Autoload extends AutoloadConfig
2422
{

app/Config/Cache.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ class Cache extends BaseConfig
108108
* -------------------------------------------------------------------------
109109
* Redis settings
110110
* -------------------------------------------------------------------------
111+
*
111112
* Your Redis server can be specified below, if you are using
112113
* the Redis or Predis drivers.
113114
*

app/Config/DocTypes.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
namespace Config;
44

5-
/**
6-
* @immutable
7-
*/
85
class DocTypes
96
{
107
/**

app/Config/Mimes.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
namespace Config;
44

55
/**
6-
* Mimes
7-
*
86
* This file contains an array of mime types. It is used by the
97
* Upload class to help identify allowed file types.
108
*
@@ -15,8 +13,6 @@
1513
*
1614
* When working with mime types, please make sure you have the ´fileinfo´
1715
* extension enabled to reliably detect the media types.
18-
*
19-
* @immutable
2016
*/
2117
class Mimes
2218
{
@@ -482,6 +478,8 @@ class Mimes
482478
'application/sla',
483479
'application/vnd.ms-pki.stl',
484480
'application/x-navistyle',
481+
'model/stl',
482+
'application/octet-stream',
485483
],
486484
];
487485

app/Config/Modules.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
*
1010
* NOTE: This class is required prior to Autoloader instantiation,
1111
* and does not extend BaseConfig.
12-
*
13-
* @immutable
1412
*/
1513
class Modules extends BaseModules
1614
{

app/Config/Optimize.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
*
88
* NOTE: This class does not extend BaseConfig for performance reasons.
99
* So you cannot replace the property values with Environment Variables.
10-
*
11-
* @immutable
1210
*/
1311
class Optimize
1412
{

app/Config/Paths.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
*
1616
* NOTE: This class is required prior to Autoloader instantiation,
1717
* and does not extend BaseConfig.
18-
*
19-
* @immutable
2018
*/
2119
class Paths
2220
{

app/Views/errors/html/debug.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
--main-text-color: #555;
44
--dark-text-color: #222;
55
--light-text-color: #c7c7c7;
6-
--brand-primary-color: #E06E3F;
6+
--brand-primary-color: #DC4814;
77
--light-bg-color: #ededee;
88
--dark-bg-color: #404040;
99
}
@@ -71,7 +71,7 @@ p.lead {
7171
text-align: center;
7272
padding: calc(4px + 0.2083vw);
7373
width: 100%;
74-
margin-top: -2.14rem;
74+
top: 0;
7575
position: fixed;
7676
}
7777

preload.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
* the LICENSE file that was distributed with this source code.
1010
*/
1111

12+
use CodeIgniter\Boot;
13+
use Config\Paths;
14+
1215
/*
1316
*---------------------------------------------------------------
1417
* Sample file for Preloading
@@ -69,10 +72,10 @@ public function __construct()
6972

7073
private function loadAutoloader(): void
7174
{
72-
$paths = new Config\Paths();
75+
$paths = new Paths();
7376
require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'Boot.php';
7477

75-
CodeIgniter\Boot::preload($paths);
78+
Boot::preload($paths);
7679
}
7780

7881
/**

public/index.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<?php
22

3+
use CodeIgniter\Boot;
4+
use Config\Paths;
5+
36
/*
47
*---------------------------------------------------------------
58
* CHECK PHP VERSION
@@ -48,9 +51,9 @@
4851
require FCPATH . '../app/Config/Paths.php';
4952
// ^^^ Change this line if you move your application folder
5053

51-
$paths = new Config\Paths();
54+
$paths = new Paths();
5255

5356
// LOAD THE FRAMEWORK BOOTSTRAP FILE
5457
require $paths->systemDirectory . '/Boot.php';
5558

56-
exit(CodeIgniter\Boot::bootWeb($paths));
59+
exit(Boot::bootWeb($paths));

spark

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
* the LICENSE file that was distributed with this source code.
1111
*/
1212

13+
use CodeIgniter\Boot;
14+
use Config\Paths;
15+
1316
/*
1417
* --------------------------------------------------------------------
1518
* CODEIGNITER COMMAND-LINE TOOLS
@@ -76,9 +79,9 @@ chdir(FCPATH);
7679
require FCPATH . '../app/Config/Paths.php';
7780
// ^^^ Change this line if you move your application folder
7881

79-
$paths = new Config\Paths();
82+
$paths = new Paths();
8083

8184
// LOAD THE FRAMEWORK BOOTSTRAP FILE
8285
require $paths->systemDirectory . '/Boot.php';
8386

84-
exit(CodeIgniter\Boot::bootSpark($paths));
87+
exit(Boot::bootSpark($paths));

system/Autoloader/Autoloader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function initialize(Autoload $config, Modules $modules)
123123
$this->files = $config->files;
124124
}
125125

126-
if (isset($config->helpers)) {
126+
if ($config->helpers !== []) {
127127
$this->helpers = [...$this->helpers, ...$config->helpers];
128128
}
129129

system/Autoloader/FileLocator.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,6 @@ protected function getNamespaces()
266266
return array_merge($namespaces, $system);
267267
}
268268

269-
/**
270-
* Find the qualified name of a file according to
271-
* the namespace of the first matched namespace path.
272-
*
273-
* @return false|string The qualified name or false if the path is not found
274-
*/
275269
public function findQualifiedNameFromPath(string $path)
276270
{
277271
$resolvedPath = realpath($path);
@@ -299,7 +293,9 @@ public function findQualifiedNameFromPath(string $path)
299293
),
300294
'\\',
301295
);
296+
302297
// Remove the file extension (.php)
298+
/** @var class-string */
303299
$className = mb_substr($className, 0, -4);
304300

305301
if (in_array($className, $this->invalidClassnames, true)) {

system/Autoloader/FileLocatorInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function search(string $path, string $ext = 'php', bool $prioritizeApp =
6262
* Find the qualified name of a file according to
6363
* the namespace of the first matched namespace path.
6464
*
65-
* @return false|string The qualified name or false if the path is not found
65+
* @return class-string|false The qualified name or false if the path is not found
6666
*/
6767
public function findQualifiedNameFromPath(string $path);
6868

system/BaseModel.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,13 @@ abstract class BaseModel
121121
protected ?DataConverter $converter = null;
122122

123123
/**
124-
* If this model should use "softDeletes" and
125-
* simply set a date when rows are deleted, or
126-
* do hard deletes.
124+
* Determines whether the model should protect field names during
125+
* mass assignment operations such as insert() and update().
126+
*
127+
* When set to true, only the fields explicitly defined in the $allowedFields
128+
* property will be allowed for mass assignment. This helps prevent
129+
* unintended modification of database fields and improves security
130+
* by avoiding mass assignment vulnerabilities.
127131
*
128132
* @var bool
129133
*/

system/CLI/CLI.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ class CLI
107107
/**
108108
* List of array segments.
109109
*
110-
* @var array
110+
* @var list<string>
111111
*/
112112
protected static $segments = [];
113113

114114
/**
115-
* @var array
115+
* @var array<string, string|null>
116116
*/
117117
protected static $options = [];
118118

@@ -944,6 +944,8 @@ public static function getSegment(int $index)
944944

945945
/**
946946
* Returns the raw array of segments found.
947+
*
948+
* @return list<string>
947949
*/
948950
public static function getSegments(): array
949951
{
@@ -971,6 +973,8 @@ public static function getOption(string $name)
971973

972974
/**
973975
* Returns the raw array of options found.
976+
*
977+
* @return array<string, string|null>
974978
*/
975979
public static function getOptions(): array
976980
{

system/CLI/Commands.php

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@
2121

2222
/**
2323
* Core functionality for running, listing, etc commands.
24+
*
25+
* @phpstan-type commands_list array<string, array{'class': class-string<BaseCommand>, 'file': string, 'group': string,'description': string}>
2426
*/
2527
class Commands
2628
{
2729
/**
2830
* The found commands.
2931
*
30-
* @var array
32+
* @var commands_list
3133
*/
3234
protected $commands = [];
3335

@@ -52,6 +54,8 @@ public function __construct($logger = null)
5254
/**
5355
* Runs a command given
5456
*
57+
* @param array<int|string, string|null> $params
58+
*
5559
* @return int Exit code
5660
*/
5761
public function run(string $command, array $params)
@@ -77,7 +81,7 @@ public function run(string $command, array $params)
7781
/**
7882
* Provide access to the list of commands.
7983
*
80-
* @return array
84+
* @return commands_list
8185
*/
8286
public function getCommands()
8387
{
@@ -96,7 +100,7 @@ public function discoverCommands()
96100
return;
97101
}
98102

99-
/** @var FileLocatorInterface $locator */
103+
/** @var FileLocatorInterface */
100104
$locator = service('locator');
101105
$files = $locator->listFiles('Commands/');
102106

@@ -109,6 +113,7 @@ public function discoverCommands()
109113
// Loop over each file checking to see if a command with that
110114
// alias exists in the class.
111115
foreach ($files as $file) {
116+
/** @var class-string<BaseCommand>|false */
112117
$className = $locator->findQualifiedNameFromPath($file);
113118

114119
if ($className === false || ! class_exists($className)) {
@@ -122,7 +127,6 @@ public function discoverCommands()
122127
continue;
123128
}
124129

125-
/** @var BaseCommand $class */
126130
$class = new $className($this->logger, $this);
127131

128132
if (isset($class->group) && ! isset($this->commands[$class->name])) {
@@ -146,16 +150,18 @@ public function discoverCommands()
146150
/**
147151
* Verifies if the command being sought is found
148152
* in the commands list.
153+
*
154+
* @param commands_list $commands
149155
*/
150156
public function verifyCommand(string $command, array $commands): bool
151157
{
152158
if (isset($commands[$command])) {
153159
return true;
154160
}
155161

156-
$message = lang('CLI.commandNotFound', [$command]);
157-
162+
$message = lang('CLI.commandNotFound', [$command]);
158163
$alternatives = $this->getCommandAlternatives($command, $commands);
164+
159165
if ($alternatives !== []) {
160166
if (count($alternatives) === 1) {
161167
$message .= "\n\n" . lang('CLI.altCommandSingular') . "\n ";
@@ -175,11 +181,17 @@ public function verifyCommand(string $command, array $commands): bool
175181
/**
176182
* Finds alternative of `$name` among collection
177183
* of commands.
184+
*
185+
* @param commands_list $collection
186+
*
187+
* @return list<string>
178188
*/
179189
protected function getCommandAlternatives(string $name, array $collection): array
180190
{
191+
/** @var array<string, int> */
181192
$alternatives = [];
182193

194+
/** @var string $commandName */
183195
foreach (array_keys($collection) as $commandName) {
184196
$lev = levenshtein($name, $commandName);
185197

0 commit comments

Comments
 (0)