Skip to content

Commit ea955a2

Browse files
authored
Merge pull request #32 from peckadesign/method-spaces
Sniff hlídá počet nových řádků mezi metodami tříd
2 parents 432f688 + be4db26 commit ea955a2

File tree

5 files changed

+47
-1
lines changed

5 files changed

+47
-1
lines changed

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ test:
55
./vendor/bin/phpcs --standard=src/PeckaCodingStandard/ruleset.xml tests/Failure/Classes/ClassConstantVisibility.php | tests/errorNumber.sh 1
66
./vendor/bin/phpcs --standard=src/PeckaCodingStandard/ruleset.xml tests/Failure/Classes/UnusedPrivateElements.php | tests/errorNumber.sh 2
77
./vendor/bin/phpcs --standard=src/PeckaCodingStandard/ruleset.xml tests/Failure/Classes/PropertySpacing.php | tests/errorNumber.sh 2
8+
./vendor/bin/phpcs --standard=src/PeckaCodingStandard/ruleset.xml tests/Failure/Classes/MethodSpacingSniff.php | tests/errorNumber.sh 2
89
./vendor/bin/phpcs --standard=src/PeckaCodingStandard/ruleset.xml tests/Failure/Files/LineEndings.php | tests/errorNumber.sh 1
910
./vendor/bin/phpcs --standard=src/PeckaCodingStandard/ruleset.xml tests/Failure/Namespaces/UnusedUses.php | tests/errorNumber.sh 1
1011
./vendor/bin/phpcs --standard=src/PeckaCodingStandard/ruleset.xml tests/Failure/Formatting/SpaceAfterCast.php | tests/errorNumber.sh 2

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"require": {
55
"php": "7.*",
66
"squizlabs/php_codesniffer": "3.*",
7-
"slevomat/coding-standard": "6.1.*",
7+
"slevomat/coding-standard": "6.3.*",
88
"escapestudios/symfony2-coding-standard": "3.*"
99
},
1010
"license": "MIT",

src/PeckaCodingStandard/ruleset.xml

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
<property name="maxLinesCountBeforeWithoutComment" value="1"/>
2020
</properties>
2121
</rule>
22+
<rule ref="SlevomatCodingStandard.Classes.MethodSpacing">
23+
<properties>
24+
<property name="minLinesCount" value="2"/>
25+
<property name="maxLinesCount" value="2"/>
26+
</properties>
27+
</rule>
2228

2329
<!-- Exceptions -->
2430
<rule ref="SlevomatCodingStandard.Exceptions.DeadCatch"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PdTests\Failure\Classes;
4+
5+
class MethodSpacingSniff
6+
{
7+
8+
public function hello(): void
9+
{
10+
}
11+
12+
public function hello2(): void
13+
{
14+
}
15+
16+
17+
18+
public function hello3(): void
19+
{
20+
}
21+
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PdTests\Success\Classes;
4+
5+
class MethodSpacingSniff
6+
{
7+
8+
public function hello(): void
9+
{
10+
}
11+
12+
13+
public function hello2(): void
14+
{
15+
}
16+
17+
}

0 commit comments

Comments
 (0)