You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This update accounts for the following changes:
* Ruleset:
- Updated sniff error codes for compatibility with PHPCompatibility 9.0.0.
- Defer to the dedicated polyfill rulesets for polyfills provided by project dependencies.
* Composer:
- Require relevant dedicated polyfill ruleset.
- Require `dev` the DealerDirect PHPCS Composer plugin to sort out the `installed_paths` so Travis can test the ruleset.
- Improved the project description.
* Travis/Tests:
- Added testing of the ruleset.
* Issue template: minor textual tweak.
* Readme:
- Minor textual improvements to the project description.
- Added information about the dependency on the polyfill ruleset.
- Removed non-Composer installation instructions.
As there are now more dependencies for this project, installation without using Composer, while of course still possible, is no longer _supported_.
- Added section about only testing PHP files.
- Added changelog for version 2.0.0.
Additionally, in all user-facing texts, the abbreviation `PHPCS` has been expanded to read `PHP_CodeSniffer`.
Copy file name to clipboardExpand all lines: .github/issue_template.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ This repository is only for the WordPress PHPCompatibility ruleset, which preven
3
3
4
4
If your issue is related to the PHPCompatibility sniffs, please open an issue in the PHPCompatibility repository: https://github.com/PHPCompatibility/PHPCompatibility/issues
5
5
6
-
Before opening a new issue, please search for duplicate issues to prevent opening a duplicate. If there is already an open issue, please leave a comment there.
6
+
Before opening a new issue, please search for your issue to prevent opening a duplicate. If there is already an open issue, please leave a comment there.
7
7
8
8
If you are opening an issue to get a new back-fill / poly-fill which was added to WordPress excluded, please include links to the WordPress source code and the related Trac ticket to substantiate your request.
Using the PHPCompatibilityWP standard, you can analyse the codebase of a WordPress-based project for PHP cross-version compatibility.
8
+
Using PHPCompatibilityWP, you can analyse the codebase of a WordPress-based project for PHP cross-version compatibility.
9
9
10
10
11
11
## What's in this repo ?
12
12
13
-
A PHPCompatibility ruleset for projects based on the WordPress CMS.
13
+
A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects based on the WordPress CMS.
14
14
15
15
This WordPress specific ruleset prevents false positives from the [PHPCompatibility standard](https://github.com/PHPCompatibility/PHPCompatibility) by excluding back-fills and poly-fills which are provided by WordPress.
16
16
@@ -22,21 +22,22 @@ This WordPress specific ruleset prevents false positives from the [PHPCompatibil
22
22
* PHP 5.4+ for use with [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) 3.0.2+.
23
23
24
24
Use the latest stable release of PHP_CodeSniffer for the best results.
25
-
The minimum _recommended_ version of PHP_CodeSniffer is PHPCS 2.6.0.
If all went well, you will now see that the PHPCompatibility and PHPCompatibilityWP standards are installed for PHP_CodeSniffer.
50
-
51
-
### Installation instructions without Composer (unsupported)
52
-
53
-
* Install [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) via [your preferred method](https://github.com/squizlabs/PHP_CodeSniffer#installation).
54
-
55
-
PHP CodeSniffer offers a variety of installation methods to suit your work-flow: Composer, [PEAR](http://pear.php.net/PHP_CodeSniffer), a Phar file, zipped/tarred release archives or checking the repository out using Git.
56
-
57
-
* Install [PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility) by [cloning the PHPCompatibility repository](https://github.com/PHPCompatibility/PHPCompatibility#installation-via-a-git-check-out-to-an-arbitrary-directory-method-2).
58
-
59
-
* Install [PHPCompatibilityWP](https://github.com/PHPCompatibility/PHPCompatibilityWP) by cloning this repository.
60
-
61
-
* Add the paths to the directories in which you placed your copies of the PHPCompatibility repo and the PHPCompatibilityWP repo to the PHP CodeSniffer configuration using the below command from the command line:
For more information, see the PHP CodeSniffer wiki on the [`installed_paths` configuration variable](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options#setting-the-installed-standard-paths).
66
-
67
-
* Verify that the PHPCompatibility standard is registered correctly by running `phpcs -i` on the command line. PHPCompatibility should be listed as one of the available standards.
50
+
If all went well, you will now see that the `PHPCompatibility`, `PHPCompatibilityWP` and some more PHPCompatibility standards are installed for PHP_CodeSniffer.
68
51
69
52
70
53
## How to use
71
54
72
55
Now you can use the following command to inspect your code:
By default, you will only receive notifications about deprecated and/or removed PHP features.
@@ -83,16 +63,36 @@ To get the most out of the PHPCompatibilityWP standard, you should specify a `te
83
63
84
64
The minimum PHP requirement of the WordPress project at this time is PHP 5.2.4. If you want to enforce this, either add `--runtime-set testVersion 5.2-` to your command-line command or add `<config name="testVersion" value="5.2-"/>` to your [custom ruleset](https://github.com/PHPCompatibility/PHPCompatibility#using-a-custom-ruleset).
85
65
66
+
For example:
67
+
```bash
68
+
# For a project which should be compatible with PHP 5.2 and higher:
For more detailed information about setting the `testVersion`, see the README of the generic [PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions) standard.
87
73
88
74
75
+
### Testing PHP files only
76
+
77
+
By default PHP_CodeSniffer will analyse PHP, JavaScript and CSS files. As the PHPCompatibility sniffs only target PHP code, you can make the run slightly faster by telling PHP_CodeSniffer to only check PHP files, like so:
All code within the PHPCompatibility organisation is released under the GNU Lesser General Public License (LGPL). For more information, visit https://www.gnu.org/copyleft/lesser.html
92
85
93
86
94
87
## Changelog
95
88
89
+
### 2.0.0 - 2018-10-07
90
+
91
+
- Ruleset: Updated for compatibility with PHPCompatibility 9.0+.
92
+
- Composer: Added dependency for a dedicated polyfill-based PHPCompatibility ruleset.
93
+
- CI: Added a test for the ruleset.
94
+
- Readme: Removed the installation instructions for a non-Composer based install.
95
+
96
96
### 1.0.0 - 2018-07-17
97
97
98
98
Initial release of the PHPCompatibilityWP ruleset.
Copy file name to clipboardExpand all lines: composer.json
+7-3Lines changed: 7 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
{
2
2
"name" : "phpcompatibility/phpcompatibility-wp",
3
-
"description" : "A set of sniffs for PHP_CodeSniffer that checks for PHP version compatibility for WordPress projects.",
3
+
"description" : "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.",
0 commit comments