* Replace an example of a rule exclusion as excluding security sniffs should be encouraged.
* Remove an example of an "extra rule" as that sniff is now included in WPCS.
* Minor tweak to the example of how to include PHPCompatibilityWP.
Note: I've raised the minimum PHP version to 5.6, not yet to 7.0 as plugins/themes (which are the typical target public for this example ruleset) often support multiple WP versions.
* Update property name.
* Give a few examples of legitimate selective directory excludes.
The GitHub repository has moved from the dedicated `WordPress-Coding-Standards` organisation to the `WordPress` organisation.
This:
* Updates all links which pointed to the old repo on GH to the new one.
* Updates the badges in the Readme to pick up things up correctly again for the new repo.
* Updated all links to Travis from `.org` to `.com` as the build CI has moved as well.
The minimum version should be three versions behind the latest WP release, so what with 5.2 being out, it should now be 4.9.
Includes (not) updating the list of deprecated functions. Input for this based on @JDGrimes's WP deprecated code scanner.
The minimum version should be three versions behind the latest WP release, so what with 5.1 being out, it should now be 4.8.
Includes updating the list of deprecated functions. Input for this based on @JDGrimes's WP deprecated code scanner.
As of PHPCS 3.2.0, PHPCS includes an XSD schema for rulesets which defines what can be used in the XML ruleset file.
In PHPCS 3.3.0 a new array format for properties was introduced and as of PHPCS 3.3.2, the new array format is now also covered by this schema.
This commit:
* Adds the schema tags to the `ruleset.xml` files, the WPCS native `.phpcs.xml.dist` file, as well as to the example ruleset.
* Adds validation against the schema for the `ruleset.xml` files and the example ruleset to the Travis build.
Note:
The schema used in the tags points to the online schema in PHPCS `master` for two reasons:
1. While WPCS now has a minimum requirement of PHPCS 3.3.1, the schema in PHPCS `master` contains the changes which were made in PHPCS 3.3.2, so we can safely validate the rulesets against the schema.
2. While installation via Composer is supported for WPCS, it is **not** the _only_ supported installation method, so pointing to the version of the XSD schema in the `vendor` directory would be presumptuous.
At the same time, using the URL in the Travis script appears to be problematic and as we're doing a composer install there anyway, we may as well use the version in the `vendor` directory for the actual validation.
As the validation is done on a build with PHPCS `master`, there will be no difference anyway.
Fixes 1477
A new format for passing array elements to PHPCS properties was added in PHPCS 3.3.0.
This new array format is far more readable and less error prone than the old format.
This commit implements using this new array format throughout WPCS, wherever relevant, including in property setting examples in the documentation.
Ref:
* squizlabs/PHP_CodeSniffer 1665
[PHPCompatibility 9.0.0](https://github.com/PHPCompatibility/PHPCompatibility/releases/tag/9.0.0) has just been released and renames all sniffs.
* Updated the version restrictions in `composer.json`.
As the sniff names have changed, set minimum version.
Note: PHPCompatibility 9.0.0 is still compatible with PHPCS 2.3.0 up to current, so this doesn't make a difference for running the sniffs.
* Updated the WPCS native PHPCS ruleset for the new PHPCompatibility sniff codes.
* Updated the inline annotations for the new PHPCompatibility sniff codes.
* Updated the `phpcs.xml.dist.sample` to favour the `PHPCompatibilityWP` ruleset (was missed in PR 1426).
* Updated a few more links to the PHPCompatibility repo for the move to an organisation (which were missed in PR 1426).
Issue 1128 raised the interesting point that example exclusions maybe taken over literally by people who are not as familiar with PHPCS.
This minor change should prevent that.