diff --git a/README.md b/README.md index 6692596..3dcd3b5 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ ## Server Requirements -PHP version 7.2 or higher is required, with the following extensions installed: +PHP version 7.3 or higher is required, with the following extensions installed: - [intl](http://php.net/manual/en/intl.requirements.php) - [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\CURLRequest library diff --git a/composer.json b/composer.json index df3468d..e5e8848 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "homepage": "https://codeigniter.com", "license": "MIT", "require": { - "php": "^7.2 || ^8.0", + "php": "^7.3||^8.0", "ext-curl": "*", "ext-intl": "*", "ext-json": "*", @@ -18,7 +18,7 @@ "codeigniter4/codeigniter4-standard": "^1.0", "fakerphp/faker": "^1.9", "mikey179/vfsstream": "^1.6", - "phpunit/phpunit": "^8.5", + "phpunit/phpunit": "^9.1", "predis/predis": "^1.1", "squizlabs/php_codesniffer": "^3.3" }, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 446ae80..51c5fdd 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,5 +1,6 @@ - + stopOnSkipped="false" + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> + + + ./app + + + ./app/Views + ./app/Config/Routes.php + + + + + + + + ./tests - - - - ./app - - ./app/Views - ./app/Config/Routes.php - - - - - - - - - - - + + + - - - - - - - - - - - - - + diff --git a/public/index.php b/public/index.php index 127780d..5cea047 100644 --- a/public/index.php +++ b/public/index.php @@ -1,7 +1,7 @@ loadInNamespace($class); - - // Nothing? One last chance by looking - // in common CodeIgniter folders. - if (! $mapped_file) - { - $mapped_file = $this->loadLegacy($class); - } - - return $mapped_file; + return $this->loadInNamespace($class); } //-------------------------------------------------------------------- @@ -288,45 +279,6 @@ //-------------------------------------------------------------------- /** - * Attempts to load the class from common locations in previous - * version of CodeIgniter, namely 'app/Libraries', and - * 'app/Models'. - * - * @param string $class The class name. This typically should NOT have a namespace. - * - * @return mixed The mapped file name on success, or boolean false on failure - */ - protected function loadLegacy(string $class) - { - // If there is a namespace on this class, then - // we cannot load it from traditional locations. - if (strpos($class, '\\') !== false) - { - return false; - } - - $paths = [ - APPPATH . 'Controllers/', - APPPATH . 'Libraries/', - APPPATH . 'Models/', - ]; - - $class = str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php'; - - foreach ($paths as $path) - { - if ($file = $this->includeFile($path . $class)) - { - return $file; - } - } - - return false; - } - - //-------------------------------------------------------------------- - - /** * A central way to include a file. Split out primarily for testing purposes. * * @param string $file diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index d50f96c..ae4b4eb 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -18,13 +18,14 @@ use CodeIgniter\Exceptions\PageNotFoundException; use CodeIgniter\HTTP\CLIRequest; use CodeIgniter\HTTP\DownloadResponse; -use CodeIgniter\HTTP\RedirectResponse; +use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\Request; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\URI; use CodeIgniter\Router\Exceptions\RedirectException; use CodeIgniter\Router\RouteCollectionInterface; +use CodeIgniter\Router\Router; use Config\App; use Config\Cache; use Config\Services; @@ -43,7 +44,7 @@ /** * The current version of CodeIgniter Framework */ - const CI_VERSION = '4.0.5'; + const CI_VERSION = '4.1.0'; /** * App startup time. @@ -76,7 +77,7 @@ /** * Current request. * - * @var Request|HTTP\IncomingRequest|CLIRequest + * @var Request|IncomingRequest|CLIRequest */ protected $request; @@ -90,7 +91,7 @@ /** * Router to use. * - * @var Router\Router + * @var Router */ protected $router; diff --git a/system/Commands/Server/Serve.php b/system/Commands/Server/Serve.php index 034957c..cbcda32 100644 --- a/system/Commands/Server/Serve.php +++ b/system/Commands/Server/Serve.php @@ -24,6 +24,13 @@ class Serve extends BaseCommand { /** + * Minimum PHP version + * + * @var string + */ + protected $minPHPVersion = '7.3'; + + /** * Group * * @var string diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index 2eb2ab4..003d56f 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -2226,8 +2226,6 @@ return $this->compileFinalQuery($sql); } - //-------------------------------------------------------------------- - /** * Insert * @@ -2319,8 +2317,6 @@ return 'INSERT ' . $this->compileIgnore('insert') . 'INTO ' . $table . ' (' . implode(', ', $keys) . ') VALUES (' . implode(', ', $unescapedKeys) . ')'; } - //-------------------------------------------------------------------- - /** * Replace * diff --git a/system/Database/BaseConnection.php b/system/Database/BaseConnection.php index ddd3189..e5a312a 100644 --- a/system/Database/BaseConnection.php +++ b/system/Database/BaseConnection.php @@ -592,8 +592,6 @@ */ abstract protected function execute(string $sql); - //-------------------------------------------------------------------- - /** * Orchestrates a query against the database. Queries must use * Database\Statement objects to store the query and build it. diff --git a/system/Database/Config.php b/system/Database/Config.php index 0b11785..0b658f5 100644 --- a/system/Database/Config.php +++ b/system/Database/Config.php @@ -103,8 +103,6 @@ return static::$instances; } - //-------------------------------------------------------------------- - /** * Loads and returns an instance of the Forge for the specified * database group, and loads the group if it hasn't been loaded yet. diff --git a/system/Database/Forge.php b/system/Database/Forge.php index c986bbc..44488a5 100644 --- a/system/Database/Forge.php +++ b/system/Database/Forge.php @@ -453,8 +453,6 @@ return $this; } - //-------------------------------------------------------------------- - /** * Foreign Key Drop * diff --git a/system/Database/MigrationRunner.php b/system/Database/MigrationRunner.php index 4bce96a..eeb204f 100644 --- a/system/Database/MigrationRunner.php +++ b/system/Database/MigrationRunner.php @@ -119,8 +119,6 @@ */ protected $groupSkip = false; - //-------------------------------------------------------------------- - /** * Constructor. * diff --git a/system/Database/Seeder.php b/system/Database/Seeder.php index e8e56e1..4e9b2a7 100644 --- a/system/Database/Seeder.php +++ b/system/Database/Seeder.php @@ -67,7 +67,7 @@ /** * Faker Generator instance. * - * @var \Faker\Generator|null + * @var Generator|null */ private static $faker; diff --git a/system/Filters/CSRF.php b/system/Filters/CSRF.php index 4d767f7..254d1f8 100644 --- a/system/Filters/CSRF.php +++ b/system/Filters/CSRF.php @@ -13,6 +13,7 @@ use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\RequestInterface; +use CodeIgniter\HTTP\Response; use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\Security\Exceptions\SecurityException; use Config\Services; @@ -67,12 +68,11 @@ } //-------------------------------------------------------------------- - /** * We don't have anything to do here. * * @param RequestInterface|IncomingRequest $request - * @param ResponseInterface|\CodeIgniter\HTTP\Response $response + * @param ResponseInterface|Response $response * @param array|null $arguments * * @return mixed diff --git a/system/HTTP/DownloadResponse.php b/system/HTTP/DownloadResponse.php index b2df5f7..5787772 100644 --- a/system/HTTP/DownloadResponse.php +++ b/system/HTTP/DownloadResponse.php @@ -14,8 +14,6 @@ use CodeIgniter\Exceptions\DownloadException; use CodeIgniter\Files\File; use Config\Mimes; -use DateTime; -use DateTimeZone; /** * HTTP response when a download is requested. diff --git a/system/HTTP/Files/FileCollection.php b/system/HTTP/Files/FileCollection.php index 1a9a845..f5cb9de 100644 --- a/system/HTTP/Files/FileCollection.php +++ b/system/HTTP/Files/FileCollection.php @@ -47,8 +47,6 @@ return $this->files; } - //-------------------------------------------------------------------- - /** * Attempts to get a single file from the collection of uploaded files. * @@ -182,8 +180,6 @@ } } - //-------------------------------------------------------------------- - /** * Given a file array, will create UploadedFile instances. Will * loop over an array and create objects for each. diff --git a/system/HTTP/Message.php b/system/HTTP/Message.php index d5bd9f2..93dbe3f 100644 --- a/system/HTTP/Message.php +++ b/system/HTTP/Message.php @@ -58,7 +58,7 @@ /** * Returns an array containing all headers. * - * @return array An array of the request headers + * @return array An array of the request headers * * @deprecated Use Message::headers() to make room for PSR-7 */ @@ -140,7 +140,7 @@ * * @deprecated Use header calls directly */ - public function isJSON() + public function isJSON() { if (! $this->hasHeader('Content-Type')) { diff --git a/system/HTTP/MessageInterface.php b/system/HTTP/MessageInterface.php index ed7c541..982e3ca 100644 --- a/system/HTTP/MessageInterface.php +++ b/system/HTTP/MessageInterface.php @@ -44,7 +44,7 @@ /** * Returns an array containing all Headers. * - * @return array An array of the Header objects + * @return array An array of the Header objects */ public function headers(): array; diff --git a/system/HTTP/MessageTrait.php b/system/HTTP/MessageTrait.php index 3e214dc..4bc6683 100644 --- a/system/HTTP/MessageTrait.php +++ b/system/HTTP/MessageTrait.php @@ -25,7 +25,7 @@ /** * List of all HTTP request headers. * - * @var array + * @var array */ protected $headers = []; @@ -105,7 +105,7 @@ /** * Returns an array containing all Headers. * - * @return array An array of the Header objects + * @return array An array of the Header objects */ public function headers(): array { diff --git a/system/Helpers/url_helper.php b/system/Helpers/url_helper.php index ebaebba..1671095 100644 --- a/system/Helpers/url_helper.php +++ b/system/Helpers/url_helper.php @@ -132,7 +132,7 @@ * * @param boolean $returnObject True to return an object instead of a strong * - * @return string|\CodeIgniter\HTTP\URI + * @return string|URI */ function current_url(bool $returnObject = false) { @@ -212,7 +212,7 @@ * * Returns the "index_page" from your config file * - * @param \Config\App|null $altConfig Alternate configuration to use + * @param App|null $altConfig Alternate configuration to use * @return string */ function index_page(App $altConfig = null): string diff --git a/system/Pager/Pager.php b/system/Pager/Pager.php index 52aa9eb..3220d12 100644 --- a/system/Pager/Pager.php +++ b/system/Pager/Pager.php @@ -12,6 +12,7 @@ namespace CodeIgniter\Pager; use CodeIgniter\HTTP\Exceptions\HTTPException; +use CodeIgniter\HTTP\URI; use CodeIgniter\Pager\Exceptions\PagerException; use CodeIgniter\View\RendererInterface; use Config\Pager as PagerConfig; @@ -335,7 +336,6 @@ } //-------------------------------------------------------------------- - /** * Returns the URI for a specific page for the specified group. * @@ -343,14 +343,14 @@ * @param string $group * @param boolean $returnObject * - * @return string|\CodeIgniter\HTTP\URI + * @return string|URI */ public function getPageURI(int $page = null, string $group = 'default', bool $returnObject = false) { $this->ensureGroup($group); /** - * @var \CodeIgniter\HTTP\URI $uri + * @var URI $uri */ $uri = $this->groups[$group]['uri']; diff --git a/system/Pager/PagerInterface.php b/system/Pager/PagerInterface.php index 6840651..0b06ef8 100644 --- a/system/Pager/PagerInterface.php +++ b/system/Pager/PagerInterface.php @@ -11,6 +11,8 @@ namespace CodeIgniter\Pager; +use CodeIgniter\HTTP\URI; + /** * Expected behavior for a Pager */ @@ -103,7 +105,6 @@ public function getCurrentPage(string $group = 'default'): int; //-------------------------------------------------------------------- - /** * Returns the URI for a specific page for the specified group. * @@ -111,7 +112,7 @@ * @param string $group * @param boolean $returnObject * - * @return string|\CodeIgniter\HTTP\URI + * @return string|URI */ public function getPageURI(int $page = null, string $group = 'default', bool $returnObject = false); diff --git a/system/Pager/PagerRenderer.php b/system/Pager/PagerRenderer.php index 98a91c6..b0ba80b 100644 --- a/system/Pager/PagerRenderer.php +++ b/system/Pager/PagerRenderer.php @@ -11,6 +11,8 @@ namespace CodeIgniter\Pager; +use CodeIgniter\HTTP\URI; + /** * Class PagerRenderer * @@ -58,7 +60,7 @@ /** * URI base for pagination links * - * @var \CodeIgniter\HTTP\URI + * @var URI */ protected $uri; diff --git a/system/Pager/Views/default_full.php b/system/Pager/Views/default_full.php index ef446e9..0001143 100644 --- a/system/Pager/Views/default_full.php +++ b/system/Pager/Views/default_full.php @@ -1,9 +1,10 @@ setSurroundCount(2); ?> diff --git a/system/Pager/Views/default_head.php b/system/Pager/Views/default_head.php index 4f91601..edeb092 100644 --- a/system/Pager/Views/default_head.php +++ b/system/Pager/Views/default_head.php @@ -9,8 +9,10 @@ * file that was distributed with this source code. */ -/** - * @var \CodeIgniter\Pager\PagerRenderer $pager +use CodeIgniter\Pager\PagerRenderer; + + /** + * @var PagerRenderer $pager */ $pager->setSurroundCount(0); diff --git a/system/Pager/Views/default_simple.php b/system/Pager/Views/default_simple.php index 3bfa8d9..fc00ce8 100644 --- a/system/Pager/Views/default_simple.php +++ b/system/Pager/Views/default_simple.php @@ -1,8 +1,10 @@ setSurroundCount(0); ?>