Skip to content

Drop PHPCS 2.x support by August 31, 2018 #1048

Closed
@jrfnl

Description

@jrfnl

As proposed in this comment #718 (comment), PHPCS 2.x should be dropped by August 31, 2018 at the latest.

That gives other external standards which build onto WPCS a year's time to upgrade their standards.

This issue is intended to document what needs to be done to drop PHPCS 2.x support, based on the PHPCS cross-version implementation as pulled in #1047.

Prerequisite: The minimum supported PHPCS version for WPCS will need to be 3.1.0 or higher.

Sniff files:

  • Change namespace from namespace WordPress... to namespace WordPressCS\WordPress.
  • Change the use statements which refer to PHPCS classes to use the PHPCS 3.x names:
    // Current:
    use PHP_CodeSniffer_Sniff as PHPCS_Sniff;
    use PHP_CodeSniffer_File as File;
    use PHP_CodeSniffer_Tokens as Tokens;
    
    // Should become:
    use PHP_CodeSniffer\Sniffs\Sniff as PHPCS_Sniff;
    use PHP_CodeSniffer\Files\File;
    use PHP_CodeSniffer\Util\Tokens;

Rulesets:

  • All: remove the <autoload>./PHPCSAliases.php</autoload> statement.
  • ./WordPress/ruleset.xml: adjust <ruleset name="WordPress" namespace="WordPress"> to <ruleset name="WordPress" namespace="WordPressCS\WordPress">
  • Review which customizations currently done per error code can now be done for the complete sniff in one go. Related Ruleset: maintain compatibility with PHPCS 2.x #1144
  • Review other notes in the ruleset about additional customizations / sniff replacements which can be done once the minimum requirement has gone up & action them

Cleanup:

  • Remove the ./WordPress/PHPCSAliases.php file.
  • Remove the ./phpunit.xml.dist file.
  • Remove the ./Test subdirectory and all the files therein. The bootstraps and the PHPCS 2.x test suite files are no longer needed as long as the minimum PHPCS version goes up to 3.1.0.
  • Decide whether to keep or remove the ./WordPress/PHPCSHelper.php file. It might be useful to leave it in place to be used for future PHPCS cross-version compatibility issues. The PHPCS 2.x specific code in the file can be removed.

Build script and config files:

Documentation:

  • Readme: update minimum requirements & remove references to PHPCS 2.x.
  • Contributing: update the unit test instructions.
  • Remove the PHPCS 3 and testing individual sniffs wiki page as it should no longer apply.

Dropping PHP 5.3 support:

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions