Skip to content

Commit 7d15d40

Browse files
authored
Merge pull request #2614 from WordPress/feature/2606-drop-support-for-php-lt-7.2
Drop support for PHP < 7.2
2 parents 5c819af + 781bb22 commit 7d15d40

File tree

10 files changed

+19
-47
lines changed

10 files changed

+19
-47
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ When you introduce new `public` sniff properties, or your sniff extends a class
6565
* PHP_CodeSniffer 3.13.0 or higher
6666
* PHPCSUtils 1.1.0 or higher
6767
* PHPCSExtra 1.4.0 or higher
68-
* PHPUnit 4.x - 9.x
68+
* PHPUnit 8.x - 9.x
6969

7070
The WordPress Coding Standards use the `PHP_CodeSniffer` native unit test framework for unit testing the sniffs.
7171

.github/workflows/quicktest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
runs-on: ubuntu-latest
2424
strategy:
2525
matrix:
26-
php: [ '5.4', 'latest' ]
26+
php: [ '7.2', 'latest' ]
2727
dependencies: [ 'lowest', 'stable' ]
2828

2929
name: QTest - PHP ${{ matrix.php }} on PHPCS ${{ matrix.dependencies }}

.github/workflows/unit-tests.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,18 @@ jobs:
2626
runs-on: ubuntu-latest
2727
strategy:
2828
matrix:
29-
php: [ '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.5' ]
29+
php: [ '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.5' ]
3030
dependencies: [ 'lowest', 'stable' ]
3131
extensions: [ '' ]
3232
coverage: [false]
3333

3434
include:
35-
- php: '7.2'
36-
dependencies: 'stable'
37-
extensions: ':mbstring' # = Disable Mbstring.
38-
coverage: true # Make sure coverage is recorded for this too.
39-
4035
# Run code coverage builds against high/low PHP and high/low PHPCS.
41-
- php: '5.4'
36+
- php: '7.2'
4237
dependencies: 'stable'
4338
extensions: ''
4439
coverage: true
45-
- php: '5.4'
40+
- php: '7.2'
4641
dependencies: 'lowest'
4742
extensions: ''
4843
coverage: true
@@ -56,15 +51,11 @@ jobs:
5651
coverage: true
5752

5853
# Test against dev versions of all dependencies with select PHP versions for early detection of issues.
59-
- php: '5.4'
60-
dependencies: 'dev'
61-
extensions: ''
62-
coverage: false
63-
- php: '7.0'
54+
- php: '7.2'
6455
dependencies: 'dev'
6556
extensions: ''
6657
coverage: false
67-
- php: '7.4'
58+
- php: '8.1'
6859
dependencies: 'dev'
6960
extensions: ''
7061
coverage: false

.phpcs.xml.dist

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,13 @@
5050

5151
<!-- Linting is done in a separate CI job, no need to duplicate it. -->
5252
<exclude name="Generic.PHP.Syntax"/>
53-
54-
<!-- WordPressCS still has a PHP 5.4 minimum. -->
55-
<exclude name="Modernize.FunctionCalls.Dirname"/>
5653
</rule>
5754

5855
<!-- Check code for cross-version PHP compatibility. -->
59-
<config name="testVersion" value="5.4-"/>
56+
<config name="testVersion" value="7.2-"/>
6057
<rule ref="PHPCompatibility">
6158
<!-- Exclude PHP constants back-filled by PHPCS. -->
62-
<exclude name="PHPCompatibility.Constants.NewConstants.t_finallyFound"/>
63-
<exclude name="PHPCompatibility.Constants.NewConstants.t_yieldFound"/>
64-
<exclude name="PHPCompatibility.Constants.NewConstants.t_ellipsisFound"/>
65-
<exclude name="PHPCompatibility.Constants.NewConstants.t_powFound"/>
66-
<exclude name="PHPCompatibility.Constants.NewConstants.t_pow_equalFound"/>
67-
<exclude name="PHPCompatibility.Constants.NewConstants.t_spaceshipFound"/>
68-
<exclude name="PHPCompatibility.Constants.NewConstants.t_coalesceFound"/>
6959
<exclude name="PHPCompatibility.Constants.NewConstants.t_coalesce_equalFound"/>
70-
<exclude name="PHPCompatibility.Constants.NewConstants.t_yield_fromFound"/>
7160
<exclude name="PHPCompatibility.Constants.NewConstants.t_readonlyFound"/>
7261
</rule>
7362

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
[![codecov.io](https://codecov.io/gh/WordPress/WordPress-Coding-Standards/graph/badge.svg?token=UzFYn0RzVG&branch=develop)](https://codecov.io/gh/WordPress/WordPress-Coding-Standards?branch=develop)
1111

1212
[![Minimum PHP Version](https://img.shields.io/packagist/php-v/wp-coding-standards/wpcs.svg?maxAge=3600)](https://packagist.org/packages/wp-coding-standards/wpcs)
13-
[![Tested on PHP 5.4 to 8.4](https://img.shields.io/badge/tested%20on-PHP%205.4%20|%205.5%20|%205.6%20|%207.0%20|%207.1%20|%207.2%20|%207.3%20|%207.4%20|%208.0%20|%208.1%20|%208.2%20|%208.3%20|%208.4-green.svg?maxAge=2419200)](https://github.com/WordPress/WordPress-Coding-Standards/actions/workflows/unit-tests.yml)
13+
[![Tested on PHP 7.2 to 8.4](https://img.shields.io/badge/tested%20on-PHP%207.2%20|%207.3%20|%207.4%20|%208.0%20|%208.1%20|%208.2%20|%208.3%20|%208.4-green.svg?maxAge=2419200)](https://github.com/WordPress/WordPress-Coding-Standards/actions/workflows/unit-tests.yml)
1414

1515
[![License: MIT](https://poser.pugx.org/wp-coding-standards/wpcs/license)](https://github.com/WordPress/WordPress-Coding-Standards/blob/develop/LICENSE)
1616
[![Total Downloads](https://poser.pugx.org/wp-coding-standards/wpcs/downloads)](https://packagist.org/packages/wp-coding-standards/wpcs/stats)
@@ -53,7 +53,7 @@ This project is a collection of [PHP_CodeSniffer](https://github.com/PHPCSStanda
5353
## Minimum Requirements
5454

5555
The WordPress Coding Standards package requires:
56-
* PHP 5.4 or higher with the following extensions enabled:
56+
* PHP 7.2 or higher with the following extensions enabled:
5757
- [Filter](https://www.php.net/book.filter)
5858
- [libxml](https://www.php.net/book.libxml)
5959
- [Tokenizer](https://www.php.net/book.tokenizer)

WordPress/Tests/DB/RestrictedClassesUnitTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@ final class RestrictedClassesUnitTest extends AbstractSniffUnitTest {
3232
* Note: as that class extends the abstract FunctionRestrictions class, that's
3333
* where we are passing the parameters to.
3434
*
35-
* @before
36-
*
3735
* @return void
3836
*/
39-
protected function enhanceGroups() {
37+
protected function setUp(): void {
38+
parent::setUp();
4039
AbstractFunctionRestrictionsSniff::$unittest_groups = array(
4140
'test' => array(
4241
'type' => 'error',
@@ -52,11 +51,9 @@ protected function enhanceGroups() {
5251
/**
5352
* Reset the $groups property.
5453
*
55-
* @after
56-
*
5754
* @return void
5855
*/
59-
protected function resetGroups() {
56+
protected function tearDown(): void {
6057
AbstractFunctionRestrictionsSniff::$unittest_groups = array();
6158
parent::tearDown();
6259
}

WordPress/Tests/DB/RestrictedFunctionsUnitTest.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,10 @@ final class RestrictedFunctionsUnitTest extends AbstractSniffUnitTest {
2727
* Add a number of extra restricted functions to unit test the abstract
2828
* AbstractFunctionRestrictionsSniff class.
2929
*
30-
* @before
31-
*
3230
* @return void
3331
*/
34-
protected function enhanceGroups() {
32+
protected function setUp(): void {
3533
parent::setUp();
36-
3734
AbstractFunctionRestrictionsSniff::$unittest_groups = array(
3835
'test-empty-functions-array' => array(
3936
'type' => 'error',
@@ -52,11 +49,9 @@ protected function enhanceGroups() {
5249
/**
5350
* Reset the $groups property.
5451
*
55-
* @after
56-
*
5752
* @return void
5853
*/
59-
protected function resetGroups() {
54+
protected function tearDown(): void {
6055
AbstractFunctionRestrictionsSniff::$unittest_groups = array();
6156
parent::tearDown();
6257
}

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717
],
1818
"require": {
19-
"php": ">=5.4",
19+
"php": ">=7.2",
2020
"ext-filter": "*",
2121
"ext-libxml": "*",
2222
"ext-tokenizer": "*",
@@ -27,7 +27,7 @@
2727
},
2828
"require-dev": {
2929
"phpcompatibility/php-compatibility": "^9.0",
30-
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0",
30+
"phpunit/phpunit": "^8.0 || ^9.0",
3131
"phpcsstandards/phpcsdevtools": "^1.2.0",
3232
"php-parallel-lint/php-parallel-lint": "^1.4.0",
3333
"php-parallel-lint/php-console-highlighter": "^1.0.0"

phpstan.neon.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
parameters:
2-
phpVersion: 70100 # Needs to be 70100 or higher... sigh...
2+
phpVersion: 70200
33
level: 5
44
paths:
55
- WordPress

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.3/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd"
55
backupGlobals="true"
66
bootstrap="./Tests/bootstrap.php"
77
convertErrorsToExceptions="true"

0 commit comments

Comments
 (0)