diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 93a23e59b1..53bdd051fd 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -65,7 +65,7 @@ When you introduce new `public` sniff properties, or your sniff extends a class
* PHP_CodeSniffer 3.13.0 or higher
* PHPCSUtils 1.1.0 or higher
* PHPCSExtra 1.4.0 or higher
-* PHPUnit 4.x - 9.x
+* PHPUnit 8.x - 9.x
The WordPress Coding Standards use the `PHP_CodeSniffer` native unit test framework for unit testing the sniffs.
diff --git a/.github/workflows/quicktest.yml b/.github/workflows/quicktest.yml
index 355bd3208b..e777483c59 100644
--- a/.github/workflows/quicktest.yml
+++ b/.github/workflows/quicktest.yml
@@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- php: [ '5.4', 'latest' ]
+ php: [ '7.2', 'latest' ]
dependencies: [ 'lowest', 'stable' ]
name: QTest - PHP ${{ matrix.php }} on PHPCS ${{ matrix.dependencies }}
diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml
index 33d5e713f0..9eefe81bd2 100644
--- a/.github/workflows/unit-tests.yml
+++ b/.github/workflows/unit-tests.yml
@@ -26,23 +26,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- 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' ]
+ php: [ '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.5' ]
dependencies: [ 'lowest', 'stable' ]
extensions: [ '' ]
coverage: [false]
include:
- - php: '7.2'
- dependencies: 'stable'
- extensions: ':mbstring' # = Disable Mbstring.
- coverage: true # Make sure coverage is recorded for this too.
-
# Run code coverage builds against high/low PHP and high/low PHPCS.
- - php: '5.4'
+ - php: '7.2'
dependencies: 'stable'
extensions: ''
coverage: true
- - php: '5.4'
+ - php: '7.2'
dependencies: 'lowest'
extensions: ''
coverage: true
@@ -56,15 +51,11 @@ jobs:
coverage: true
# Test against dev versions of all dependencies with select PHP versions for early detection of issues.
- - php: '5.4'
- dependencies: 'dev'
- extensions: ''
- coverage: false
- - php: '7.0'
+ - php: '7.2'
dependencies: 'dev'
extensions: ''
coverage: false
- - php: '7.4'
+ - php: '8.1'
dependencies: 'dev'
extensions: ''
coverage: false
diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist
index bc350b7977..ed1ea01065 100644
--- a/.phpcs.xml.dist
+++ b/.phpcs.xml.dist
@@ -50,24 +50,13 @@
-
-
-
-
+
-
-
-
-
-
-
-
-
diff --git a/README.md b/README.md
index eeb99a1422..02fef784bd 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@
[](https://codecov.io/gh/WordPress/WordPress-Coding-Standards?branch=develop)
[](https://packagist.org/packages/wp-coding-standards/wpcs)
-[](https://github.com/WordPress/WordPress-Coding-Standards/actions/workflows/unit-tests.yml)
+[](https://github.com/WordPress/WordPress-Coding-Standards/actions/workflows/unit-tests.yml)
[](https://github.com/WordPress/WordPress-Coding-Standards/blob/develop/LICENSE)
[](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
## Minimum Requirements
The WordPress Coding Standards package requires:
-* PHP 5.4 or higher with the following extensions enabled:
+* PHP 7.2 or higher with the following extensions enabled:
- [Filter](https://www.php.net/book.filter)
- [libxml](https://www.php.net/book.libxml)
- [Tokenizer](https://www.php.net/book.tokenizer)
diff --git a/WordPress/Tests/DB/RestrictedClassesUnitTest.php b/WordPress/Tests/DB/RestrictedClassesUnitTest.php
index dab29264cf..a07ace04d8 100644
--- a/WordPress/Tests/DB/RestrictedClassesUnitTest.php
+++ b/WordPress/Tests/DB/RestrictedClassesUnitTest.php
@@ -32,11 +32,10 @@ final class RestrictedClassesUnitTest extends AbstractSniffUnitTest {
* Note: as that class extends the abstract FunctionRestrictions class, that's
* where we are passing the parameters to.
*
- * @before
- *
* @return void
*/
- protected function enhanceGroups() {
+ protected function setUp(): void {
+ parent::setUp();
AbstractFunctionRestrictionsSniff::$unittest_groups = array(
'test' => array(
'type' => 'error',
@@ -52,11 +51,9 @@ protected function enhanceGroups() {
/**
* Reset the $groups property.
*
- * @after
- *
* @return void
*/
- protected function resetGroups() {
+ protected function tearDown(): void {
AbstractFunctionRestrictionsSniff::$unittest_groups = array();
parent::tearDown();
}
diff --git a/WordPress/Tests/DB/RestrictedFunctionsUnitTest.php b/WordPress/Tests/DB/RestrictedFunctionsUnitTest.php
index 73702af626..ad17fc9e67 100644
--- a/WordPress/Tests/DB/RestrictedFunctionsUnitTest.php
+++ b/WordPress/Tests/DB/RestrictedFunctionsUnitTest.php
@@ -27,13 +27,10 @@ final class RestrictedFunctionsUnitTest extends AbstractSniffUnitTest {
* Add a number of extra restricted functions to unit test the abstract
* AbstractFunctionRestrictionsSniff class.
*
- * @before
- *
* @return void
*/
- protected function enhanceGroups() {
+ protected function setUp(): void {
parent::setUp();
-
AbstractFunctionRestrictionsSniff::$unittest_groups = array(
'test-empty-functions-array' => array(
'type' => 'error',
@@ -52,11 +49,9 @@ protected function enhanceGroups() {
/**
* Reset the $groups property.
*
- * @after
- *
* @return void
*/
- protected function resetGroups() {
+ protected function tearDown(): void {
AbstractFunctionRestrictionsSniff::$unittest_groups = array();
parent::tearDown();
}
diff --git a/composer.json b/composer.json
index 37a8c46252..a5afb55f6b 100644
--- a/composer.json
+++ b/composer.json
@@ -16,7 +16,7 @@
}
],
"require": {
- "php": ">=5.4",
+ "php": ">=7.2",
"ext-filter": "*",
"ext-libxml": "*",
"ext-tokenizer": "*",
@@ -27,7 +27,7 @@
},
"require-dev": {
"phpcompatibility/php-compatibility": "^9.0",
- "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0",
+ "phpunit/phpunit": "^8.0 || ^9.0",
"phpcsstandards/phpcsdevtools": "^1.2.0",
"php-parallel-lint/php-parallel-lint": "^1.4.0",
"php-parallel-lint/php-console-highlighter": "^1.0.0"
diff --git a/phpstan.neon.dist b/phpstan.neon.dist
index e9edfc43bc..b69c29b925 100644
--- a/phpstan.neon.dist
+++ b/phpstan.neon.dist
@@ -1,5 +1,5 @@
parameters:
- phpVersion: 70100 # Needs to be 70100 or higher... sigh...
+ phpVersion: 70200
level: 5
paths:
- WordPress
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index a5f12e7386..a7a2b1401f 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,7 +1,7 @@