From 5771057b81521c909ab9d99454c5291315d55ee6 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 29 Nov 2022 09:21:56 +0900 Subject: [PATCH 01/11] Change min PHP version to 8.0 --- public/index.php | 2 +- spark | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/index.php b/public/index.php index 1cc4710549d5..826966179eec 100644 --- a/public/index.php +++ b/public/index.php @@ -1,7 +1,7 @@ Date: Tue, 29 Nov 2022 09:25:02 +0900 Subject: [PATCH 02/11] chore: require ^8.0 in composer.json --- admin/framework/composer.json | 2 +- admin/starter/composer.json | 2 +- composer.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/admin/framework/composer.json b/admin/framework/composer.json index f93daa275b1d..70b51ba8f88c 100644 --- a/admin/framework/composer.json +++ b/admin/framework/composer.json @@ -10,7 +10,7 @@ "slack": "https://codeigniterchat.slack.com" }, "require": { - "php": "^7.4 || ^8.0", + "php": "^8.0", "ext-intl": "*", "ext-json": "*", "ext-mbstring": "*", diff --git a/admin/starter/composer.json b/admin/starter/composer.json index 082d7b648c25..37c3e5642f29 100644 --- a/admin/starter/composer.json +++ b/admin/starter/composer.json @@ -10,7 +10,7 @@ "slack": "https://codeigniterchat.slack.com" }, "require": { - "php": "^7.4 || ^8.0", + "php": "^8.0", "codeigniter4/framework": "^4.0" }, "require-dev": { diff --git a/composer.json b/composer.json index 2258eca9ac4d..646f53d5c784 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "slack": "https://codeigniterchat.slack.com" }, "require": { - "php": "^7.4 || ^8.0", + "php": "^8.0", "ext-intl": "*", "ext-json": "*", "ext-mbstring": "*", From 6bf8cd9b8942557ddbf9b394abddf5f0ab506729 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 29 Nov 2022 09:25:55 +0900 Subject: [PATCH 03/11] chore: drop PHP 7.4 in workflows --- .github/workflows/test-coding-standards.yml | 2 +- .github/workflows/test-phpunit.yml | 6 +----- .github/workflows/test-rector.yml | 2 +- admin/starter/.github/workflows/phpunit.yml | 4 ++-- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test-coding-standards.yml b/.github/workflows/test-coding-standards.yml index 9217f48bb127..233b563297e5 100644 --- a/.github/workflows/test-coding-standards.yml +++ b/.github/workflows/test-coding-standards.yml @@ -28,8 +28,8 @@ jobs: fail-fast: false matrix: php-version: - - '7.4' - '8.0' + - '8.1' steps: - name: Checkout diff --git a/.github/workflows/test-phpunit.yml b/.github/workflows/test-phpunit.yml index 9ca4ed8e15e4..9beee1b3aa09 100644 --- a/.github/workflows/test-phpunit.yml +++ b/.github/workflows/test-phpunit.yml @@ -55,7 +55,6 @@ jobs: strategy: matrix: php-version: - - '7.4' - '8.0' - '8.1' - '8.2' @@ -85,7 +84,6 @@ jobs: fail-fast: false matrix: php-version: - - '7.4' - '8.0' - '8.1' - '8.2' @@ -99,7 +97,7 @@ jobs: mysql-version: - '5.7' include: - - php-version: '7.4' + - php-version: '8.0' db-platform: MySQLi mysql-version: '8.0' - php-version: '8.3' @@ -127,7 +125,6 @@ jobs: strategy: matrix: php-version: - - '7.4' - '8.0' - '8.1' - '8.2' @@ -156,7 +153,6 @@ jobs: strategy: matrix: php-version: - - '7.4' - '8.0' - '8.1' - '8.2' diff --git a/.github/workflows/test-rector.yml b/.github/workflows/test-rector.yml index 7912a59f5d3f..027047dc44d7 100644 --- a/.github/workflows/test-rector.yml +++ b/.github/workflows/test-rector.yml @@ -45,7 +45,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['7.4', '8.0'] + php-versions: ['8.0', '8.1'] paths: - app - system diff --git a/admin/starter/.github/workflows/phpunit.yml b/admin/starter/.github/workflows/phpunit.yml index 73d413cad92f..9b54b83b8d22 100644 --- a/admin/starter/.github/workflows/phpunit.yml +++ b/admin/starter/.github/workflows/phpunit.yml @@ -2,7 +2,7 @@ name: PHPUnit on: pull_request: - branches: + branches: - develop jobs: @@ -11,7 +11,7 @@ jobs: strategy: matrix: - php-versions: ['7.4', '8.0'] + php-versions: ['8.0', '8.1'] runs-on: ubuntu-latest From b21a63c4ae44f02f2bb55056488994cfe1a050ca Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 29 Nov 2022 09:26:53 +0900 Subject: [PATCH 04/11] docs: require min PHP version 8.0 --- README.md | 2 +- admin/framework/README.md | 2 +- admin/starter/README.md | 2 +- contributing/pull_request.md | 2 +- user_guide_src/source/installation/upgrade_4xx.rst | 2 +- user_guide_src/source/intro/requirements.rst | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1a47301b82cc..d5f8ec34dd51 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ Made with [contrib.rocks](https://contrib.rocks). ## Server Requirements -PHP version 7.4 or higher is required, with the following extensions installed: +PHP version 8.0 or higher is required, with the following extensions installed: - [intl](http://php.net/manual/en/intl.requirements.php) - [mbstring](http://php.net/manual/en/mbstring.installation.php) diff --git a/admin/framework/README.md b/admin/framework/README.md index 00cdf704c2f4..f6f81cd65184 100644 --- a/admin/framework/README.md +++ b/admin/framework/README.md @@ -42,7 +42,7 @@ Please read the [*Contributing to CodeIgniter*](https://github.com/codeigniter4/ ## Server Requirements -PHP version 7.4 or higher is required, with the following extensions installed: +PHP version 8.0 or higher is required, with the following extensions installed: - [intl](http://php.net/manual/en/intl.requirements.php) - [mbstring](http://php.net/manual/en/mbstring.installation.php) diff --git a/admin/starter/README.md b/admin/starter/README.md index 11d1cf13eec4..fc8f69b5eb1d 100644 --- a/admin/starter/README.md +++ b/admin/starter/README.md @@ -50,7 +50,7 @@ Problems with it can be raised on our forum, or as issues in the main repository ## Server Requirements -PHP version 7.4 or higher is required, with the following extensions installed: +PHP version 8.0 or higher is required, with the following extensions installed: - [intl](http://php.net/manual/en/intl.requirements.php) - [mbstring](http://php.net/manual/en/mbstring.installation.php) diff --git a/contributing/pull_request.md b/contributing/pull_request.md index 0a863fd39746..8e5a489bb519 100644 --- a/contributing/pull_request.md +++ b/contributing/pull_request.md @@ -136,7 +136,7 @@ See [Contribution CSS](./css.md). ### Compatibility -CodeIgniter4 requires [PHP 7.4](https://php.net/releases/7_4_0.php). +CodeIgniter4 requires [PHP 8.0](https://php.net/releases/8_0_0.php). ### Backwards Compatibility diff --git a/user_guide_src/source/installation/upgrade_4xx.rst b/user_guide_src/source/installation/upgrade_4xx.rst index ae645d26c1a9..f452fc247f2a 100644 --- a/user_guide_src/source/installation/upgrade_4xx.rst +++ b/user_guide_src/source/installation/upgrade_4xx.rst @@ -41,7 +41,7 @@ Downloads Namespaces ========== -- CI4 is built for PHP 7.4+, and everything in the framework is namespaced, +- CI4 is built for PHP 8.0+, and everything in the framework is namespaced, except for the helper and lang files. Application Structure diff --git a/user_guide_src/source/intro/requirements.rst b/user_guide_src/source/intro/requirements.rst index e025198a8cc0..17154a952563 100644 --- a/user_guide_src/source/intro/requirements.rst +++ b/user_guide_src/source/intro/requirements.rst @@ -10,7 +10,7 @@ Server Requirements PHP and Required Extensions *************************** -`PHP `_ version 7.4 or newer is required, with the following PHP extensions are enabled: +`PHP `_ version 8.0 or newer is required, with the following PHP extensions are enabled: - `intl `_ - `mbstring `_ From da2e62c11ee7088bbf2ac993b0ab4935444a26eb Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 29 Nov 2022 09:28:14 +0900 Subject: [PATCH 05/11] refactor: remove version check `version_compare(PHP_VERSION, '8.0.0', '>=')` --- system/Autoloader/Autoloader.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/system/Autoloader/Autoloader.php b/system/Autoloader/Autoloader.php index dcddec1d2976..a06ffc2c6252 100644 --- a/system/Autoloader/Autoloader.php +++ b/system/Autoloader/Autoloader.php @@ -343,11 +343,7 @@ public function sanitizeFilename(string $filename): string ); } if ($result === false) { - if (version_compare(PHP_VERSION, '8.0.0', '>=')) { - $message = preg_last_error_msg(); - } else { - $message = 'Regex error. error code: ' . preg_last_error(); - } + $message = preg_last_error_msg(); throw new RuntimeException($message . '. filename: "' . $filename . '"'); } From d734d9c72c290c9295d62a899a614ae10211273c Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 2 Dec 2022 08:37:36 +0900 Subject: [PATCH 06/11] docs: add changelog v4.5.0 --- user_guide_src/source/changelogs/v4.5.0.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/changelogs/v4.5.0.rst b/user_guide_src/source/changelogs/v4.5.0.rst index c999b562172f..50dae35cd5a2 100644 --- a/user_guide_src/source/changelogs/v4.5.0.rst +++ b/user_guide_src/source/changelogs/v4.5.0.rst @@ -12,6 +12,7 @@ Release Date: Unreleased Highlights ********** +- Update minimal PHP requirement to 8.0. - TBD BREAKING From 0c8727469d85aa43614518629b3e58fefe24e883 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 11 Sep 2023 16:58:55 +0900 Subject: [PATCH 07/11] chore: update php version to 8.2 --- .github/workflows/test-coding-standards.yml | 2 +- .github/workflows/test-rector.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-coding-standards.yml b/.github/workflows/test-coding-standards.yml index 233b563297e5..cd79e13b243e 100644 --- a/.github/workflows/test-coding-standards.yml +++ b/.github/workflows/test-coding-standards.yml @@ -29,7 +29,7 @@ jobs: matrix: php-version: - '8.0' - - '8.1' + - '8.2' steps: - name: Checkout diff --git a/.github/workflows/test-rector.yml b/.github/workflows/test-rector.yml index 027047dc44d7..e29ee6ba64e7 100644 --- a/.github/workflows/test-rector.yml +++ b/.github/workflows/test-rector.yml @@ -45,7 +45,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['8.0', '8.1'] + php-versions: ['8.0', '8.2'] paths: - app - system From a408c39c7c98c740672509a91ced96cd447f0ad9 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 11 Sep 2023 17:03:40 +0900 Subject: [PATCH 08/11] docs: update next minor version sample --- user_guide_src/source/installation/installing_composer.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/installation/installing_composer.rst b/user_guide_src/source/installation/installing_composer.rst index 9af6a0f0fa71..f1883b61caf3 100644 --- a/user_guide_src/source/installation/installing_composer.rst +++ b/user_guide_src/source/installation/installing_composer.rst @@ -139,11 +139,11 @@ Next Minor Version If you want to use the next minor version branch, after using the ``builds`` command edit **composer.json** manually. -If you try the ``4.4`` branch, change the version to ``4.4.x-dev``:: +If you try the ``4.6`` branch, change the version to ``4.6.x-dev``:: "require": { - "php": "^7.4 || ^8.0", - "codeigniter4/codeigniter4": "4.4.x-dev" + "php": "^8.0", + "codeigniter4/codeigniter4": "4.6.x-dev" }, And run ``composer update`` to sync your vendor From 903583674baa30b3c9d0e7d378f64475189a568f Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 11 Sep 2023 17:08:36 +0900 Subject: [PATCH 09/11] refactor: remove version check `PHP_VERSION_ID >= 80000` --- tests/system/Debug/TimerTest.php | 7 +------ tests/system/Helpers/ArrayHelperTest.php | 9 +-------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/tests/system/Debug/TimerTest.php b/tests/system/Debug/TimerTest.php index 54c9fdfccb18..2be069062d9c 100644 --- a/tests/system/Debug/TimerTest.php +++ b/tests/system/Debug/TimerTest.php @@ -13,7 +13,6 @@ use ArgumentCountError; use CodeIgniter\Test\CIUnitTestCase; -use ErrorException; use RuntimeException; /** @@ -172,11 +171,7 @@ public function testRecordThrowsException(): void public function testRecordThrowsErrorOnCallableWithParams(): void { - if (PHP_VERSION_ID >= 80000) { - $this->expectException(ArgumentCountError::class); - } else { - $this->expectException(ErrorException::class); - } + $this->expectException(ArgumentCountError::class); $timer = new Timer(); $timer->record('error', 'strlen'); diff --git a/tests/system/Helpers/ArrayHelperTest.php b/tests/system/Helpers/ArrayHelperTest.php index 4844fe84188e..2c4ce103adc9 100644 --- a/tests/system/Helpers/ArrayHelperTest.php +++ b/tests/system/Helpers/ArrayHelperTest.php @@ -12,7 +12,6 @@ namespace CodeIgniter\Helpers; use CodeIgniter\Test\CIUnitTestCase; -use ErrorException; use ValueError; /** @@ -303,13 +302,7 @@ public function testArraySortByMultipleKeysFailsEmptyParameter(array $data, arra */ public function testArraySortByMultipleKeysFailsInconsistentArraySizes($data): void { - // PHP 8 changes this error type - if (PHP_VERSION_ID >= 80000) { - $this->expectException(ValueError::class); - } else { - $this->expectException(ErrorException::class); - } - + $this->expectException(ValueError::class); $this->expectExceptionMessage('Array sizes are inconsistent'); $sortColumns = [ From fd836d8dedd003afe99b8c163ec1043341bfb947 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 13 Sep 2023 12:18:01 +0900 Subject: [PATCH 10/11] chore: update php version Co-authored-by: MGatner --- admin/starter/.github/workflows/phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/starter/.github/workflows/phpunit.yml b/admin/starter/.github/workflows/phpunit.yml index 9b54b83b8d22..0489a9376466 100644 --- a/admin/starter/.github/workflows/phpunit.yml +++ b/admin/starter/.github/workflows/phpunit.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - php-versions: ['8.0', '8.1'] + php-versions: ['8.0', '8.2'] runs-on: ubuntu-latest From 83865ae34b26eb4e5bc52ad11215c2dbcb2db108 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 17 Sep 2023 09:10:54 +0900 Subject: [PATCH 11/11] chore: remove PHP version checks --- .php-cs-fixer.dist.php | 13 +++++-------- .php-cs-fixer.no-header.php | 13 +++++-------- .php-cs-fixer.user-guide.php | 13 +++++-------- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 8c2a6b8b7a52..d4d3798ca1cf 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -80,13 +80,10 @@ 'admin@codeigniter.com' ); -// @TODO: remove this check when support for PHP 7.4 is dropped -if (PHP_VERSION_ID >= 80000) { - $config - ->registerCustomFixers(FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer')) - ->setRules(array_merge($config->getRules(), [ - NoCodeSeparatorCommentFixer::name() => true, - ])); -} +$config + ->registerCustomFixers(FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer')) + ->setRules(array_merge($config->getRules(), [ + NoCodeSeparatorCommentFixer::name() => true, + ])); return $config; diff --git a/.php-cs-fixer.no-header.php b/.php-cs-fixer.no-header.php index 5fb4ce95bfbe..0b75ff6bfd3f 100644 --- a/.php-cs-fixer.no-header.php +++ b/.php-cs-fixer.no-header.php @@ -62,13 +62,10 @@ $config = Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects(); -// @TODO: remove this check when support for PHP 7.4 is dropped -if (PHP_VERSION_ID >= 80000) { - $config - ->registerCustomFixers(FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer')) - ->setRules(array_merge($config->getRules(), [ - NoCodeSeparatorCommentFixer::name() => true, - ])); -} +$config + ->registerCustomFixers(FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer')) + ->setRules(array_merge($config->getRules(), [ + NoCodeSeparatorCommentFixer::name() => true, + ])); return $config; diff --git a/.php-cs-fixer.user-guide.php b/.php-cs-fixer.user-guide.php index cf344d903ad5..af7e896fcecd 100644 --- a/.php-cs-fixer.user-guide.php +++ b/.php-cs-fixer.user-guide.php @@ -67,13 +67,10 @@ $config = Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects(); -// @TODO: remove this check when support for PHP 7.4 is dropped -if (PHP_VERSION_ID >= 80000) { - $config - ->registerCustomFixers(FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer')) - ->setRules(array_merge($config->getRules(), [ - NoCodeSeparatorCommentFixer::name() => true, - ])); -} +$config + ->registerCustomFixers(FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer')) + ->setRules(array_merge($config->getRules(), [ + NoCodeSeparatorCommentFixer::name() => true, + ])); return $config;