Skip to content

Commit 424bfa7

Browse files
committed
Release v4.1.0
1 parent e517b4d commit 424bfa7

32 files changed

+87
-138
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Please read the [*Contributing to CodeIgniter*](https://github.com/codeigniter4/
4343

4444
## Server Requirements
4545

46-
PHP version 7.2 or higher is required, with the following extensions installed:
46+
PHP version 7.3 or higher is required, with the following extensions installed:
4747

4848
- [intl](http://php.net/manual/en/intl.requirements.php)
4949
- [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\CURLRequest library

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"homepage": "https://codeigniter.com",
66
"license": "MIT",
77
"require": {
8-
"php": "^7.2 || ^8.0",
8+
"php": "^7.3||^8.0",
99
"ext-curl": "*",
1010
"ext-intl": "*",
1111
"ext-json": "*",
@@ -18,7 +18,7 @@
1818
"codeigniter4/codeigniter4-standard": "^1.0",
1919
"fakerphp/faker": "^1.9",
2020
"mikey179/vfsstream": "^1.6",
21-
"phpunit/phpunit": "^8.5",
21+
"phpunit/phpunit": "^9.1",
2222
"predis/predis": "^1.1",
2323
"squizlabs/php_codesniffer": "^3.3"
2424
},

phpunit.xml.dist

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="system/Test/bootstrap.php"
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
bootstrap="system/Test/bootstrap.php"
34
backupGlobals="false"
45
colors="true"
56
convertErrorsToExceptions="true"
@@ -8,53 +9,49 @@
89
stopOnError="false"
910
stopOnFailure="false"
1011
stopOnIncomplete="false"
11-
stopOnSkipped="false">
12+
stopOnSkipped="false"
13+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
14+
<coverage includeUncoveredFiles="true" processUncoveredFiles="true">
15+
<include>
16+
<directory suffix=".php">./app</directory>
17+
</include>
18+
<exclude>
19+
<directory suffix=".php">./app/Views</directory>
20+
<file>./app/Config/Routes.php</file>
21+
</exclude>
22+
<report>
23+
<clover outputFile="build/logs/clover.xml"/>
24+
<html outputDirectory="build/logs/html"/>
25+
<php outputFile="build/logs/coverage.serialized"/>
26+
<text outputFile="php://stdout" showUncoveredFiles="false"/>
27+
</report>
28+
</coverage>
1229
<testsuites>
1330
<testsuite name="App">
1431
<directory>./tests</directory>
1532
</testsuite>
1633
</testsuites>
17-
18-
<filter>
19-
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="true">
20-
<directory suffix=".php">./app</directory>
21-
<exclude>
22-
<directory suffix=".php">./app/Views</directory>
23-
<file>./app/Config/Routes.php</file>
24-
</exclude>
25-
</whitelist>
26-
</filter>
27-
2834
<logging>
29-
<log type="coverage-html" target="build/logs/html"/>
30-
<log type="coverage-clover" target="build/logs/clover.xml"/>
31-
<log type="coverage-php" target="build/logs/coverage.serialized"/>
32-
<log type="coverage-text" target="php://stdout" showUncoveredFiles="false"/>
33-
<log type="testdox-html" target="build/logs/testdox.html"/>
34-
<log type="testdox-text" target="build/logs/testdox.txt"/>
35-
<log type="junit" target="build/logs/logfile.xml"/>
35+
<testdoxHtml outputFile="build/logs/testdox.html"/>
36+
<testdoxText outputFile="build/logs/testdox.txt"/>
37+
<junit outputFile="build/logs/logfile.xml"/>
3638
</logging>
37-
3839
<php>
3940
<server name="app.baseURL" value="http://example.com/"/>
40-
4141
<!-- Directory containing phpunit.xml -->
4242
<const name="HOMEPATH" value="./"/>
43-
4443
<!-- Directory containing the Paths config file -->
4544
<const name="CONFIGPATH" value="./app/Config/"/>
46-
4745
<!-- Directory containing the front controller (index.php) -->
4846
<const name="PUBLICPATH" value="./public/"/>
49-
5047
<!-- Database configuration -->
51-
<!-- <env name="database.tests.hostname" value="localhost"/> -->
52-
<!-- <env name="database.tests.database" value="tests"/> -->
53-
<!-- <env name="database.tests.username" value="tests_user"/> -->
54-
<!-- <env name="database.tests.password" value=""/> -->
55-
<!-- <env name="database.tests.DBDriver" value="MySQLi"/> -->
56-
<!-- <env name="database.tests.DBPrefix" value="tests_"/> -->
57-
<env name="database.tests.database" value=":memory:"/>
58-
<env name="database.tests.DBDriver" value="SQLite3"/>
48+
<!-- Uncomment to provide your own database for testing
49+
<env name="database.tests.hostname" value="localhost"/>
50+
<env name="database.tests.database" value="tests"/>
51+
<env name="database.tests.username" value="tests_user"/>
52+
<env name="database.tests.password" value=""/>
53+
<env name="database.tests.DBDriver" value="MySQLi"/>
54+
<env name="database.tests.DBPrefix" value="tests_"/>
55+
-->
5956
</php>
6057
</phpunit>

public/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
// Valid PHP Version?
4-
$minPHPVersion = '7.2';
4+
$minPHPVersion = '7.3';
55
if (version_compare(PHP_VERSION, $minPHPVersion, '<'))
66
{
77
die("Your PHP version must be {$minPHPVersion} or higher to run CodeIgniter. Current version: " . PHP_VERSION);

system/Autoloader/Autoloader.php

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -225,16 +225,7 @@ public function loadClass(string $class)
225225
$class = trim($class, '\\');
226226
$class = str_ireplace('.php', '', $class);
227227

228-
$mapped_file = $this->loadInNamespace($class);
229-
230-
// Nothing? One last chance by looking
231-
// in common CodeIgniter folders.
232-
if (! $mapped_file)
233-
{
234-
$mapped_file = $this->loadLegacy($class);
235-
}
236-
237-
return $mapped_file;
228+
return $this->loadInNamespace($class);
238229
}
239230

240231
//--------------------------------------------------------------------
@@ -287,45 +278,6 @@ protected function loadInNamespace(string $class)
287278

288279
//--------------------------------------------------------------------
289280

290-
/**
291-
* Attempts to load the class from common locations in previous
292-
* version of CodeIgniter, namely 'app/Libraries', and
293-
* 'app/Models'.
294-
*
295-
* @param string $class The class name. This typically should NOT have a namespace.
296-
*
297-
* @return mixed The mapped file name on success, or boolean false on failure
298-
*/
299-
protected function loadLegacy(string $class)
300-
{
301-
// If there is a namespace on this class, then
302-
// we cannot load it from traditional locations.
303-
if (strpos($class, '\\') !== false)
304-
{
305-
return false;
306-
}
307-
308-
$paths = [
309-
APPPATH . 'Controllers/',
310-
APPPATH . 'Libraries/',
311-
APPPATH . 'Models/',
312-
];
313-
314-
$class = str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';
315-
316-
foreach ($paths as $path)
317-
{
318-
if ($file = $this->includeFile($path . $class))
319-
{
320-
return $file;
321-
}
322-
}
323-
324-
return false;
325-
}
326-
327-
//--------------------------------------------------------------------
328-
329281
/**
330282
* A central way to include a file. Split out primarily for testing purposes.
331283
*

system/CodeIgniter.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818
use CodeIgniter\Exceptions\PageNotFoundException;
1919
use CodeIgniter\HTTP\CLIRequest;
2020
use CodeIgniter\HTTP\DownloadResponse;
21-
use CodeIgniter\HTTP\RedirectResponse;
21+
use CodeIgniter\HTTP\IncomingRequest;
2222
use CodeIgniter\HTTP\Request;
2323
use CodeIgniter\HTTP\RequestInterface;
2424
use CodeIgniter\HTTP\ResponseInterface;
2525
use CodeIgniter\HTTP\URI;
2626
use CodeIgniter\Router\Exceptions\RedirectException;
2727
use CodeIgniter\Router\RouteCollectionInterface;
28+
use CodeIgniter\Router\Router;
2829
use Config\App;
2930
use Config\Cache;
3031
use Config\Services;
@@ -43,7 +44,7 @@ class CodeIgniter
4344
/**
4445
* The current version of CodeIgniter Framework
4546
*/
46-
const CI_VERSION = '4.0.5';
47+
const CI_VERSION = '4.1.0';
4748

4849
/**
4950
* App startup time.
@@ -76,7 +77,7 @@ class CodeIgniter
7677
/**
7778
* Current request.
7879
*
79-
* @var Request|HTTP\IncomingRequest|CLIRequest
80+
* @var Request|IncomingRequest|CLIRequest
8081
*/
8182
protected $request;
8283

@@ -90,7 +91,7 @@ class CodeIgniter
9091
/**
9192
* Router to use.
9293
*
93-
* @var Router\Router
94+
* @var Router
9495
*/
9596
protected $router;
9697

system/Commands/Server/Serve.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
*/
2424
class Serve extends BaseCommand
2525
{
26+
/**
27+
* Minimum PHP version
28+
*
29+
* @var string
30+
*/
31+
protected $minPHPVersion = '7.3';
32+
2633
/**
2734
* Group
2835
*

system/Database/BaseBuilder.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2226,8 +2226,6 @@ public function getCompiledInsert(bool $reset = true)
22262226
return $this->compileFinalQuery($sql);
22272227
}
22282228

2229-
//--------------------------------------------------------------------
2230-
22312229
/**
22322230
* Insert
22332231
*
@@ -2319,8 +2317,6 @@ protected function _insert(string $table, array $keys, array $unescapedKeys): st
23192317
return 'INSERT ' . $this->compileIgnore('insert') . 'INTO ' . $table . ' (' . implode(', ', $keys) . ') VALUES (' . implode(', ', $unescapedKeys) . ')';
23202318
}
23212319

2322-
//--------------------------------------------------------------------
2323-
23242320
/**
23252321
* Replace
23262322
*

system/Database/BaseConnection.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,8 +592,6 @@ public function addTableAlias(string $table)
592592
*/
593593
abstract protected function execute(string $sql);
594594

595-
//--------------------------------------------------------------------
596-
597595
/**
598596
* Orchestrates a query against the database. Queries must use
599597
* Database\Statement objects to store the query and build it.

system/Database/Config.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ public static function getConnections(): array
103103
return static::$instances;
104104
}
105105

106-
//--------------------------------------------------------------------
107-
108106
/**
109107
* Loads and returns an instance of the Forge for the specified
110108
* database group, and loads the group if it hasn't been loaded yet.

system/Database/Forge.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,6 @@ public function addForeignKey(string $fieldName = '', string $tableName = '', st
453453
return $this;
454454
}
455455

456-
//--------------------------------------------------------------------
457-
458456
/**
459457
* Foreign Key Drop
460458
*

system/Database/MigrationRunner.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ class MigrationRunner
119119
*/
120120
protected $groupSkip = false;
121121

122-
//--------------------------------------------------------------------
123-
124122
/**
125123
* Constructor.
126124
*

system/Database/Seeder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class Seeder
6767
/**
6868
* Faker Generator instance.
6969
*
70-
* @var \Faker\Generator|null
70+
* @var Generator|null
7171
*/
7272
private static $faker;
7373

system/Filters/CSRF.php

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

1414
use CodeIgniter\HTTP\IncomingRequest;
1515
use CodeIgniter\HTTP\RequestInterface;
16+
use CodeIgniter\HTTP\Response;
1617
use CodeIgniter\HTTP\ResponseInterface;
1718
use CodeIgniter\Security\Exceptions\SecurityException;
1819
use Config\Services;
@@ -67,12 +68,11 @@ public function before(RequestInterface $request, $arguments = null)
6768
}
6869

6970
//--------------------------------------------------------------------
70-
7171
/**
7272
* We don't have anything to do here.
7373
*
7474
* @param RequestInterface|IncomingRequest $request
75-
* @param ResponseInterface|\CodeIgniter\HTTP\Response $response
75+
* @param ResponseInterface|Response $response
7676
* @param array|null $arguments
7777
*
7878
* @return mixed

system/HTTP/DownloadResponse.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
use CodeIgniter\Exceptions\DownloadException;
1515
use CodeIgniter\Files\File;
1616
use Config\Mimes;
17-
use DateTime;
18-
use DateTimeZone;
1917

2018
/**
2119
* HTTP response when a download is requested.

system/HTTP/Files/FileCollection.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ public function all()
4747
return $this->files;
4848
}
4949

50-
//--------------------------------------------------------------------
51-
5250
/**
5351
* Attempts to get a single file from the collection of uploaded files.
5452
*
@@ -182,8 +180,6 @@ protected function populateFiles()
182180
}
183181
}
184182

185-
//--------------------------------------------------------------------
186-
187183
/**
188184
* Given a file array, will create UploadedFile instances. Will
189185
* loop over an array and create objects for each.

system/HTTP/Message.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function getBody()
5858
/**
5959
* Returns an array containing all headers.
6060
*
61-
* @return array<string,Header> An array of the request headers
61+
* @return array<string, Header> An array of the request headers
6262
*
6363
* @deprecated Use Message::headers() to make room for PSR-7
6464
*/
@@ -140,7 +140,7 @@ public function getProtocolVersion(): string
140140
*
141141
* @deprecated Use header calls directly
142142
*/
143-
public function isJSON()
143+
public function isJSON()
144144
{
145145
if (! $this->hasHeader('Content-Type'))
146146
{

system/HTTP/MessageInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function populateHeaders(): void;
4444
/**
4545
* Returns an array containing all Headers.
4646
*
47-
* @return array<string,Header> An array of the Header objects
47+
* @return array<string, Header> An array of the Header objects
4848
*/
4949
public function headers(): array;
5050

0 commit comments

Comments
 (0)