Skip to content

Commit 167459a

Browse files
committed
Update CS rules
1 parent ba216be commit 167459a

6 files changed

Lines changed: 24 additions & 15 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"data-values/data-values": "~0.1|~1.0"
2828
},
2929
"require-dev": {
30-
"squizlabs/php_codesniffer": "~2.1",
30+
"squizlabs/php_codesniffer": "~2.3",
3131
"phpmd/phpmd": "~2.3"
3232
},
3333
"autoload": {

phpcs.xml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
</rule>
4141

4242
<rule ref="Generic.NamingConventions" />
43-
<!-- TODO: create variation of this sniff that allows underscores in test methods -->
4443
<rule ref="Generic.NamingConventions.CamelCapsFunctionName.ScopeNotCamelCaps">
4544
<severity>0</severity>
4645
</rule>
@@ -73,12 +72,22 @@
7372
<rule ref="Squiz.Functions.FunctionDuplicateArgument" />
7473
<rule ref="Squiz.Functions.GlobalFunction" />
7574
<rule ref="Squiz.Scope" />
75+
76+
77+
<rule ref="Squiz.Strings.DoubleQuoteUsage" />
78+
<rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar">
79+
<severity>0</severity>
80+
</rule>
81+
7682
<rule ref="Squiz.WhiteSpace.CastSpacing" />
7783
<rule ref="Squiz.WhiteSpace.LanguageConstructSpacing" />
7884
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing" />
7985

80-
<!-- https://github.com/squizlabs/PHP_CodeSniffer/issues/348 -->
81-
<!--<rule ref="Squiz.WhiteSpace.OperatorSpacing" />-->
86+
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
87+
<properties>
88+
<property name="ignoreNewlines" value="true" />
89+
</properties>
90+
</rule>
8291

8392
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace" />
8493
<rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing" />

phpmd.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
xsi:noNamespaceSchemaLocation=" http://pmd.sf.net/ruleset_xml_schema.xsd">
66

77
<rule ref="rulesets/codesize.xml">
8-
<exclude name="TooManyMethods" />
98
<exclude name="ExcessiveClassComplexity" />
109
</rule>
11-
<rule ref="rulesets/codesize.xml/TooManyMethods">
10+
11+
<rule ref="rulesets/controversial.xml">
12+
<exclude name="CamelCaseMethodName" />
13+
</rule>
14+
<rule ref="rulesets/controversial.xml/CamelCaseMethodName">
1215
<properties>
13-
<property name="maxmethods" value="20" />
16+
<property name="allow-underscore-test" value="true" />
1417
</properties>
1518
</rule>
1619

17-
<!-- todo: exclude the camel case method rule for the tests -->
18-
<rule ref="rulesets/controversial.xml" />
19-
2020
<rule ref="rulesets/design.xml" />
2121

2222
<rule ref="rulesets/naming.xml">

tests/unit/Entity/ItemTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,10 @@ public function testSetClaims() {
221221
$statements = array( $statement0, $statement1 );
222222

223223
$item->setClaims( new Claims( $statements ) );
224-
$this->assertEquals( count( $statements ), $item->getStatements()->count(), "added some statements" );
224+
$this->assertEquals( count( $statements ), $item->getStatements()->count(), 'added some statements' );
225225

226226
$item->setClaims( new Claims() );
227-
$this->assertTrue( $item->getStatements()->isEmpty(), "should be empty again" );
227+
$this->assertTrue( $item->getStatements()->isEmpty(), 'should be empty again' );
228228
}
229229

230230

tests/unit/Entity/PropertyTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,10 @@ public function testSetClaims() {
244244
$statements = array( $statement0, $statement1 );
245245

246246
$property->setClaims( new Claims( $statements ) );
247-
$this->assertEquals( count( $statements ), $property->getStatements()->count(), "added some statements" );
247+
$this->assertEquals( count( $statements ), $property->getStatements()->count(), 'added some statements' );
248248

249249
$property->setClaims( new Claims() );
250-
$this->assertTrue( $property->getStatements()->isEmpty(), "should be empty again" );
250+
$this->assertTrue( $property->getStatements()->isEmpty(), 'should be empty again' );
251251
}
252252

253253
}

tests/unit/Statement/StatementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ public function testGetAllSnaks( Statement $statement ) {
279279
$c += count( $reference->getSnaks() );
280280
}
281281

282-
$this->assertGreaterThanOrEqual( $c, count( $snaks ), "At least one snak per Qualifier and Reference" );
282+
$this->assertGreaterThanOrEqual( $c, count( $snaks ), 'At least one snak per Qualifier and Reference' );
283283
}
284284

285285
public function testGivenNonStatement_equalsReturnsFalse() {

0 commit comments

Comments
 (0)