Skip to content

Commit 005f430

Browse files
committed
Merge pull request #571 from wmde/functionSpacing
Add and fix PHPCS FunctionSpacing rule
2 parents 0708ccc + e6e36ce commit 005f430

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

phpcs.xml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
<rule ref="Generic.Files.ByteOrderMark" />
1212
<rule ref="Generic.Files.EndFileNewline" />
13+
<rule ref="Generic.Files.InlineHTML" />
1314
<rule ref="Generic.Files.LineEndings" />
1415
<rule ref="Generic.Files.LineLength">
1516
<properties>
@@ -18,6 +19,8 @@
1819
</properties>
1920
</rule>
2021
<rule ref="Generic.Files.OneClassPerFile" />
22+
<rule ref="Generic.Files.OneInterfacePerFile" />
23+
<rule ref="Generic.Files.OneTraitPerFile" />
2124

2225
<rule ref="Generic.Formatting.DisallowMultipleStatements" />
2326

@@ -41,7 +44,8 @@
4144

4245
<rule ref="Generic.NamingConventions" />
4346
<rule ref="Generic.NamingConventions.CamelCapsFunctionName.ScopeNotCamelCaps">
44-
<severity>0</severity>
47+
<!-- Exclude test methods like "testGivenInvalidInput_methodThrowsException". -->
48+
<exclude-pattern>tests.unit*Test\.php</exclude-pattern>
4549
</rule>
4650

4751
<rule ref="Generic.PHP.CharacterBeforePHPOpeningTag" />
@@ -57,11 +61,13 @@
5761

5862
<rule ref="PSR1" />
5963
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
60-
<severity>0</severity>
64+
<!-- Exclude test methods like "testGivenInvalidInput_methodThrowsException". -->
65+
<exclude-pattern>tests.unit*Test\.php</exclude-pattern>
6166
</rule>
6267

6368
<rule ref="PSR2.Classes.PropertyDeclaration" />
6469
<rule ref="PSR2.ControlStructures.ElseIfDeclaration" />
70+
<rule ref="PSR2.Files" />
6571
<rule ref="PSR2.Namespaces" />
6672

6773
<rule ref="Squiz.Arrays.ArrayBracketSpacing" />
@@ -73,7 +79,6 @@
7379
<rule ref="Squiz.Functions.GlobalFunction" />
7480
<rule ref="Squiz.Scope" />
7581

76-
7782
<rule ref="Squiz.Strings.DoubleQuoteUsage" />
7883
<rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar">
7984
<severity>0</severity>
@@ -82,13 +87,16 @@
8287
<rule ref="Squiz.WhiteSpace.CastSpacing" />
8388
<rule ref="Squiz.WhiteSpace.LanguageConstructSpacing" />
8489
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing" />
85-
90+
<rule ref="Squiz.WhiteSpace.FunctionSpacing">
91+
<properties>
92+
<property name="spacing" value="1" />
93+
</properties>
94+
</rule>
8695
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
8796
<properties>
8897
<property name="ignoreNewlines" value="true" />
8998
</properties>
9099
</rule>
91-
92100
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace" />
93101
<rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing" />
94102
<rule ref="Squiz.WhiteSpace.SemicolonSpacing" />

tests/unit/Entity/EntityTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,6 @@ public function testSerialize( Entity $entity ) {
398398
$this->assertEquals( $entity->getId(), $instance->getId() );
399399
}
400400

401-
402401
/**
403402
* @dataProvider instanceProvider
404403
* @param Entity $entity

tests/unit/Entity/ItemTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ public function testSetClaims() {
233233
$this->assertTrue( $item->getStatements()->isEmpty(), 'should be empty again' );
234234
}
235235

236-
237236
public function testEmptyItemReturnsEmptySiteLinkList() {
238237
$item = new Item();
239238
$this->assertTrue( $item->getSiteLinkList()->isEmpty() );

0 commit comments

Comments
 (0)