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
Copy file name to clipboardexpand all lines: CHANGELOG.md
+145
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,150 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a
8
8
9
9
_No documentation available about unreleased changes as of yet._
10
10
11
+
## [2.0.0-RC1] - 2018-12-31
12
+
13
+
### Important information about this release:
14
+
15
+
This is the first release candidate for WordPressCS 2.0.0.
16
+
WordPressCS 2.0.0 contains breaking changes, both for people using custom rulesets as well as for sniff developers who maintain a custom PHPCS standard based on WordPressCS.
17
+
18
+
Support for `PHP_CodeSniffer` 2.x has been dropped, the new minimum `PHP_CodeSniffer` version is 3.3.1.
19
+
Also, all previously deprecated sniffs, properties and methods have been removed.
20
+
21
+
Please read the complete changelog carefully before you upgrade.
22
+
23
+
If you are a maintainer of an external standard based on WordPressCS and any of your custom sniffs are based on or extend WPCS sniffs, please read the [Developers Upgrade Guide to WordPressCS 2.0.0](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Upgrade-Guide-to-WordPressCS-2.0.0-for-Developers-of-external-standards).
24
+
25
+
### Added
26
+
-`Generic.PHP.DiscourageGoto`, `Generic.PHP.LowerCaseType`, `Generic.WhiteSpace.ArbitraryParenthesesSpacing` and `PSR12.Keywords.ShortFormTypeKeywords` to the `WordPress-Core` ruleset.
27
+
- Checking the spacing around the `instanceof` operator to the `WordPress.WhiteSpace.OperatorSpacing` sniff.
28
+
29
+
### Changed
30
+
- The minimum required `PHP_CodeSniffer` version to 3.3.1 (was 2.9.0).
31
+
- The namespace used by WordPressCS has been changed from `WordPress` to `WordPressCS\WordPress`.
32
+
This was not possible while `PHP_CodeSniffer` 2.x was still supported, but WordPressCS, as a good Open Source citizen, does not want to occupy the `WordPress` namespace and is releasing its use of it now this is viable.
33
+
- The `WordPress.DB.PreparedSQL` sniff used the same error code for two different errors.
34
+
The `NotPrepared` error code remains, however an additional `InterpolatedNotPrepared` error code has been added for the second error.
35
+
If you are referencing the old error code in a ruleset XML file or in inline annotations, you may need to update it.
36
+
- The `WordPress.NamingConventions.PrefixAllGlobals` sniff used the same error code for some errors as well as warnings.
37
+
The `NonPrefixedConstantFound` error code remains for the related error, but the warning will now use the new `VariableConstantNameFound` error code.
38
+
The `NonPrefixedHooknameFound` error code remains for the related error, but the warning will now use the new `DynamicHooknameFound` error code.
39
+
If you are referencing the old error codes in a ruleset XML file or in inline annotations, you may need to update these to use the new codes instead.
40
+
-`WordPress.NamingConventions.ValidVariableName`: the error messages and error codes used by this sniff have been changed for improved usability and consistency.
41
+
- The error messages will now show a suggestion for a valid alternative name for the variable.
42
+
- The `NotSnakeCaseMemberVar` error code has been renamed to `UsedPropertyNotSnakeCase`.
43
+
- The `NotSnakeCase` error code has been renamed to `VariableNotSnakeCase`.
44
+
- The `MemberNotSnakeCase` error code has been renamed to `PropertyNotSnakeCase`.
45
+
- The `StringNotSnakeCase` error code has been renamed to `InterpolatedVariableNotSnakeCase`.
46
+
If you are referencing the old error codes in a ruleset XML file or in inline annotations, you may need to update these to use the new codes instead.
47
+
- The `WordPress.Security.NonceVerification` sniff used the same error code for both an error as well as a warning.
48
+
The old error code `NoNonceVerification` is no longer used.
49
+
The `error` now uses the `Missing` error code, while the `warning` now uses the `Recommended` error code.
50
+
If you are referencing the old error code in a ruleset XML file or in inline annotations, please update these to use the new codes instead.
51
+
- The `WordPress.WP.DiscouragedConstants` sniff used to have two error codes `UsageFound` and `DeclarationFound`.
52
+
These error codes will now be prefixed by the name of the constant found to allow for more fine-grained excluding/ignoring of warnings generated by this sniff.
53
+
If you are referencing the old error codes in a ruleset XML file or in inline annotations, you may need to update these to use the new codes instead.
54
+
- The `WordPress.WP.GlobalVariablesOverride.OverrideProhibited` error code has been replaced by the `WordPress.WP.GlobalVariablesOverride.Prohibited` error code.
55
+
If you are referencing the old error code in a ruleset XML file or in inline annotations, you may need to update it.
56
+
-`WordPress-Extra`: Replaced the inclusion of the `Generic.Files.OneClassPerFile`, `Generic.Files.OneInterfacePerFile` and the `Generic.Files.OneTraitPerFile` sniffs with the new `Generic.Files.OneObjectStructurePerFile` sniff.
57
+
-`WordPress-Extra`: Replaced the inclusion of the `Squiz.WhiteSpace.LanguageConstructSpacing` sniff with the new `Generic.WhiteSpace.LanguageConstructSpacing` sniff.
58
+
-`WordPress-Extra`: Replaced the inclusion of the `Squiz.Scope.MemberVarScope` sniff with the more comprehensive `PSR2.Classes.PropertyDeclaration` sniff.
59
+
-`WordPress.NamingConventions.ValidFunctionName`: Added a unit test confirming support for interfaces extending multiple interfaces.
60
+
-`WordPress.NamingConventions.ValidVariableName`: Added unit tests confirming support for multi-variable/property declarations.
61
+
- The `get_name_suggestion()` method has been moved from the `WordPress.NamingConventions.ValidFunctionName` sniff to the base `Sniff` class, renamed to `get_snake_case_name_suggestion()` and made static.
62
+
- The rulesets are now validated against the `PHP_CodeSniffer` XSD schema.
63
+
- Updated the [custom ruleset example](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/develop/phpcs.xml.dist.sample) to use the recommended ruleset syntax for `PHP_CodeSniffer` 3.3.1+, including using the new [array property format](https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/3.3.0) which is now supported.
64
+
- Dev: The command to run the unit tests has changed. Please see the updated instructions in the [CONTRIBUTING.md](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/develop/.github/CONTRIBUTING.md) file.
65
+
The `bin/pre-commit` example git hook has been updated to match. Additionally a `run-tests` script has been added to the `composer.json` file for your convenience.
66
+
To facilitate this, PHPUnit has been added to `require-dev`, even though it is strictly speaking a dependency of PHPCS, not of WPCS.
67
+
- Dev: The DealerDirect PHPCS Composer plugin has been added to `require-dev`.
68
+
- Various code tweaks and clean up.
69
+
- User facing documentation, including the wiki, as well as inline documentation has been updated for all the changes contained in WordPressCS 2.0 and other recommended best practices for `PHP_CodeSniffer` 3.3.1+.
70
+
71
+
### Deprecated
72
+
- The use of the [WordPressCS native whitelist comments](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Whitelisting-code-which-flags-errors), which were introduced in WPCS 0.4.0, have been deprecated and support will be removed in WPCS 3.0.0.
73
+
The WordPressCS native whitelist comments will continue to work for now, but a deprecation warning will be thrown when they are encountered.
74
+
You are encouraged to upgrade our whitelist comment to use the [PHPCS native selective ignore annotations}(https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/3.2.0) as introduced in `PHP_CodeSniffer` 3.2.0, as soon as possible.
75
+
76
+
### Removed
77
+
- Support for PHP 5.3. PHP 5.4 is the minimum requirement for `PHP_CodeSniffer` 3.x.
78
+
Includes removing any and all workarounds which were in place to still support PHP 5.3.
79
+
- Support for `PHP_CodeSniffer` < 3.3.1.
80
+
Includes removing any and all workarounds which were in place for supporting older `PHP_CodeSniffer` versions.
81
+
- The `WordPress-VIP` standard which was deprecated since WordPressCS 1.0.0.
82
+
For checking a theme/plugin for hosting on the WordPress.com VIP platform, please use the [Automattic VIP coding standards](https://github.com/Automattic/VIP-Coding-Standards) instead.
83
+
- Support for array properties set in a custom ruleset without the `type="array"` attribute.
84
+
Support for this was deprecated in WPCS 1.0.0.
85
+
If in doubt about how properties should be set in your custom ruleset, please refer to the [Customizable sniff properties](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties) wiki page which contains XML code examples for setting each and every WPCS native sniff property.
86
+
As the minimum `PHP_CodeSniffer` version is now 3.3.1, you can now also use the [new format for setting array properties](https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/3.3.0), so this would be a great moment to review and update your custom ruleset.
87
+
Note: the ability to set select properties from the command-line as comma-delimited strings is _not_ affected by this change.
88
+
- The following sniffs have been removed outright without deprecation.
89
+
If you are referencing these sniffs in a ruleset XML file or in inline annotations, please update these to reference the replacement sniffs instead.
90
+
-`WordPress.Functions.FunctionCallSignatureNoParams` - superseded by a bug fix in the upstream `PEAR.Functions.FunctionCallSignature` sniff.
91
+
-`WordPress.PHP.DiscourageGoto` - replaced by the same sniff which is now available upstream: `Generic.PHP.DiscourageGoto`.
92
+
-`WordPress.WhiteSpace.SemicolonSpacing` - superseded by a bug fix in the upstream `Squiz.WhiteSpace.SemicolonSpacing` sniff.
93
+
-`WordPress.WhiteSpace.ArbitraryParenthesesSpacing` - replaced by the same sniff which is now available upstream: `Generic.WhiteSpace.ArbitraryParenthesesSpacing`.
94
+
- The following "base" sniffs which were previously already deprecated and turned into abstract base classes, have been removed:
95
+
-`WordPress.Arrays.ArrayAssignmentRestrictions` - use the `AbstractArrayAssignmentRestrictionsSniff` class instead.
96
+
-`WordPress.Functions.FunctionRestrictions` - use the `AbstractFunctionRestrictionsSniff` class instead.
97
+
-`WordPress.Variables.VariableRestrictions` without replacement.
98
+
- The following sniffs which were previously deprecated, have been removed:
99
+
-`WordPress.Arrays.ArrayDeclaration` - use the other sniffs in the `WordPress.Arrays` category instead.
100
+
-`WordPress.CSRF.NonceVerification` - use `WordPress.Security.NonceVerification` instead.
101
+
-`WordPress.Functions.DontExtract` - use `WordPress.PHP.DontExtract` instead.
102
+
-`WordPress.Variables.GlobalVariables` - use `WordPress.WP.GlobalVariablesOverride` instead.
103
+
-`WordPress.VIP.CronInterval` - use `WordPress.WP.CronInterval` instead.
104
+
-`WordPress.VIP.DirectDatabaseQuery` - use `WordPress.DB.DirectDatabaseQuery` instead.
105
+
-`WordPress.VIP.PluginMenuSlug` - use `WordPress.Security.PluginMenuSlug` instead.
106
+
-`WordPress.VIP.SlowDBQuery` - use `WordPress.DB.SlowDBQuery` instead.
107
+
-`WordPress.VIP.TimezoneChange` - use `WordPress.WP.TimezoneChange` instead.
108
+
-`WordPress.VIP.ValidatedSanitizedInput` - use `WordPress.Security.ValidatedSanitizedInput` instead.
109
+
-`WordPress.WP.PreparedSQL` - use `WordPress.DB.PreparedSQL` instead.
110
+
-`WordPress.XSS.EscapeOutput` - use `WordPress.Security.EscapeOutput` instead.
111
+
-`WordPress.PHP.DiscouragedFunctions` without direct replacement.
112
+
The checks previously contained in this sniff were moved to separate sniffs in WPCS 0.11.0.
113
+
-`WordPress.Variables.VariableRestrictions` without replacement.
114
+
-`WordPress.VIP.AdminBarRemoval` without replacement.
115
+
-`WordPress.VIP.FileSystemWritesDisallow` without replacement.
116
+
-`WordPress.VIP.OrderByRand` without replacement.
117
+
-`WordPress.VIP.PostsPerPage` without replacement.
118
+
Part of the previous functionality was split off in WPCS 1.0.0 to the `WordPress.WP.PostsPerPage` sniff.
119
+
-`WordPress.VIP.RestrictedFunctions` without replacement.
120
+
-`WordPress.VIP.RestrictedVariables` without replacement.
121
+
-`WordPress.VIP.SessionFunctionsUsage` without replacement.
122
+
-`WordPress.VIP.SessionVariableUsage` without replacement.
123
+
-`WordPress.VIP.SuperGlobalInputUsage` without replacement.
124
+
- The `WordPress.DB.SlowDBQuery.DeprecatedWhitelistFlagFound` error code which is superseded by the blanket deprecation warning for using the now deprecated WPCS native whitelist comments.
125
+
- The `WordPress.PHP.TypeCasts.NonLowercaseFound` error code which has been replaced by the upstream `Generic.PHP.LowerCaseType` sniff.
126
+
- The `WordPress.PHP.TypeCasts.LongBoolFound` and `WordPress.PHP.TypeCasts.LongIntFound` error codes which has been replaced by the new upstream `PSR12.Keywords.ShortFormTypeKeywords` sniff.
127
+
- The `WordPress.Security.EscapeOutput.OutputNotEscapedShortEcho` error code which was only ever used if WPCS was run on PHP 5.3 with the `short_open_tag` ini directive set to `off`.
128
+
- The following sniff categories which were previously deprecated, have been removed, though select categories may be reinstated in the future:
129
+
-`CSRF`
130
+
-`Functions`
131
+
-`Variables`
132
+
-`VIP`
133
+
-`XSS`
134
+
-`WordPress.NamingConventions.ValidVariableName`: The `customVariableWhitelist` property, which had been deprecated since WordPressCS 0.11.0. Use the `customPropertiesWhitelist` property instead.
135
+
-`WordPress.Security.EscapeOutput`: The `customSanitizingFunctions` property, which had been deprecated since WordPressCS 0.5.0. Use the `customEscapingFunctions` property instead.
136
+
-`WordPress.Security.NonceVerification`: The `errorForSuperGlobals` and `warnForSuperGlobals` properties, which had been deprecated since WordPressCS 0.12.0.
137
+
- The `vip_powered_wpcom` function from the `Sniff::$autoEscapedFunctions` list which is used by the `WordPress.Security.EscapeOutput` sniff.
138
+
- The `AbstractVariableRestrictionsSniff` class, which was deprecated since WordPressCS 1.0.0.
139
+
- The `Sniff::has_html_open_tag()` utility method, which was deprecated since WordPressCS 1.0.0.
140
+
- The internal `$php_reserved_vars` property from the `WordPress.NamingConventions.ValidVariableName` sniff in favour of using a PHPCS native property which is now available.
141
+
- The class aliases and WPCS native autoloader used for PHPCS cross-version support.
142
+
- The unit test framework workarounds for PHPCS cross-version unit testing.
143
+
- Support for the `@codingStandardsChangeSetting` annotation, which is generally only used in unit tests.
144
+
- The old generic GitHub issue template which was replaced by more specific issue templates in WPCS 1.2.0.
145
+
146
+
### Fixed
147
+
- Support for PHP 7.3.
148
+
`PHP_CodeSniffer` < 3.3.1 was not fully compatible with PHP 7.3. Now the minimum required PHPCS has been upped to `PHP_CodeSniffer` 3.3.1, WordPressCS will run on PHP 7.3 without issue.
149
+
-`WordPress.Arrays.ArrayDeclarationSpacing`: improved fixing of the placement of array items following an array item with a trailing multi-line comment.
150
+
-`WordPress.NamingConventions.ValidFunctionName`: the sniff will no longer throw false positives nor duplicate errors for methods declared in nested anonymous classes.
151
+
The error message has also been improved for methods in anonymous classes.
152
+
-`WordPress.NamingConventions.ValidFunctionName`: the sniff will no longer throw false positives for PHP 4-style class constructors/destructors where the name of the constructor/destructor method did not use the same case as the class name.
153
+
154
+
11
155
## [1.2.1] - 2018-12-18
12
156
13
157
Note: This will be the last release supporting PHP_CodeSniffer 2.x.
@@ -826,6 +970,7 @@ See the comparison for full list.
0 commit comments