Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/quicktest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
19 changes: 5 additions & 14 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
13 changes: 1 addition & 12 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,13 @@

<!-- Linting is done in a separate CI job, no need to duplicate it. -->
<exclude name="Generic.PHP.Syntax"/>

<!-- WordPressCS still has a PHP 5.4 minimum. -->
<exclude name="Modernize.FunctionCalls.Dirname"/>
</rule>

<!-- Check code for cross-version PHP compatibility. -->
<config name="testVersion" value="5.4-"/>
<config name="testVersion" value="7.2-"/>
<rule ref="PHPCompatibility">
<!-- Exclude PHP constants back-filled by PHPCS. -->
<exclude name="PHPCompatibility.Constants.NewConstants.t_finallyFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_yieldFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_ellipsisFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_powFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_pow_equalFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_spaceshipFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_coalesceFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_coalesce_equalFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_yield_fromFound"/>
<exclude name="PHPCompatibility.Constants.NewConstants.t_readonlyFound"/>
</rule>

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[![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)

[![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)
[![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)
[![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)

[![License: MIT](https://poser.pugx.org/wp-coding-standards/wpcs/license)](https://github.com/WordPress/WordPress-Coding-Standards/blob/develop/LICENSE)
[![Total Downloads](https://poser.pugx.org/wp-coding-standards/wpcs/downloads)](https://packagist.org/packages/wp-coding-standards/wpcs/stats)
Expand Down Expand Up @@ -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)
Expand Down
9 changes: 3 additions & 6 deletions WordPress/Tests/DB/RestrictedClassesUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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();
}
Expand Down
9 changes: 2 additions & 7 deletions WordPress/Tests/DB/RestrictedFunctionsUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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();
}
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}
],
"require": {
"php": ">=5.4",
"php": ">=7.2",
"ext-filter": "*",
"ext-libxml": "*",
"ext-tokenizer": "*",
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
phpVersion: 70100 # Needs to be 70100 or higher... sigh...
phpVersion: 70200
level: 5
paths:
- WordPress
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.3/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd"
backupGlobals="true"
bootstrap="./Tests/bootstrap.php"
convertErrorsToExceptions="true"
Expand Down
Loading