Skip to content

Commit 246955c

Browse files
QWp6tretlehs
authored andcommitted
Use phpcs.xml for all rules
1 parent c5f3724 commit 246955c

File tree

4 files changed

+45
-48
lines changed

4 files changed

+45
-48
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,4 @@ install:
4444
script:
4545
- npm run build
4646
- phpcs --report=summary
47-
- phpcs --report=summary --standard=phpcs-templates.xml -n
4847
- phpmd src text cleancode,codesize,controversial,design,naming,unusedcode

phpcs-templates.xml

Lines changed: 0 additions & 43 deletions
This file was deleted.

phpcs.xml

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
<description>Roots Coding Standards</description>
44

55
<!-- Scan these files -->
6-
<file>functions.php</file>
7-
<file>src</file>
6+
<file>templates</file>
7+
<file>functions.php</file>
8+
<file>src</file>
89

910
<!-- Show colors in console -->
1011
<arg value="-colors"/>
@@ -14,7 +15,47 @@
1415

1516
<!-- Use PSR-2 as a base -->
1617
<rule ref="PSR2">
17-
<!-- Allow braces on same line for procedural functions -->
18+
<!-- Allow braces on same line for named functions -->
1819
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine"/>
1920
</rule>
21+
22+
<!-- Allow closing braces to be on the same line -->
23+
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace">
24+
<exclude-pattern>templates</exclude-pattern>
25+
</rule>
26+
27+
<!-- Disable newline after opening brace -->
28+
<rule ref="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace">
29+
<exclude-pattern>templates</exclude-pattern>
30+
</rule>
31+
32+
<!-- Allow multiple PHP statements in the same line -->
33+
<rule ref="Generic.Formatting.DisallowMultipleStatements.SameLine">
34+
<exclude-pattern>templates</exclude-pattern>
35+
</rule>
36+
37+
<!-- Disable PSR-2 indentation rules that are buggy with 2 spaces -->
38+
<rule ref="PSR2.ControlStructures.SwitchDeclaration.BreakIndent">
39+
<exclude-pattern>templates</exclude-pattern>
40+
</rule>
41+
42+
<!-- Don't require a blank line after the last `use` -->
43+
<rule ref="PSR2.Namespaces.UseDeclaration.SpaceAfterLastUse">
44+
<exclude-pattern>templates</exclude-pattern>
45+
</rule>
46+
47+
<!-- Allow long lines -->
48+
<rule ref="Generic.Files.LineLength.TooLong">
49+
<exclude-pattern>templates</exclude-pattern>
50+
</rule>
51+
52+
<!-- Ignore indentation rules -->
53+
<rule ref="Generic.WhiteSpace.ScopeIndent">
54+
<exclude-pattern>templates</exclude-pattern>
55+
</rule>
56+
57+
<!-- Allow PHP closing tags -->
58+
<rule ref="PSR2.Files.ClosingTag.NotAllowed">
59+
<exclude-pattern>templates</exclude-pattern>
60+
</rule>
2061
</ruleset>

src/filters.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @link https://codex.wordpress.org/Conditional_Tags
99
*/
1010
add_filter('sage/display_sidebar', function ($display) {
11-
// The sidebar will NOT be displayed if ANY of the following return true
11+
// The sidebar will NOT be displayed if ANY of the following return true
1212
return $display ? !in_array(true, [
1313
is_404(),
1414
is_front_page(),

0 commit comments

Comments
 (0)