-
-
Notifications
You must be signed in to change notification settings - Fork 493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drop PHPCS 2.x support by August 31, 2018 #1048
Comments
As a side-note: any WPCS sniff which would be pulled upstream over the next year can not (yet) be dropped from WPCS as the upstream version will only go into PHPCS 3.x. So, if any WPCS sniffs would be upstreamed:
Candidates to be removed/replaced with upstream version once PHPCS 2.x support has been dropped:
|
Another one where a WPCS work-around may be removed if PHPCS merges the upstream fix: squizlabs/PHP_CodeSniffer#1689 / #1185 [Edit:] upstream fix has been merged and will be included in the PHPCS |
A readme change which can be made once the minimum version has gone up to PHPCS
|
The PHPCS native ignore annotations will be changed in v3.2.0. The old type of annotations will be deprecated and they will be removed in PHPCS 4.x. If WPCS would raise it's minimum PHPCS requirement to It would also be a good moment to evaluate whether and if so, when to drop/deprecate the WPCS native whitelist comments. From the upstream changelog:
For more details:
[Edit]: Also keep an eye on squizlabs/PHP_CodeSniffer#1819 and in what version that will be implemented. [Update:] Support for prefixing the new whitelist comments with a [Update]: As of PHPCS 3.2.3, there will also be a [Update]: There were a lot of bugs in the implementation upstream of the new PHPCS annotations, on the one hand with the tokenizer not tokenizing the annotations correctly, on the other hand with upstream sniffs not allowing for the PHPCS annotations in their code examination. I've fixed most of the issues and most of the related PRs have gone into PHPCS For reference, I'm referring to these upstream PRs: 1820, 1827, 1831, 1832, 1833, 1834, 1835, 1836, 1837, 1839, 1841, 1843, 1848, 1901, 1904 - all of which were merged in PHPCS |
The [Update]: The upstream PR has been merged and will be included in PHPCS |
PHPCS upstream introduces a new Also see: #1328 |
More upstream goodies: A PR has just been merged and will be included in the 3.3.0 release which changes the array format for properties. If/when the minimum PHPCS version WPCS support goes up to 3.3.0, we should:
Old format: <property name="forbiddenFunctions" type="array" value="print=>echo,create_function=>null" /> New format: <property name="forbiddenFunctions" type="array">
<element key="print" value="echo"/>
<element key="create_function" value="null"/>
</property> See: squizlabs/PHP_CodeSniffer#1665 Additionally, array formats are as of PHPCS 3.3.0 properly covered for the new PHPCS Also: some of the "hacks" we had in place to deal with array values for properties in unit tests can possibly be removed 🎉 By "hacks", I mean:
|
When we drop 2.x support, will we then have a minimum of |
@GaryJones Based on the interesting things which have been happening in PHPCS, my current recommendation would be to have a minimum of
If nothing else, having |
Also see: #1336 for info about a tokenizer change in PHPCS 3.3.0 |
PHPCS 3.3.0 will add a new While not strictly covered in the Coding Standards handbook, I would suggest adding it to the |
PHPCS 3.3.0 has added a new When this ticket becomes active, it is worth checking if some of the checks in the WPCS sniff can be removed in favour of the upstream sniff. Also see: squizlabs/PHP_CodeSniffer#2053 |
Reminder: don't forget to also review and update the |
Reminder: drop support for incorrectly passed array properties as per #1368 |
Another one which I'd forgotten to add to this thread before: Anywhere where an array is used containing This new array was introduced in PHPCS 3.1.0 via squizlabs/PHP_CodeSniffer#1415 |
In terms of timelines, would this dropping of PHPCS 2.x need be done at a major release, or not? |
@GaryJones It depends on your point of view. Yes:
No:
|
I saw a post recently about how Doctrine dropped support for a version of PHP (7.0?) in a non-major release, but that doesn't have the explicit tie-in that we have with PHPCS. |
FYI: the Travis builds against nightly for PHPCS 2.9 and 3.1 are failing because of a PHP 7.3 issue in PHPCS itself. However, I think this issue is something to keep in mind when determining the minimum required PHPCS version for the next major release of WPCS. |
Just because I looked it up:
So WPCS can jump to at least PHP |
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:
namespace WordPress...
tonamespace WordPressCS\WordPress
.use
statements which refer to PHPCS classes to use the PHPCS 3.x names:Rulesets:
<autoload>./PHPCSAliases.php</autoload>
statement../WordPress/ruleset.xml
: adjust<ruleset name="WordPress" namespace="WordPress">
to<ruleset name="WordPress" namespace="WordPressCS\WordPress">
Cleanup:
./WordPress/PHPCSAliases.php
file.Remove the./phpunit.xml.dist
file../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../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:
.travis.yml
: Remove the PHPCS 2.x specific PHPUnit commands..travis.yml
: Stop testing against PHP 5.3 (not supported by PHPCS 3.x)..travis.yml
: Stop testing against PHPCS 2.x branches..travis.yml
: Remove the toggle for thePHPCS_BIN
location..travis.yml
: Limit the downloading of a custom PHPUnit version to HHVM, PHPCS supports PHPUnit 6.x since PHPCS 3.1.0. See Fix travis build: load PHPCS native bootstrap if available and test against PHP 7.2 #1130.travis,yml
: If needed: add the PHPCS native bootstrap to the PHPUnit command and/or thephpunit.xml.dist
file. See Make the unit test suite compatible with PHPUnit v6 squizlabs/PHP_CodeSniffer#1384composer.json
file.Documentation:
Dropping PHP 5.3 support:
short_open_tag
ini setting from theXSS.EscapeOutput
sniff..travis.yml
.short_open_tag
ini setting icw PHP 5.3 in theCodeAnalysis.EmptyStatement
,Files.FileName
,WhiteSpace.PrecisionAlignment
sniffs. See PrecisionAlignment: fix various bugs #1273, Improve handling short echo open tag #1274The text was updated successfully, but these errors were encountered: