Skip to content

Commit 8814a3a

Browse files
committed
* Updated to newer version of wp-coding-standards/wpcs.
* Updated to newer version of `squizlabs/php_codesniffer`. * Added support for PHP7+. * Added new excludes which are too WordPressy.
1 parent e150a7f commit 8814a3a

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## 0.2.0 (NOT RELEASED)
44
* Removed `Generic.PHP.LowerCaseConstant`, because we're going to use PSR standards.
5+
* Updated to newer version of `wp-coding-standards/wpcs`.
6+
* Updated to newer version of `squizlabs/php_codesniffer`.
7+
* Added support for PHP7+.
8+
* Added new excludes which are too WordPressy.
59

610
## 0.1.0
711
* First release.

Inpsyde/ruleset.xml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33

44
<description>A custom set of code standard rules to check for Inpsyde Codex.</description>
55

6+
<!-- Check for cross-version support for PHP 7.0 and higher. -->
7+
<config name="testVersion" value="7.0-"/>
8+
9+
<rule ref="PHPCompatibility">
10+
<!-- With PHP 7 or higher, these keywords actually are valid function names. https://github.com/wimg/PHPCompatibility/issues/515 -->
11+
<exclude name="PHPCompatibility.PHP.ForbiddenNamesAsInvokedFunctions"/>
12+
</rule>
13+
614
<!-- Allow . in hook names -->
715
<rule ref="WordPress.NamingConventions.ValidHookName">
816
<properties>
@@ -15,6 +23,7 @@
1523

1624
<exclude name="WordPress.PHP.YodaConditions"/>
1725

26+
<!-- Exclude to be able to adhere to PSR-4. -->
1827
<exclude name="WordPress.Files.FileName"/>
1928

2029
<exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect"/>
@@ -39,15 +48,33 @@
3948
<exclude name="Squiz.Commenting.BlockComment.HasEmptyLineBefore"/>
4049
<!-- Remove rule for /** style for each var -->
4150
<exclude name="Squiz.Commenting.VariableComment.WrongStyle"/>
51+
<!-- Exclude to be able to include an encoding cookie. -->
52+
<exclude name="Squiz.Commenting.FileComment.WrongStyle"/>
53+
<exclude name="Squiz.Commenting.InlineComment.WrongStyle"/>
54+
55+
<!-- Exclude to be able to use variadic arguments. https://github.com/squizlabs/PHP_CodeSniffer/issues/1652 -->
56+
<exclude name="Squiz.Commenting.FunctionComment.IncorrectTypeHint"/>
57+
58+
<!-- Exclude to be able to use "@noinspection PhpUnusedParameterInspection" annotations. -->
59+
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint"/>
4260

43-
<!-- <exclude name="WordPress.XSS.EscapeOutput" /> -->
4461
<exclude name="WordPress.WhiteSpace.ScopeIndent.Incorrect"/>
4562
<exclude name="WordPress.Arrays.ArrayKeySpacingRestrictions"/>
4663
<exclude name="WordPress.Arrays.ArrayDeclaration.KeyNotAligned"/>
4764
<!-- Remove spaces instead of tabs check -->
4865
<exclude name="WordPress.Arrays.ArrayDeclaration.ValueNotAligned"/>
4966
<exclude name="WordPress.Arrays.ArrayDeclaration.CloseBraceNotAligned"/>
50-
<!-- <exclude name="WordPress.Variables.GlobalVariables" /> -->
67+
68+
<!-- Exclude to not be forced to use a space before return type colons. https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/547. -->
69+
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterCloseParenthesis"/>
70+
71+
</rule>
72+
73+
<!-- Adapt to be able to use namespaced hooks in dot notation. -->
74+
<rule ref="WordPress.NamingConventions.ValidHookName">
75+
<properties>
76+
<property name="additionalWordDelimiters" value="."/>
77+
</properties>
5178
</rule>
5279

5380
</ruleset>

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"license": "MIT",
1010
"require": {
11-
"squizlabs/php_codesniffer": "^2.9.0",
12-
"wp-coding-standards/wpcs": "~0.11"
11+
"squizlabs/php_codesniffer": "^3.0",
12+
"wp-coding-standards/wpcs": "^0.13.1"
1313
}
1414
}

0 commit comments

Comments
 (0)