Skip to content

Commit 3809bd6

Browse files
authored
Merge pull request #237 from michalsn/update-460
Update framework to v4.6.0
2 parents 6f74bca + a709e7f commit 3809bd6

28 files changed

+712
-605
lines changed

.github/workflows/deptrac.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ on:
2020

2121
jobs:
2222
deptrac:
23-
uses: codeigniter4/.github/.github/workflows/deptrac.yml@CI45
23+
uses: codeigniter4/.github/.github/workflows/deptrac.yml@CI46

.github/workflows/infection.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ on:
1212

1313
jobs:
1414
infection:
15-
uses: codeigniter4/.github/.github/workflows/infection.yml@CI45
15+
uses: codeigniter4/.github/.github/workflows/infection.yml@CI46

.github/workflows/phpcpd.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ on:
1616

1717
jobs:
1818
phpcpd:
19-
uses: codeigniter4/.github/.github/workflows/phpcpd.yml@CI45
19+
uses: codeigniter4/.github/.github/workflows/phpcpd.yml@CI46
2020
with:
2121
dirs: "src/ tests/"

.github/workflows/phpcsfixer.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ on:
1616

1717
jobs:
1818
phpcsfixer:
19-
uses: codeigniter4/.github/.github/workflows/phpcsfixer.yml@CI45
19+
uses: codeigniter4/.github/.github/workflows/phpcsfixer.yml@CI46

.github/workflows/phpstan.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ on:
2020

2121
jobs:
2222
phpstan:
23-
uses: codeigniter4/.github/.github/workflows/phpstan.yml@CI45
23+
uses: codeigniter4/.github/.github/workflows/phpstan.yml@CI46

.github/workflows/phpunit.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ on:
2020

2121
jobs:
2222
phpunit:
23-
uses: codeigniter4/.github/.github/workflows/phpunit.yml@CI45
23+
uses: codeigniter4/.github/.github/workflows/phpunit.yml@CI46

.github/workflows/psalm.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ on:
2020

2121
jobs:
2222
psalm:
23-
uses: codeigniter4/.github/.github/workflows/psalm.yml@CI45
23+
uses: codeigniter4/.github/.github/workflows/psalm.yml@CI46

.github/workflows/rector.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ on:
2020

2121
jobs:
2222
rector:
23-
uses: codeigniter4/.github/.github/workflows/rector.yml@CI45
23+
uses: codeigniter4/.github/.github/workflows/rector.yml@CI46

.github/workflows/unused.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ on:
1818

1919
jobs:
2020
unused:
21-
uses: codeigniter4/.github/.github/workflows/unused.yml@CI45
21+
uses: codeigniter4/.github/.github/workflows/unused.yml@CI46

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ To setup a working playground on your own local device, read through the next se
2626

