Skip to content

Commit 0301892

Browse files
committed
Composer: update WordPressCS + PHPCS dependencies
WordPressCS 3.0.0 has been released and requires a minimum PHPCS version of 3.7.2. This commit updates the WordPressCS and PHPCS dependencies and the documentation referring to those, in all the relevant places. Includes: * Removing the DealerDirect plugin from `require` as it comes with WordPressCS 3.0.0 automatically (via PHPCSUtils) and not having the explicit dependency may prevent conflicts with allowed versions in the future. * Updating the PHP version on which the CS check for the VIPCS native code is being run. With WPCS 3.0, this check is no longer limited to PHP 7.4. * Removing a work-around for WPCS < 3.0 vs PHP 8.0 * Updating the VIPCS native `.phpcs.xml.dist` ruleset. Ref: https://github.com/WordPress/WordPress-Coding-Standards/releases/tag/3.0.0
1 parent 9b5c899 commit 0301892

File tree

6 files changed

+16
-20
lines changed

6 files changed

+16
-20
lines changed

.github/workflows/basics.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Install PHP
3030
uses: shivammathur/setup-php@v2
3131
with:
32-
php-version: '7.4'
32+
php-version: 'latest'
3333
coverage: none
3434
tools: cs2pr
3535

.github/workflows/quicktest.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ jobs:
2828
include:
2929
- php: '5.4'
3030
phpcs_version: 'dev-master'
31-
wpcs_version: '2.3.*'
31+
wpcs_version: '3.0.*'
3232
- php: '5.4'
33-
phpcs_version: '3.7.1'
34-
wpcs_version: '2.3.*'
33+
phpcs_version: '3.7.2'
34+
wpcs_version: '3.0.*'
3535

3636
- php: 'latest'
3737
phpcs_version: 'dev-master'
38-
wpcs_version: '2.3.*'
38+
wpcs_version: '3.0.*'
3939
- php: 'latest'
40-
phpcs_version: '3.7.1'
41-
wpcs_version: '2.3.*'
40+
phpcs_version: '3.7.2'
41+
wpcs_version: '3.0.*'
4242

4343
name: "QTest${{ matrix.phpcs_version == 'dev-master' && ' + Lint' || '' }}: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}"
4444

@@ -48,7 +48,6 @@ jobs:
4848

4949
# On stable PHPCS versions, allow for PHP deprecation notices.
5050
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
51-
# Note: the "elif" condition is temporary and should be removed once VIPCS updates to WPCS 3.0+.
5251
- name: Setup ini config
5352
id: set_ini
5453
run: |

.github/workflows/test.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ jobs:
7272
# no additional versions are included in the array.
7373
matrix:
7474
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
75-
phpcs_version: ['3.7.1', 'dev-master']
76-
wpcs_version: ['2.3.*']
75+
phpcs_version: ['3.7.2', 'dev-master']
76+
wpcs_version: ['3.0.*']
7777

7878
include:
7979
- php: '8.3'
8080
phpcs_version: 'dev-master'
81-
wpcs_version: '2.3.*'
81+
wpcs_version: '3.0.*'
8282

8383
name: "Test: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }} - WPCS ${{ matrix.wpcs_version }}"
8484

@@ -90,14 +90,11 @@ jobs:
9090

9191
# On stable PHPCS versions, allow for PHP deprecation notices.
9292
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
93-
# Note: the "elif" condition is temporary and should be removed once VIPCS updates to WPCS 3.0+.
9493
- name: Setup ini config
9594
id: set_ini
9695
run: |
9796
if [[ "${{ matrix.phpcs_version }}" != "dev-master" ]]; then
9897
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED' >> $GITHUB_OUTPUT
99-
elif [[ "${{ matrix.php }}" == "8.1" ]]; then
100-
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED' >> $GITHUB_OUTPUT
10198
else
10299
echo 'PHP_INI=error_reporting=-1' >> $GITHUB_OUTPUT
103100
fi

.phpcs.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<exclude name="WordPress.Files.FileName"/>
2121
<exclude name="WordPress.NamingConventions.ValidVariableName"/>
2222
<exclude name="WordPress.NamingConventions.PrefixAllGlobals"/>
23-
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
23+
<exclude name="Universal.Arrays.DisallowShortArraySyntax"/>
2424
<exclude name="WordPress.PHP.YodaConditions"/>
2525
</rule>
2626

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ Go to https://docs.wpvip.com/technical-references/code-review/phpcs-report/ to l
1616
## Minimal requirements
1717

1818
* PHP 5.4+
19-
* [PHPCS 3.7.1+](https://github.com/squizlabs/PHP_CodeSniffer/releases)
19+
* [PHPCS 3.7.2+](https://github.com/squizlabs/PHP_CodeSniffer/releases)
2020
* [PHPCSUtils 1.0.8+](https://github.com/PHPCSStandards/PHPCSUtils)
21-
* [WPCS 2.3.0+](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/releases)
21+
* [WPCS 3.0.0+](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/releases)
2222
* [VariableAnalysis 2.11.17+](https://github.com/sirbrillig/phpcs-variable-analysis/releases)
2323

2424
## Installation
@@ -35,7 +35,7 @@ composer g config allow-plugins.dealerdirect/phpcodesniffer-composer-installer t
3535
composer g require automattic/vipwpcs
3636
```
3737

38-
This will install the latest compatible versions of PHPCS, PHPCSUtils, WPCS and VariableAnalysis and register the external standards with PHP_CodeSniffer.
38+
This will install the latest compatible versions of PHPCS, PHPCSUtils, PHPCSExtra, WPCS and VariableAnalysis and register the external standards with PHP_CodeSniffer.
3939

4040
Please refer to the [installation instructions for installing PHP_CodeSniffer for WordPress.com VIP](https://docs.wpvip.com/how-tos/code-review/php_codesniffer/) for more details.
4141

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"php": ">=5.4",
2020
"phpcsstandards/phpcsutils": "^1.0.8",
2121
"sirbrillig/phpcs-variable-analysis": "^2.11.17",
22-
"squizlabs/php_codesniffer": "^3.7.1",
23-
"wp-coding-standards/wpcs": "^2.3"
22+
"squizlabs/php_codesniffer": "^3.7.2",
23+
"wp-coding-standards/wpcs": "^3.0"
2424
},
2525
"require-dev": {
2626
"php-parallel-lint/php-parallel-lint": "^1.3.2",

0 commit comments

Comments
 (0)