WordPress-Coding-Standards/.phpcs.xml.dist
jrfnl 7cae307243 Remove deprecated Sniff::has_whitelist_comment() method and all references to it
1. Remove the method which was deprecated in WPCS 2.0.0.
2. Remove all function calls to the method.
    Includes:
    * Removing the `SlowQuerySniff::process_token()` method.
        This will now fall through automatically to the method in the parent class.
    * Removing the `GlobalVariablesOverrideSniff::maybe_add_error() method.
        This method no longer has a function.
3. Adjusting the unit tests.
    * Where tests could be removed without having to renumber a lot, especially when the test was more about testing the whitelist functionality than testing the sniff, I've removed them.
    * In all other cases, I've changed the previous deprecation warning in the lines lists to a "normal" error/warning and annotated the change in behaviour.
    * Note: in the `PrefixAllGlobals` tests, there were two testcases which would previously throw a warning for the whitelist comment, but where the whitelist comment had no function anyway as the sniff had already been adjusted to no longer throw an error for those cases. For those, I've removed the whitelist comments.

Includes:
* Removing an exclusion for a whitelist comment deprecation notice from the WPCS native PHPCS ruleset.
* Updating the instructions regarding the old whitelist comments in the CONTRIBUTING file.
    :question_mark: As an alternative, the reference to the old-style whitelist comments could be removed completely from the CONTRIBUTING file.

Fixes 1583
2020-06-30 19:35:06 +02:00

50 lines
2.1 KiB
XML

<?xml version="1.0"?>
<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">
<description>The Coding standard for the WordPress Coding Standards itself.</description>
<file>.</file>
<arg value="sp"/>
<arg name="extensions" value="php"/>
<arg name="basepath" value="."/>
<arg name="parallel" value="8"/>
<exclude-pattern>/bin/class-ruleset-test.php</exclude-pattern>
<!-- Exclude Composer vendor directory. -->
<exclude-pattern>*/vendor/*</exclude-pattern>
<rule ref="WordPress">
<exclude name="WordPress.Files.FileName"/>
<exclude name="WordPress.NamingConventions.ValidVariableName"/>
<exclude name="WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition"/>
</rule>
<!-- Enforce PSR1 compatible namespaces. -->
<rule ref="PSR1.Classes.ClassDeclaration"/>
<rule ref="WordPress.Arrays.MultipleStatementAlignment">
<properties>
<property name="alignMultilineItems" value="!=100"/>
<property name="exact" value="false" phpcs-only="true"/>
</properties>
</rule>
<rule ref="PSR2.Methods.FunctionClosingBrace"/>
<!-- Check code for cross-version PHP compatibility. -->
<config name="testVersion" value="5.4-"/>
<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"/>
</rule>
</ruleset>