Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop PHP 7.4 support #7924

Merged
merged 11 commits into from
Sep 23, 2023
Merged
2 changes: 1 addition & 1 deletion .github/workflows/test-coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
fail-fast: false
matrix:
php-version:
- '7.4'
- '8.0'
- '8.2'

steps:
- name: Checkout
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/test-phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ jobs:
strategy:
matrix:
php-version:
- '7.4'
- '8.0'
- '8.1'
- '8.2'
Expand Down Expand Up @@ -85,7 +84,6 @@ jobs:
fail-fast: false
matrix:
php-version:
- '7.4'
- '8.0'
- '8.1'
- '8.2'
Expand All @@ -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'
Expand Down Expand Up @@ -127,7 +125,6 @@ jobs:
strategy:
matrix:
php-version:
- '7.4'
- '8.0'
- '8.1'
- '8.2'
Expand Down Expand Up @@ -156,7 +153,6 @@ jobs:
strategy:
matrix:
php-version:
- '7.4'
- '8.0'
- '8.1'
- '8.2'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['7.4', '8.0']
php-versions: ['8.0', '8.2']
kenjis marked this conversation as resolved.
Show resolved Hide resolved
paths:
- app
- system
Expand Down
13 changes: 5 additions & 8 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
13 changes: 5 additions & 8 deletions .php-cs-fixer.no-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
13 changes: 5 additions & 8 deletions .php-cs-fixer.user-guide.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion admin/framework/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion admin/framework/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"slack": "https://codeigniterchat.slack.com"
},
"require": {
"php": "^7.4 || ^8.0",
"php": "^8.0",
"ext-intl": "*",
"ext-json": "*",
"ext-mbstring": "*",
Expand Down
4 changes: 2 additions & 2 deletions admin/starter/.github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: PHPUnit

on:
pull_request:
branches:
branches:
- develop

jobs:
Expand All @@ -11,7 +11,7 @@ jobs:

strategy:
matrix:
php-versions: ['7.4', '8.0']
php-versions: ['8.0', '8.2']

runs-on: ubuntu-latest

Expand Down
2 changes: 1 addition & 1 deletion admin/starter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion admin/starter/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"slack": "https://codeigniterchat.slack.com"
},
"require": {
"php": "^7.4 || ^8.0",
"php": "^8.0",
"codeigniter4/framework": "^4.0"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"slack": "https://codeigniterchat.slack.com"
},
"require": {
"php": "^7.4 || ^8.0",
"php": "^8.0",
"ext-intl": "*",
"ext-json": "*",
"ext-mbstring": "*",
Expand Down
2 changes: 1 addition & 1 deletion contributing/pull_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion public/index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

// Check PHP version.
$minPhpVersion = '7.4'; // If you update this, don't forget to update `spark`.
$minPhpVersion = '8.0'; // If you update this, don't forget to update `spark`.
if (version_compare(PHP_VERSION, $minPhpVersion, '<')) {
$message = sprintf(
'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s',
Expand Down
2 changes: 1 addition & 1 deletion spark
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (strpos(PHP_SAPI, 'cgi') === 0) {
}

// Check PHP version.
$minPhpVersion = '7.4'; // If you update this, don't forget to update `public/index.php`.
$minPhpVersion = '8.0'; // If you update this, don't forget to update `public/index.php`.
if (version_compare(PHP_VERSION, $minPhpVersion, '<')) {
$message = sprintf(
'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s',
Expand Down
6 changes: 1 addition & 5 deletions system/Autoloader/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 . '"');
}
Expand Down
7 changes: 1 addition & 6 deletions tests/system/Debug/TimerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

use ArgumentCountError;
use CodeIgniter\Test\CIUnitTestCase;
use ErrorException;
use RuntimeException;

/**
Expand Down Expand Up @@ -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');
Expand Down
9 changes: 1 addition & 8 deletions tests/system/Helpers/ArrayHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace CodeIgniter\Helpers;

use CodeIgniter\Test\CIUnitTestCase;
use ErrorException;
use ValueError;

/**
Expand Down Expand Up @@ -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 = [
Expand Down
1 change: 1 addition & 0 deletions user_guide_src/source/changelogs/v4.5.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Release Date: Unreleased
Highlights
**********

- Update minimal PHP requirement to 8.0.
- TBD

BREAKING
Expand Down
6 changes: 3 additions & 3 deletions user_guide_src/source/installation/installing_composer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion user_guide_src/source/installation/upgrade_4xx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion user_guide_src/source/intro/requirements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Server Requirements
PHP and Required Extensions
***************************

`PHP <https://www.php.net/>`_ version 7.4 or newer is required, with the following PHP extensions are enabled:
`PHP <https://www.php.net/>`_ version 8.0 or newer is required, with the following PHP extensions are enabled:

- `intl <https://www.php.net/manual/en/intl.requirements.php>`_
- `mbstring <https://www.php.net/manual/en/mbstring.requirements.php>`_
Expand Down
Loading