Skip to content

Commit

Permalink
WIP | Add new rules to Core ruleset based on Make post
Browse files Browse the repository at this point in the history
Related:
* `Universal.Namespaces.OneDeclarationPerFile` - upstream Extra WordPress#6
* `Universal.Namespaces.DisallowCurlyBraceSyntax` - upstream Extra WordPress#4
* `Universal.Namespaces.DisallowDeclarationWithoutName` - upstream Extra WordPress#50

* `Universal.UseStatements.NoLeadingBackslash` - upstream Extra WordPress#46
* `Universal.UseStatements.LowercaseFunctionConst` - upstream Extra WordPress#58

* `Universal.Constants.LowercaseClassResolutionKeyword` - upstream Extra WordPress#72

* `Generic.WhiteSpace.IncrementDecrementSpacing` - issue WordPress#1511, upstream PHPCS WordPress#2172, WordPress#2174
* `Universal.Operators.DisallowStandalonePostIncrementDecrement` - upstream Extra WordPress#65

* `Universal.Constants.UppercaseMagicConstants` - upstream Extra WordPress#64
  • Loading branch information
jrfnl committed May 15, 2022
1 parent 03547c8 commit 3e2e527
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions WordPress-Core/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,49 @@
<rule ref="WordPress.PHP.DontExtract"/>


<!--
HANDBOOK NEEDS ADJUSTING
-->
<!-- Covers rule: There should be only one namespace declaration per file. -->
<rule ref="Universal.Namespaces.OneDeclarationPerFile"/>

<!-- Covers rules:
Namespace declaration using the curly brace block syntax are not allowed.
Namespace declarations without name (= explicit global namespace) are not allowed.
(as those can only be created using the curly brace block syntax).
-->
<rule ref="Universal.Namespaces.DisallowCurlyBraceSyntax"/>

<!-- Covers rule: Namespace declarations without name (= explicit global namespace) are not allowed. -->
<rule ref="Universal.Namespaces.DisallowDeclarationWithoutName"/>


<!-- Covers rule: Names in an import use statement should not start with a leading backslash. -->
<rule ref="Universal.UseStatements.NoLeadingBackslash"/>

<!-- Covers rule: The use, function, const and as keywords should be lowercase.
This is partially already covered via Generic.PHP.LowerCaseKeyword
-->
<rule ref="Universal.UseStatements.LowercaseFunctionConst"/>



<!-- Covers rule: The "::class" keyword for classname resolution must be in lowercase. -->
<rule ref="Universal.Constants.LowercaseClassResolutionKeyword"/>


<!-- Covers rule: There should be no space between an increment/decrement operator and the variable it applies to. -->
<rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/>

<!-- Covers rule: Pre-increment/decrement should be favoured over post-increment/decrement for stand-alone statements. -->
<rule ref="Universal.Operators.DisallowStandalonePostIncrementDecrement">
<type>warning</type>
</rule>

<!-- Covers rule: The PHP native __...__ magic constants should be in uppercase when used. -->
<rule ref="Universal.Constants.UppercaseMagicConstants"/>


<!--
#############################################################################
Not in the handbook: Generic sniffs.
Expand Down

0 comments on commit 3e2e527

Please sign in to comment.