2727
In order to get the playground setup on your own computer, you'll need a few minimum requirements - all of which
2828
are listed on [CodeIgniter's repo](https://github.com/codeigniter4/CodeIgniter4#server-requirements). Basically,
29-
as long as you are running PHP 7.4 or later you'll meet most of them.
29+
as long as you are running PHP 8.1 or later you'll meet most of them.
3030

3131
While CodeIgniter does not require it, using this repo also requires the use of
3232
[Composer](https://getcomposer.org/) to install CodeIgniter as a dependency, and PHPUnit - the test framework.

app/Config/Cache.php

+2-12
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,6 @@ class Cache extends BaseConfig
3434
*/
3535
public string $backupHandler = 'dummy';
3636

37-
/**
38-
* --------------------------------------------------------------------------
39-
* Cache Directory Path
40-
* --------------------------------------------------------------------------
41-
*
42-
* The path to where cache files should be stored, if using a file-based
43-
* system.
44-
*
45-
* @deprecated Use the driver-specific variant under $file
46-
*/
47-
public string $storePath = WRITEPATH . 'cache/';
48-
4937
/**
5038
* --------------------------------------------------------------------------
5139
* Key Prefix
@@ -86,6 +74,7 @@ class Cache extends BaseConfig
8674
* --------------------------------------------------------------------------
8775
* File settings
8876
* --------------------------------------------------------------------------
77+
*
8978
* Your file storage preferences can be specified below, if you are using
9079
* the File driver.
9180
*
@@ -100,6 +89,7 @@ class Cache extends BaseConfig
10089
* -------------------------------------------------------------------------
10190
* Memcached settings
10291
* -------------------------------------------------------------------------
92+
*
10393
* Your Memcached servers can be specified below, if you are using
10494
* the Memcached drivers.
10595
*

app/Config/Constants.php

-15
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,3 @@
7777
defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error
7878
defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
7979
defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
80-
81-
/**
82-
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_LOW instead.
83-
*/
84-
define('EVENT_PRIORITY_LOW', 200);
85-
86-
/**
87-
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_NORMAL instead.
88-
*/
89-
define('EVENT_PRIORITY_NORMAL', 100);
90-
91-
/**
92-
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_HIGH instead.
93-
*/
94-
define('EVENT_PRIORITY_HIGH', 10);

app/Config/Database.php

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class Database extends Config
4343
'failover' => [],
4444
'port' => 3306,
4545
'numberNative' => false,
46+
'foundRows' => false,
4647
'dateFormat' => [
4748
'date' => 'Y-m-d',
4849
'datetime' => 'Y-m-d H:i:s',
@@ -64,6 +65,7 @@ class Database extends Config
6465
// 'failover' => [],
6566
// 'foreignKeys' => true,
6667
// 'busyTimeout' => 1000,
68+
// 'synchronous' => null,
6769
// 'dateFormat' => [
6870
// 'date' => 'Y-m-d',
6971
// 'datetime' => 'Y-m-d H:i:s',

app/Config/Events.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
*/
4545
if (CI_DEBUG && ! is_cli()) {
4646
Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect');
47-
Services::toolbar()->respond();
47+
service('toolbar')->respond();
4848
// Hot Reload route - for framework use on the hot reloader.
4949
if (ENVIRONMENT === 'development') {
50-
Services::routes()->get('__hot-reload', static function () {
50+
service('routes')->get('__hot-reload', static function (): void {
5151
(new HotReloader())->run();
5252
});
5353
}

app/Config/Feature.php

+10-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
class Feature extends BaseConfig
1111
{
1212
/**
13-
* Use improved new auto routing instead of the default legacy version.
13+
* Use improved new auto routing instead of the legacy version.
1414
*/
15-
public bool $autoRoutesImproved = false;
15+
public bool $autoRoutesImproved = true;
1616

1717
/**
1818
* Use filter execution order in 4.4 or before.
@@ -26,4 +26,12 @@ class Feature extends BaseConfig
2626
* If false, `limit(0)` returns no records. (the behavior of 3.1.9 or later in version 3.x.)
2727
*/
2828
public bool $limitZeroAsAll = true;
29+
30+
/**
31+
* Use strict location negotiation.
32+
*
33+
* By default, the locale is selected based on a loose comparison of the language code (ISO 639-1)
34+
* Enabling strict comparison will also consider the region code (ISO 3166-1 alpha-2).
35+
*/
36+
public bool $strictLocaleNegotiation = false;
2937
}

app/Config/Format.php

-13
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Config;
44

55
use CodeIgniter\Config\BaseConfig;
6-
use CodeIgniter\Format\FormatterInterface;
76
use CodeIgniter\Format\JSONFormatter;
87
use CodeIgniter\Format\XMLFormatter;
98

@@ -62,16 +61,4 @@ class Format extends BaseConfig
6261
'application/xml' => 0,
6362
'text/xml' => 0,
6463
];
65-
66-
/**
67-
* A Factory method to return the appropriate formatter for the given mime type.
68-
*
69-
* @return FormatterInterface
70-
*
71-
* @deprecated This is an alias of `\CodeIgniter\Format\Format::getFormatter`. Use that instead.
72-
*/
73-
public function getFormatter(string $mime)
74-
{
75-
return Services::format()->getFormatter($mime);
76-
}
7764
}

app/Config/Kint.php

-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Config;
44

55
use Kint\Parser\ConstructablePluginInterface;
6-
use Kint\Renderer\AbstractRenderer;
76
use Kint\Renderer\Rich\TabPluginInterface;
87
use Kint\Renderer\Rich\ValuePluginInterface;
98

@@ -41,7 +40,6 @@ class Kint
4140
*/
4241
public string $richTheme = 'aante-light.css';
4342
public bool $richFolder = false;
44-
public int $richSort = AbstractRenderer::SORT_FULL;
4543

4644
/**
4745
* @var array<string, class-string<ValuePluginInterface>>|null

app/Config/Routing.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,5 @@ class Routing extends BaseRouting
136136
*
137137
* Default: false
138138
*/
139-
public bool $translateUriToCamelCase = false;
139+
public bool $translateUriToCamelCase = true;
140140
}

app/Config/Security.php

-17
Original file line numberDiff line numberDiff line change
@@ -83,21 +83,4 @@ class Security extends BaseConfig
8383
* @see https://codeigniter4.github.io/userguide/libraries/security.html#redirection-on-failure
8484
*/
8585
public bool $redirect = (ENVIRONMENT === 'production');
86-
87-
/**
88-
* --------------------------------------------------------------------------
89-
* CSRF SameSite
90-
* --------------------------------------------------------------------------
91-
*
92-
* Setting for CSRF SameSite cookie token.
93-
*
94-
* Allowed values are: None - Lax - Strict - ''.
95-
*
96-
* Defaults to `Lax` as recommended in this link:
97-
*
98-
* @see https://portswigger.net/web-security/csrf/samesite-cookies
99-
*
100-
* @deprecated `Config\Cookie` $samesite property is used.
101-
*/
102-
public string $samesite = 'Lax';
10386
}

app/Controllers/BaseController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ public function initController(RequestInterface $request, ResponseInterface $res
5353

5454
// Preload any models, libraries, etc, here.
5555

56-
// E.g.: $this->session = \Config\Services::session();
56+
// E.g.: $this->session = service('session');
5757
}
5858
}

app/Views/errors/cli/error_exception.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
$function .= $padClass . $error['function'];
5151
}
5252

53-
$args = implode(', ', array_map(static fn ($value) => match (true) {
53+
$args = implode(', ', array_map(static fn ($value): string => match (true) {
5454
is_object($value) => 'Object(' . $value::class . ')',
55-
is_array($value) => count($value) ? '[...]' : '[]',
55+
is_array($value) => $value !== [] ? '[...]' : '[]',
5656
$value === null => 'null', // return the lowercased version
5757
default => var_export($value, true),
5858
}, array_values($error['args'] ?? [])));

app/Views/errors/html/debug.css

+7-3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ p.lead {
4141
.header {
4242
background: var(--light-bg-color);
4343
color: var(--dark-text-color);
44+
margin-top: 2.17rem;
4445
}
4546
.header .container {
4647
padding: 1rem;
@@ -65,10 +66,13 @@ p.lead {
6566
}
6667

6768
.environment {
68-
background: var(--dark-bg-color);
69-
color: var(--light-text-color);
69+
background: var(--brand-primary-color);
70+
color: var(--main-bg-color);
7071
text-align: center;
71-
padding: 0.2rem;
72+
padding: calc(4px + 0.2083vw);
73+
width: 100%;
74+
margin-top: -2.14rem;
75+
position: fixed;
7276
}
7377

7478
.source {

app/Views/errors/html/error_400.php

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title><?= lang('Errors.badRequest') ?></title>
6+
7+
<style>
8+
div.logo {
9+
height: 200px;
10+
width: 155px;
11+
display: inline-block;
12+
opacity: 0.08;
13+
position: absolute;
14+
top: 2rem;
15+
left: 50%;
16+
margin-left: -73px;
17+
}
18+
body {
19+
height: 100%;
20+
background: #fafafa;
21+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
22+
color: #777;
23+
font-weight: 300;
24+
}
25+
h1 {
26+
font-weight: lighter;
27+
letter-spacing: normal;
28+
font-size: 3rem;
29+
margin-top: 0;
30+
margin-bottom: 0;
31+
color: #222;
32+
}
33+
.wrap {
34+
max-width: 1024px;
35+
margin: 5rem auto;
36+
padding: 2rem;
37+
background: #fff;
38+
text-align: center;
39+
border: 1px solid #efefef;
40+
border-radius: 0.5rem;
41+
position: relative;
42+
}
43+
pre {
44+
white-space: normal;
45+
margin-top: 1.5rem;
46+
}
47+
code {
48+
background: #fafafa;
49+
border: 1px solid #efefef;
50+
padding: 0.5rem 1rem;
51+
border-radius: 5px;
52+
display: block;
53+
}
54+
p {
55+
margin-top: 1.5rem;
56+
}
57+
.footer {
58+
margin-top: 2rem;
59+
border-top: 1px solid #efefef;
60+
padding: 1em 2em 0 2em;
61+
font-size: 85%;
62+
color: #999;
63+
}
64+
a:active,
65+
a:link,
66+
a:visited {
67+
color: #dd4814;
68+
}
69+
</style>
70+
</head>
71+
<body>
72+
<div class="wrap">
73+
<h1>400</h1>
74+
75+
<p>
76+
<?php if (ENVIRONMENT !== 'production') : ?>
77+
<?= nl2br(esc($message)) ?>
78+
<?php else : ?>
79+
<?= lang('Errors.sorryBadRequest') ?>
80+
<?php endif; ?>
81+
</p>
82+
</div>
83+
</body>
84+
</html>

app/Views/errors/html/error_exception.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22
use CodeIgniter\HTTP\Header;
3-
use Config\Services;
43
use CodeIgniter\CodeIgniter;
54

65
$errorId = uniqid('error', true);
@@ -225,7 +224,7 @@
225224

226225
<!-- Request -->
227226
<div class="content" id="request">
228-
<?php $request = Services::request(); ?>
227+
<?php $request = service('request'); ?>
229228

230229
<table>
231230
<tbody>
@@ -343,7 +342,7 @@
343342

344343
<!-- Response -->
345344
<?php
346-
$response = Services::response();
345+
$response = service('response');
347346
$response->setStatusCode(http_response_code());
348347
?>
349348
<div class="content" id="response">

0 commit comments

Comments
 (0)