Skip to content

Commit 8020475

Browse files
committed
Release v4.5.8
1 parent f253839 commit 8020475

File tree

154 files changed

+632
-544
lines changed

Some content is hidden

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

154 files changed

+632
-544
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
The MIT License (MIT)
22

33
Copyright (c) 2014-2019 British Columbia Institute of Technology
4-
Copyright (c) 2019-2024 CodeIgniter Foundation
4+
Copyright (c) 2019-present CodeIgniter Foundation
55

66
Permission is hereby granted, free of charge, to any person obtaining a copy
77
of this software and associated documentation files (the "Software"), to deal

preload.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function load(): void
8686
$phpFiles = new RegexIterator(
8787
$fullTree,
8888
'/.+((?<!Test)+\.php$)/i',
89-
RecursiveRegexIterator::GET_MATCH
89+
RecursiveRegexIterator::GET_MATCH,
9090
);
9191

9292
foreach ($phpFiles as $key => $file) {

public/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
$message = sprintf(
1212
'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s',
1313
$minPhpVersion,
14-
PHP_VERSION
14+
PHP_VERSION,
1515
);
1616

1717
header('HTTP/1.1 503 Service Unavailable.', true, 503);

spark

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if (version_compare(PHP_VERSION, $minPhpVersion, '<')) {
4040
$message = sprintf(
4141
'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s',
4242
$minPhpVersion,
43-
PHP_VERSION
43+
PHP_VERSION,
4444
);
4545

4646
exit($message);

system/API/ResponseTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ protected function format($data = null)
319319
$mime = $this->request->negotiate(
320320
'media',
321321
$format->getConfig()->supportedResponseFormats,
322-
false
322+
false,
323323
);
324324
}
325325

system/Autoloader/Autoloader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ public function sanitizeFilename(string $filename): string
347347

348348
throw new InvalidArgumentException(
349349
'The file path contains special characters "' . $chars
350-
. '" that are not allowed: "' . $filename . '"'
350+
. '" that are not allowed: "' . $filename . '"',
351351
);
352352
}
353353
if ($result === false) {
@@ -386,7 +386,7 @@ private function loadComposerNamespaces(ClassLoader $composer, array $composerPa
386386
throw new RuntimeException(
387387
'Your Composer version is too old.'
388388
. ' Please update Composer (run `composer self-update`) to v2.0.14 or later'
389-
. ' and remove your vendor/ directory, and run `composer update`.'
389+
. ' and remove your vendor/ directory, and run `composer update`.',
390390
);
391391
}
392392
// This method requires Composer 2.0.14 or later.

system/Autoloader/FileLocator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,9 @@ public function findQualifiedNameFromPath(string $path)
295295
str_replace(
296296
'/',
297297
'\\',
298-
mb_substr($path, mb_strlen($namespace['path']))
298+
mb_substr($path, mb_strlen($namespace['path'])),
299299
),
300-
'\\'
300+
'\\',
301301
);
302302
// Remove the file extension (.php)
303303
$className = mb_substr($className, 0, -4);

system/BaseModel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ protected function createDataConverter(): void
379379
$this->converter = new DataConverter(
380380
$this->casts,
381381
$this->castHandlers,
382-
$this->db
382+
$this->db,
383383
);
384384
}
385385
}
@@ -1081,7 +1081,7 @@ public function updateBatch(?array $set = null, ?string $index = null, int $batc
10811081
if ($updateIndex === null) {
10821082
throw new InvalidArgumentException(
10831083
'The index ("' . $index . '") for updateBatch() is missing in the data: '
1084-
. json_encode($row)
1084+
. json_encode($row),
10851085
);
10861086
}
10871087

system/Boot.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ protected static function checkMissingExtensions(): void
288288

289289
$message = sprintf(
290290
'The framework needs the following extension(s) installed and loaded: %s.',
291-
implode(', ', $missingExtensions)
291+
implode(', ', $missingExtensions),
292292
);
293293

294294
header('HTTP/1.1 503 Service Unavailable.', true, 503);

system/CLI/CLI.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ public static function promptByKey($text, array $options, $validation = null): s
289289

290290
CLI::isZeroOptions($options);
291291

292-
if ($line = array_shift($text)) {
292+
if (($line = array_shift($text)) !== null) {
293293
CLI::write($line);
294294
}
295295

@@ -348,7 +348,7 @@ public static function promptByMultipleKeys(string $text, array $options): array
348348
// return the prompt again if $input contain(s) non-numeric character, except a comma.
349349
// And if max from $options less than max from input,
350350
// it means user tried to access null value in $options
351-
if ($pattern === 0 || $maxOptions < $maxInput) {
351+
if ($pattern < 1 || $maxOptions < $maxInput) {
352352
static::error('Please select correctly.');
353353
CLI::newLine();
354354

@@ -610,11 +610,11 @@ public static function color(string $text, string $foreground, ?string $backgrou
610610
$nonColoredText = preg_replace(
611611
$pattern,
612612
'<<__colored_string__>>',
613-
$text
613+
$text,
614614
);
615615
$nonColoredChunks = preg_split(
616616
'/<<__colored_string__>>/u',
617-
$nonColoredText
617+
$nonColoredText,
618618
);
619619

620620
foreach ($nonColoredChunks as $i => $chunk) {

system/CLI/Console.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function showHeader(bool $suppress = false)
6363
'CodeIgniter v%s Command Line Tool - Server Time: %s UTC%s',
6464
CodeIgniter::CI_VERSION,
6565
date('Y-m-d H:i:s'),
66-
date('P')
66+
date('P'),
6767
), 'green');
6868
CLI::newLine();
6969
}

system/CLI/GeneratorTrait.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ private function generateFile(string $target, string $content): void
171171
CLI::prompt(
172172
'Are you sure you want to continue?',
173173
['y', 'n'],
174-
'required'
174+
'required',
175175
) === 'n'
176176
) {
177177
CLI::newLine();
@@ -193,7 +193,7 @@ private function generateFile(string $target, string $content): void
193193
CLI::error(
194194
lang('CLI.generator.fileExist', [clean_path($target)]),
195195
'light_gray',
196-
'red'
196+
'red',
197197
);
198198
CLI::newLine();
199199

@@ -216,7 +216,7 @@ private function generateFile(string $target, string $content): void
216216
CLI::error(
217217
lang('CLI.generator.fileError', [clean_path($target)]),
218218
'light_gray',
219-
'red'
219+
'red',
220220
);
221221
CLI::newLine();
222222

@@ -227,7 +227,7 @@ private function generateFile(string $target, string $content): void
227227
if ($this->getOption('force') && $isFile) {
228228
CLI::write(
229229
lang('CLI.generator.fileOverwrite', [clean_path($target)]),
230-
'yellow'
230+
'yellow',
231231
);
232232
CLI::newLine();
233233

@@ -236,7 +236,7 @@ private function generateFile(string $target, string $content): void
236236

237237
CLI::write(
238238
lang('CLI.generator.fileCreate', [clean_path($target)]),
239-
'green'
239+
'green',
240240
);
241241
CLI::newLine();
242242
}
@@ -326,10 +326,10 @@ private function normalizeInputClassName(): string
326326
'\\',
327327
array_map(
328328
pascalize(...),
329-
explode('\\', str_replace('/', '\\', trim($class)))
330-
)
329+
explode('\\', str_replace('/', '\\', trim($class))),
330+
),
331331
),
332-
'\\/'
332+
'\\/',
333333
);
334334
}
335335

@@ -351,7 +351,7 @@ protected function renderTemplate(array $data = []): string
351351
return view(
352352
"CodeIgniter\\Commands\\Generators\\Views\\{$this->template}",
353353
$data,
354-
['debug' => false]
354+
['debug' => false],
355355
);
356356
}
357357
}
@@ -370,15 +370,15 @@ protected function parseTemplate(
370370
string $class,
371371
array $search = [],
372372
array $replace = [],
373-
array $data = []
373+
array $data = [],
374374
): string {
375375
// Retrieves the namespace part from the fully qualified class name.
376376
$namespace = trim(
377377
implode(
378378
'\\',
379-
array_slice(explode('\\', $class), 0, -1)
379+
array_slice(explode('\\', $class), 0, -1),
380380
),
381-
'\\'
381+
'\\',
382382
);
383383
$search[] = '<@php';
384384
$search[] = '{namespace}';
@@ -404,7 +404,7 @@ protected function buildContent(string $class): string
404404
&& preg_match(
405405
'/(?P<imports>(?:^use [^;]+;$\n?)+)/m',
406406
$template,
407-
$match
407+
$match,
408408
)
409409
) {
410410
$imports = explode("\n", trim($match['imports']));
@@ -432,7 +432,7 @@ protected function buildPath(string $class): string
432432
CLI::error(
433433
lang('CLI.namespaceNotDefined', [$namespace]),
434434
'light_gray',
435-
'red'
435+
'red',
436436
);
437437
CLI::newLine();
438438

@@ -446,16 +446,16 @@ protected function buildPath(string $class): string
446446
. str_replace(
447447
'\\',
448448
DIRECTORY_SEPARATOR,
449-
trim(str_replace($namespace . '\\', '', $class), '\\')
449+
trim(str_replace($namespace . '\\', '', $class), '\\'),
450450
) . '.php';
451451

452452
return implode(
453453
DIRECTORY_SEPARATOR,
454454
array_slice(
455455
explode(DIRECTORY_SEPARATOR, $file),
456456
0,
457-
-1
458-
)
457+
-1,
458+
),
459459
) . DIRECTORY_SEPARATOR . $this->basename($file);
460460
}
461461

@@ -470,9 +470,9 @@ protected function getNamespace(): string
470470
str_replace(
471471
'/',
472472
'\\',
473-
$this->getOption('namespace') ?? APP_NAMESPACE
473+
$this->getOption('namespace') ?? APP_NAMESPACE,
474474
),
475-
'\\'
475+
'\\',
476476
);
477477
}
478478

system/Cache/Handlers/MemcachedHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function initialize()
8585
$this->memcached->addServer(
8686
$this->config['host'],
8787
$this->config['port'],
88-
$this->config['weight']
88+
$this->config['weight'],
8989
);
9090

9191
// attempt to get status of servers
@@ -103,7 +103,7 @@ public function initialize()
103103
// Check if we can connect to the server
104104
$canConnect = $this->memcached->connect(
105105
$this->config['host'],
106-
$this->config['port']
106+
$this->config['port'],
107107
);
108108

109109
// If we can't connect, throw a CriticalError exception
@@ -116,7 +116,7 @@ public function initialize()
116116
$this->config['host'],
117117
$this->config['port'],
118118
true,
119-
$this->config['weight']
119+
$this->config['weight'],
120120
);
121121
} else {
122122
throw new CriticalError('Cache: Not support Memcache(d) extension.');

system/Cache/Handlers/PredisHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function get(string $key)
8282

8383
$data = array_combine(
8484
['__ci_type', '__ci_value'],
85-
$this->redis->hmget($key, ['__ci_type', '__ci_value'])
85+
$this->redis->hmget($key, ['__ci_type', '__ci_value']),
8686
);
8787

8888
if (! isset($data['__ci_type'], $data['__ci_value']) || $data['__ci_value'] === false) {

system/Cache/ResponseCache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function make($request, ResponseInterface $response): bool
112112
return $this->cache->save(
113113
$this->generateCacheKey($request),
114114
serialize(['headers' => $headers, 'output' => $response->getBody()]),
115-
$this->ttl
115+
$this->ttl,
116116
);
117117
}
118118

system/CodeIgniter.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class CodeIgniter
5656
/**
5757
* The current version of CodeIgniter Framework
5858
*/
59-
public const CI_VERSION = '4.5.7';
59+
public const CI_VERSION = '4.5.8';
6060

6161
/**
6262
* App startup time.
@@ -325,7 +325,7 @@ public function run(?RouteCollectionInterface $routes = null, bool $returnRespon
325325
if ($this->context === null) {
326326
throw new LogicException(
327327
'Context must be set before run() is called. If you are upgrading from 4.1.x, '
328-
. 'you need to merge `public/index.php` and `spark` file from `vendor/codeigniter4/framework`.'
328+
. 'you need to merge `public/index.php` and `spark` file from `vendor/codeigniter4/framework`.',
329329
);
330330
}
331331

@@ -799,7 +799,7 @@ public function displayPerformanceMetrics(string $output): string
799799
return str_replace(
800800
['{elapsed_time}', '{memory_usage}'],
801801
[(string) $this->totalTime, number_format(memory_get_peak_usage() / 1024 / 1024, 3)],
802-
$output
802+
$output,
803803
);
804804
}
805805

@@ -979,7 +979,7 @@ protected function display404errors(PageNotFoundException $e)
979979

980980
// Throws new PageNotFoundException and remove exception message on production.
981981
throw PageNotFoundException::forPageNotFound(
982-
(ENVIRONMENT !== 'production' || ! $this->isWeb()) ? $e->getMessage() : null
982+
(ENVIRONMENT !== 'production' || ! $this->isWeb()) ? $e->getMessage() : null,
983983
);
984984
}
985985

@@ -1064,7 +1064,7 @@ public function storePreviousURL($uri)
10641064
$uri->getAuthority(),
10651065
$uri->getPath(),
10661066
$uri->getQuery(),
1067-
$uri->getFragment()
1067+
$uri->getFragment(),
10681068
));
10691069
}
10701070
}

0 commit comments

Comments
 (0)