Skip to content

Commit 15e1fc9

Browse files
committed
Switch to PHPCSStandards/PHP_CodeSniffer
The Squizlabs repo has been abandoned. The project continues in a fork in the PHPCSStandards organisation. Ref: * squizlabs/PHP_CodeSniffer 3932
1 parent a521f60 commit 15e1fc9

19 files changed

+41
-41
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Bug reports containing a minimal code sample which can be used to reproduce the
1414
Since WordPressCS employs many sniffs that are part of PHP_CodeSniffer itself or PHPCSExtra, sometimes an issue will be caused by a bug in PHPCS or PHPCSExtra and not in WordPressCS itself.
1515
If the error message in question doesn't come from a sniff whose name starts with `WordPress`, the issue is probably a bug in PHPCS or PHPCSExtra.
1616

17-
* Bugs for sniffs starting with `Generic`, `PEAR`, `PSR1`, `PSR2`, `PSR12`, `Squiz` or `Zend` should be [reported to PHPCS](https://github.com/squizlabs/PHP_CodeSniffer/issues).
17+
* Bugs for sniffs starting with `Generic`, `PEAR`, `PSR1`, `PSR2`, `PSR12`, `Squiz` or `Zend` should be [reported to PHPCS](https://github.com/PHPCSStandards/PHP_CodeSniffer/issues).
1818
* Bugs for sniffs starting with `Modernize`, `NormalizedArrays` or `Universal` should be [reported to PHPCSExtra](https://github.com/PHPCSStandards/PHPCSExtra/issues).
1919

2020
# Contributing patches and new features

.github/release-checklist.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ PR for tracking changes for the x.x.x release. Target release date: **DOW MONTH
6464
- [ ] Submit for ["Month in WordPress"][month-in-wp].
6565
- [ ] Submit for the ["Monthy Dev Roundup"][dev-roundup].
6666

67-
[phpcs-releases]: https://github.com/squizlabs/PHP_CodeSniffer/releases
67+
[phpcs-releases]: https://github.com/PHPCSStandards/PHP_CodeSniffer/releases
6868
[phpcsutils-releases]: https://github.com/PHPCSStandards/PHPCSUtils/releases
6969
[phpcsextra-releases]: https://github.com/PHPCSStandards/PHPCSExtra/releases
7070
[month-in-wp]: https://make.wordpress.org/community/month-in-wordpress-submissions/

.github/workflows/basic-qa.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939

4040
# Using PHPCS `master` as an early detection system for bugs upstream.
4141
- name: Set PHPCS version
42-
run: composer require squizlabs/php_codesniffer:"dev-master" --no-update --no-scripts --no-interaction
42+
run: composer require phpcsstandards/php_codesniffer:"dev-master" --no-update --no-scripts --no-interaction
4343

4444
- name: Install Composer dependencies
4545
uses: ramsey/composer-install@v2
@@ -68,10 +68,10 @@ jobs:
6868
# Validate the Ruleset XML files.
6969
# @link http://xmlsoft.org/xmllint.html
7070
- name: Validate the WordPress rulesets
71-
run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd ./*/ruleset.xml
71+
run: xmllint --noout --schema vendor/phpcsstandards/php_codesniffer/phpcs.xsd ./*/ruleset.xml
7272

7373
- name: Validate the sample ruleset
74-
run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd ./phpcs.xml.dist.sample
74+
run: xmllint --noout --schema vendor/phpcsstandards/php_codesniffer/phpcs.xsd ./phpcs.xml.dist.sample
7575

7676
# Validate the Documentation XML files.
7777
- name: Validate documentation against schema
@@ -117,7 +117,7 @@ jobs:
117117

118118
- name: "Set PHPCS version (master)"
119119
if: ${{ matrix.phpcs_version != 'lowest' }}
120-
run: composer require squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-update --no-scripts --no-interaction
120+
run: composer require phpcsstandards/php_codesniffer:"${{ matrix.phpcs_version }}" --no-update --no-scripts --no-interaction
121121

122122
- name: Install Composer dependencies
123123
uses: ramsey/composer-install@v2
@@ -128,7 +128,7 @@ jobs:
128128

129129
- name: "Set PHPCS version (lowest)"
130130
if: ${{ matrix.phpcs_version == 'lowest' }}
131-
run: composer update squizlabs/php_codesniffer --prefer-lowest --ignore-platform-req=php+ --no-scripts --no-interaction
131+
run: composer update phpcsstandards/php_codesniffer --prefer-lowest --ignore-platform-req=php+ --no-scripts --no-interaction
132132

133133
- name: Test the WordPress-Core ruleset
134134
run: $(pwd)/vendor/bin/phpcs -ps ./Tests/RulesetCheck/class-ruleset-test.inc --standard=WordPress-Core

.github/workflows/quicktest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252

5353
- name: "Set PHPCS version (master)"
5454
if: ${{ matrix.phpcs_version != 'lowest' }}
55-
run: composer require squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-update --no-scripts --no-interaction
55+
run: composer require phpcsstandards/php_codesniffer:"${{ matrix.phpcs_version }}" --no-update --no-scripts --no-interaction
5656

5757
- name: Install Composer dependencies (PHP < 8.0 )
5858
if: ${{ matrix.php < 8.0 && matrix.php != 'latest' }}
@@ -70,7 +70,7 @@ jobs:
7070

7171
- name: "Set PHPCS version (lowest)"
7272
if: ${{ matrix.phpcs_version == 'lowest' }}
73-
run: composer update squizlabs/php_codesniffer --prefer-lowest --ignore-platform-req=php+ --no-scripts --no-interaction
73+
run: composer update phpcsstandards/php_codesniffer --prefer-lowest --ignore-platform-req=php+ --no-scripts --no-interaction
7474

7575
- name: Lint PHP files against parse errors
7676
if: ${{ matrix.phpcs_version == 'dev-master' }}

.github/workflows/unit-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484

8585
- name: "Set PHPCS version (master)"
8686
if: ${{ matrix.phpcs_version != 'lowest' }}
87-
run: composer require squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-update --no-scripts --no-interaction
87+
run: composer require phpcsstandards/php_codesniffer:"${{ matrix.phpcs_version }}" --no-update --no-scripts --no-interaction
8888

8989
- name: Install Composer dependencies (PHP < 8.0 )
9090
if: ${{ matrix.php < 8.0 }}
@@ -102,7 +102,7 @@ jobs:
102102

103103
- name: "Set PHPCS version (lowest)"
104104
if: ${{ matrix.phpcs_version == 'lowest' }}
105-
run: composer update squizlabs/php_codesniffer --prefer-lowest --ignore-platform-req=php+ --no-scripts --no-interaction
105+
run: composer update phpcsstandards/php_codesniffer --prefer-lowest --ignore-platform-req=php+ --no-scripts --no-interaction
106106

107107
- name: Lint PHP files against parse errors
108108
if: ${{ matrix.phpcs_version == 'dev-master' }}

.phpcs.xml.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?xml version="1.0"?>
2-
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="WordPress Coding Standards" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
2+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="WordPress Coding Standards" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd">
33

44
<description>The Coding standard for the WordPress Coding Standards itself.</description>
55

66
<!--
77
#############################################################################
88
COMMAND LINE ARGUMENTS
9-
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset
9+
https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Annotated-Ruleset
1010
#############################################################################
1111
-->
1212

CHANGELOG.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ In all cases, please read the complete changelog carefully before you upgrade.
9797
- The `sanitize_url()` and `wp_kses_one_attr()` functions to the list of known "sanitizing" functions.
9898
- Metrics for blank lines at the start/end of a control structure body to the `WordPress.WhiteSpace.ControlStructureSpacing` sniff. These can be displayed using `--report=info` when the `blank_line_check` property has been set to `true`.
9999
- End-user documentation to the following new and pre-existing sniffs: `WordPress.DateTime.RestrictedFunctions`, `WordPress.NamingConventions.PrefixAllGlobals` (props [@Ipstenu]), `WordPress.PHP.StrictInArray` (props [@marconmartins]), `WordPress.PHP.YodaConditions` (props [@Ipstenu]), `WordPress.WhiteSpace.ControlStructureSpacing` (props [@ckanitz]), `WordPress.WhiteSpace.ObjectOperatorSpacing`, `WordPress.WhiteSpace.OperatorSpacing` (props [@ckanitz]), `WordPress.WP.CapitalPDangit` (props [@NielsdeBlaauw]), `WordPress.WP.Capabilities`, `WordPress.WP.ClassNameCase`, `WordPress.WP.EnqueueResourceParameters` (props [@NielsdeBlaauw]).
100-
This documentation can be exposed via the [`PHP_CodeSniffer` `--generator=...` command-line argument](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage).
100+
This documentation can be exposed via the [`PHP_CodeSniffer` `--generator=...` command-line argument](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Usage).
101101
Note: all sniffs which have been added from PHPCSExtra (Universal, Modernize, NormalizedArrays sniffs) are also fully documented.
102102

103103
#### Added (internal/dev-only)
@@ -454,7 +454,7 @@ The move does not affect the package name for Packagist. This remains the same:
454454
- `Sniff::get_list_variables()` utility method which will retrieve an array with the token pointers to the variables which are being assigned to in a `list()` construct. Includes support for short lists.
455455
- `Sniff::is_function_deprecated()` static utility method to determine whether a declared function has been marked as deprecated in the function DocBlock.
456456
- End-user documentation to the following existing sniffs: `WordPress.Arrays.ArrayIndentation`, `WordPress.Arrays.ArrayKeySpacingRestrictions`, `WordPress.Arrays.MultipleStatementAlignment`, `WordPress.Classes.ClassInstantiation`, `WordPress.NamingConventions.ValidHookName`, `WordPress.PHP.IniSet`, `WordPress.Security.SafeRedirect`, `WordPress.WhiteSpace.CastStructureSpacing`, `WordPress.WhiteSpace.DisallowInlineTabs`, `WordPress.WhiteSpace.PrecisionAlignment`, `WordPress.WP.CronInterval`, `WordPress.WP.DeprecatedClasses`, `WordPress.WP.DeprecatedFunctions`, `WordPress.WP.DeprecatedParameters`, `WordPress.WP.DeprecatedParameterValues`, `WordPress.WP.EnqueuedResources`, `WordPress.WP.PostsPerPage`.
457-
This documentation can be exposed via the [`PHP_CodeSniffer` `--generator=...` command-line argument](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage).
457+
This documentation can be exposed via the [`PHP_CodeSniffer` `--generator=...` command-line argument](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Usage).
458458

459459
### Changed
460460
- The default value for `minimum_supported_wp_version`, as used by a [number of sniffs detecting usage of deprecated WP features](https://github.com/WordPress/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#minimum-wp-version-to-check-for-usage-of-deprecated-functions-classes-and-function-parameters), has been updated to `5.0`.
@@ -661,7 +661,7 @@ If you are a maintainer of an external standard based on WordPressCS and any of
661661
- `WordPress.NamingConventions.ValidVariableName`: Added unit tests confirming support for multi-variable/property declarations.
662662
- The `get_name_suggestion()` method has been moved from the `WordPress.NamingConventions.ValidFunctionName` sniff to the base `Sniff` class, renamed to `get_snake_case_name_suggestion()` and made static.
663663
- The rulesets are now validated against the `PHP_CodeSniffer` XSD schema.
664-
- Updated the [custom ruleset example](https://github.com/WordPress/WordPress-Coding-Standards/blob/develop/phpcs.xml.dist.sample) to use the recommended ruleset syntax for `PHP_CodeSniffer` 3.3.1+, including using the new [array property format](https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/3.3.0) which is now supported.
664+
- Updated the [custom ruleset example](https://github.com/WordPress/WordPress-Coding-Standards/blob/develop/phpcs.xml.dist.sample) to use the recommended ruleset syntax for `PHP_CodeSniffer` 3.3.1+, including using the new [array property format](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/tag/3.3.0) which is now supported.
665665
- Dev: The command to run the unit tests has changed. Please see the updated instructions in the [CONTRIBUTING.md](https://github.com/WordPress/WordPress-Coding-Standards/blob/develop/.github/CONTRIBUTING.md) file.
666666
The `bin/pre-commit` example git hook has been updated to match. Additionally a `run-tests` script has been added to the `composer.json` file for your convenience.
667667
To facilitate this, PHPUnit has been added to `require-dev`, even though it is strictly speaking a dependency of PHPCS, not of WPCS.
@@ -672,7 +672,7 @@ If you are a maintainer of an external standard based on WordPressCS and any of
672672
### Deprecated
673673
- The use of the [WordPressCS native whitelist comments](https://github.com/WordPress/WordPress-Coding-Standards/wiki/Whitelisting-code-which-flags-errors), which were introduced in WPCS 0.4.0, have been deprecated and support will be removed in WPCS 3.0.0.
674674
The WordPressCS native whitelist comments will continue to work for now, but a deprecation warning will be thrown when they are encountered.
675-
You are encouraged to upgrade our whitelist comment to use the [PHPCS native selective ignore annotations](https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/3.2.0) as introduced in `PHP_CodeSniffer` 3.2.0, as soon as possible.
675+
You are encouraged to upgrade our whitelist comment to use the [PHPCS native selective ignore annotations](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/tag/3.2.0) as introduced in `PHP_CodeSniffer` 3.2.0, as soon as possible.
676676

677677
### Removed
678678
- Support for PHP 5.3. PHP 5.4 is the minimum requirement for `PHP_CodeSniffer` 3.x.
@@ -684,7 +684,7 @@ If you are a maintainer of an external standard based on WordPressCS and any of
684684
- Support for array properties set in a custom ruleset without the `type="array"` attribute.
685685
Support for this was deprecated in WPCS 1.0.0.
686686
If in doubt about how properties should be set in your custom ruleset, please refer to the [Customizable sniff properties](https://github.com/WordPress/WordPress-Coding-Standards/wiki/Customizable-sniff-properties) wiki page which contains XML code examples for setting each and every WPCS native sniff property.
687-
As the minimum `PHP_CodeSniffer` version is now 3.3.1, you can now also use the [new format for setting array properties](https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/3.3.0), so this would be a great moment to review and update your custom ruleset.
687+
As the minimum `PHP_CodeSniffer` version is now 3.3.1, you can now also use the [new format for setting array properties](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/tag/3.3.0), so this would be a great moment to review and update your custom ruleset.
688688
Note: the ability to set select properties from the command-line as comma-delimited strings is _not_ affected by this change.
689689
- The following sniffs have been removed outright without deprecation.
690690
If you are referencing these sniffs in a ruleset XML file or in inline annotations, please update these to reference the replacement sniffs instead.
@@ -985,10 +985,10 @@ If you are a maintainer of an external standard based on WPCS and any of your cu
985985

986986
### Fixed
987987
- Compatibility with PHP 7.3. A change in PHP 7.3 was causing the `WordPress.DB.RestrictedClasses`, `WordPress.DB.RestrictedFunctions` and the `WordPress.WP.AlternativeFunctions` sniffs to fail to correctly detect issues.
988-
- Compatibility with the latest releases from [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
988+
- Compatibility with the latest releases from [PHP_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer).
989989
PHPCS 3.2.0 introduced new annotations which can be used inline to selectively disable/ignore certain sniffs.
990990
**Note**: The initial implementation of the new annotations was buggy. If you intend to start using these new style annotations, you are strongly advised to use PHPCS 3.3.0 or higher.
991-
For more information about these annotations, please refer to the [PHPCS Wiki](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#ignoring-parts-of-a-file).
991+
For more information about these annotations, please refer to the [PHPCS Wiki](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Advanced-Usage#ignoring-parts-of-a-file).
992992
- The [WPCS native whitelist comments](https://github.com/WordPress/WordPress-Coding-Standards/wiki/Whitelisting-code-which-flags-errors) can now be combined with the new style PHPCS whitelist annotations in the `-- for reasons` part of the annotation.
993993
- `WordPress.Arrays.ArrayDeclarationSpacing`: the fixer will now handle the new style annotations correctly.
994994
- `WordPress.Arrays.CommaAfterArrayItem`: prevent a fixer loop when new style annotations are encountered.
@@ -1221,7 +1221,7 @@ If you exclude some sniffs or error codes, you may have to update your custom ru
12211221

12221222
Additionally, to make it easier for you to customize your ruleset, two new wiki pages have been published with information on the properties you can adjust from your ruleset:
12231223
* [WPCS customizable sniff properties](https://github.com/WordPress/WordPress-Coding-Standards/wiki/Customizable-sniff-properties)
1224-
* [PHPCS customizable sniff properties](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Customisable-Sniff-Properties)
1224+
* [PHPCS customizable sniff properties](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Customisable-Sniff-Properties)
12251225

12261226
For more detailed information about the changed sniff names and error codes, please refer to PR [#633](https://github.com/WordPress/WordPress-Coding-Standards/pull/633) and PR [#814](https://github.com/WordPress/WordPress-Coding-Standards/pull/814).
12271227

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
## Introduction
4848

49-
This project is a collection of [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) rules (sniffs) to validate code developed for WordPress. It ensures code quality and adherence to coding conventions, especially the official [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/).
49+
This project is a collection of [PHP_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) rules (sniffs) to validate code developed for WordPress. It ensures code quality and adherence to coding conventions, especially the official [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/).
5050

5151
This project needs funding. [Find out how you can help](#funding).
5252

@@ -133,7 +133,7 @@ If you need to further customize the selection of sniffs for your project - you
133133

134134
When you name this file either `.phpcs.xml`, `phpcs.xml`, `.phpcs.xml.dist` or `phpcs.xml.dist`, PHP_CodeSniffer will automatically locate it as long as it is placed in the directory from which you run the CodeSniffer or in a directory above it. If you follow these naming conventions you don't have to supply a `--standard` CLI argument.
135135

136-
For more info, read about [using a default configuration file](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#using-a-default-configuration-file). See also the provided WordPressCS [`phpcs.xml.dist.sample`](phpcs.xml.dist.sample) file and the [fully annotated example ruleset](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml) in the PHP_CodeSniffer documentation.
136+
For more info, read about [using a default configuration file](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Advanced-Usage#using-a-default-configuration-file). See also the provided WordPressCS [`phpcs.xml.dist.sample`](phpcs.xml.dist.sample) file and the [fully annotated example ruleset](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Annotated-ruleset.xml) in the PHP_CodeSniffer documentation.
137137

138138
### Customizing sniff behaviour
139139

@@ -143,7 +143,7 @@ You can find a complete list of all the properties you can change for the WordPr
143143

144144
WordPressCS also uses sniffs from PHPCSExtra and from PHP_CodeSniffer itself.
145145
The [README for PHPCSExtra](https://github.com/PHPCSStandards/PHPCSExtra) contains information on the properties which can be set for the sniff from PHPCSExtra.
146-
Information on custom properties which can be set for sniffs from PHP_CodeSniffer can be found in the [PHP_CodeSniffer wiki](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Customisable-Sniff-Properties).
146+
Information on custom properties which can be set for sniffs from PHP_CodeSniffer can be found in the [PHP_CodeSniffer wiki](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Customisable-Sniff-Properties).
147147

148148

149149
### Recommended additional rulesets

Tests/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*/
2626
// Get the PHPCS dir from an environment variable.
2727
$phpcsDir = getenv( 'PHPCS_DIR' );
28-
$composerPHPCSPath = dirname( __DIR__ ) . $ds . 'vendor' . $ds . 'squizlabs' . $ds . 'php_codesniffer';
28+
$composerPHPCSPath = dirname( __DIR__ ) . $ds . 'vendor' . $ds . 'phpcsstandards' . $ds . 'php_codesniffer';
2929

3030
if ( false === $phpcsDir && is_dir( $composerPHPCSPath ) ) {
3131
// PHPCS installed via Composer.

0 commit comments

Comments
 (0)