Skip to content

Advance notice: strategy for dropping support for PHPCS 3.x #2607

@jrfnl

Description

@jrfnl

This ticket should be seen as an advance notice and is intended to inform users of WordPressCS of what the future will hold regarding PHP_CodeSniffer version support.

Current situation

PHPCS 3.x has a minimum supported PHP version of 5.4.
PHPCS 4.x will have a minimum of PHP 7.2.

PHPCSUtils has a minimum PHP version of 5.4 and all code in PHPCSUtils is compatible with PHPCS 3.x as well as PHPCS 4.0 (in its current state).
PHPCSExtras has a minimum PHP version of 5.4 and all code in PHPCSUtils is compatible with PHPCS 3.x as well as PHPCS 4.0 (in its current state).

And @rodrigoprimo is working behind the scenes to make the sniffs in WordPressCS cross-version compatible with PHPCS 3.x as well as PHPCS 4.0.
We're hoping that this work will be completed soonish and can largely, if not completely, be included in the WordPressCS 3.3.0 release.

Version support strategy

Once PHPCS 4.0 has been released, the PHPCS 3.x branch becomes unsupported, aside from essential security fixes and fixes for runtime support for a new PHP version (for about a year). Bug fixes and support for new PHP syntaxes will only be added to PHPCS 4.x.

PHPCSUtils has already announced a while back that it will keep supporting the 3.x branch only until Tokenizer support for a new PHP syntax which PHPCSUtils needs to handle is added to PHPCS 4.x.

As WordPressCS will also need to deal with new PHP syntaxes, I believe it prudent to follow PHPCSUtils's lead and to drop support for PHPCS 3.x once PHPCS 4.x adds support for new PHP syntaxes.

Note: This moment may come sooner rather than later considering PHP 8.4 property hooks are not yet supported and PHP 8.5 adds yet more new PHP syntaxes and is coming soon.

Planning

As users of WordPressCS may also be using other external standards, which may or may not yet support PHP_CodeSniffer 4.0 and may or may not have their dependency on PHPCS set up correctly in their composer.json file, there is a risk of users getting into dependency conflict hell if we drop support for PHPCS 4.0 in a new minor (even though Composer should be able to sort this out when used correctly).

With this in mind, I'm leaning towards releasing a new major when we drop support for PHPCS 3.x.

Note: There is no intention to maintain multiple branches, one with PHPCS 3.x support, one for PHPCS 4.x support.

Opinions ?

Tasks

When support for PHPCS 3.x is being dropped, the following changes should be made:

  • Remove work-arounds which are in place for cross-version PHPCS 3.x/4.x support.
  • Remove any (incidental) support for CSS/JS.
  • Add support for PHPUnit 10 and 11 (supported by the PHPCS 4.x test framework).

Note: this list is by no means complete, but is intended as a starting point.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions