Skip to content

Commit 4b26a2e

Browse files
committed
Configure "SlevomatCodingStandard.Commenting.AnnotationName" rule
1 parent c86a025 commit 4b26a2e

File tree

8 files changed

+89
-28
lines changed

8 files changed

+89
-28
lines changed

lib/Doctrine/ruleset.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@
181181
<rule ref="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming"/>
182182
<!-- Forbid suffix "Trait" for traits -->
183183
<rule ref="SlevomatCodingStandard.Classes.SuperfluousTraitNaming"/>
184+
<!-- Forbid invalid annotation names in standard PHPDoc tags -->
185+
<rule ref="SlevomatCodingStandard.Commenting.AnnotationName"/>
184186
<!-- Require specific order of phpDoc annotations with empty newline between specific groups -->
185187
<rule ref="SlevomatCodingStandard.Commenting.DocCommentSpacing">
186188
<properties>

tests/expected_report.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ PHP CODE SNIFFER REPORT SUMMARY
33
----------------------------------------------------------------------
44
FILE ERRORS WARNINGS
55
----------------------------------------------------------------------
6+
tests/input/annotation-name.php 8 0
67
tests/input/array_indentation.php 10 0
78
tests/input/arrow-functions-format.php 10 0
89
tests/input/assignment-operators.php 4 0
910
tests/input/attributes.php 15 0
1011
tests/input/binary_operators.php 9 0
11-
tests/input/class-references.php 10 0
12+
tests/input/class-references.php 10 2
1213
tests/input/ClassPropertySpacing.php 2 0
1314
tests/input/concatenation_spacing.php 49 0
1415
tests/input/constants-no-lsb.php 2 0
@@ -52,9 +53,9 @@ tests/input/use-ordering.php 1 0
5253
tests/input/useless-semicolon.php 2 0
5354
tests/input/UselessConditions.php 21 0
5455
----------------------------------------------------------------------
55-
A TOTAL OF 453 ERRORS AND 0 WARNINGS WERE FOUND IN 48 FILES
56+
A TOTAL OF 461 ERRORS AND 2 WARNINGS WERE FOUND IN 49 FILES
5657
----------------------------------------------------------------------
57-
PHPCBF CAN FIX 375 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
58+
PHPCBF CAN FIX 377 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
5859
----------------------------------------------------------------------
5960

6061

tests/fixed/annotation-name.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
interface Foo
6+
{
7+
/**
8+
* This method does something
9+
*/
10+
public function doSomething(array $options): void;
11+
12+
/**
13+
* This method does not perform any action
14+
*/
15+
public function nothing(): void;
16+
}
17+
18+
final class Bar implements Foo
19+
{
20+
/** @inheritDoc */
21+
public function doSomething(array $options): void
22+
{
23+
}
24+
25+
/** {@inheritDoc} */
26+
public function nothing(): void
27+
{
28+
}
29+
}

tests/input/annotation-name.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
interface Foo
6+
{
7+
/**
8+
* This method does something
9+
*/
10+
public function doSomething(array $options): void;
11+
12+
/**
13+
* This method does not perform any action
14+
*/
15+
public function nothing(): void;
16+
}
17+
18+
final class Bar implements Foo
19+
{
20+
/** @inheritdoc */
21+
public function doSomething(array $options): void
22+
{
23+
}
24+
25+
/** {@inheritdoc} */
26+
public function nothing(): void
27+
{
28+
}
29+
}

tests/php72-compatibility.patch

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ diff --git a/tests/expected_report.txt b/tests/expected_report.txt
22
index 1773423..f6e6841 100644
33
--- a/tests/expected_report.txt
44
+++ b/tests/expected_report.txt
5-
@@ -16,26 +16,23 @@ tests/input/constants-var.php 6 0
5+
@@ -17,26 +17,23 @@
66
tests/input/ControlStructures.php 28 0
77
tests/input/doc-comment-spacing.php 11 0
88
tests/input/duplicate-assignment-variable.php 1 0
@@ -37,7 +37,7 @@ index 1773423..f6e6841 100644
3737
tests/input/semicolon_spacing.php 3 0
3838
tests/input/single-line-array-spacing.php 5 0
3939
tests/input/spread-operator.php 6 0
40-
@@ -44,17 +41,16 @@ tests/input/strings.php 3 0
40+
@@ -45,17 +42,16 @@
4141
tests/input/superfluous-naming.php 11 0
4242
tests/input/test-case.php 8 0
4343
tests/input/trailing_comma_on_array.php 1 0
@@ -51,11 +51,11 @@ index 1773423..f6e6841 100644
5151
-tests/input/UselessConditions.php 21 0
5252
+tests/input/UselessConditions.php 20 0
5353
----------------------------------------------------------------------
54-
-A TOTAL OF 453 ERRORS AND 0 WARNINGS WERE FOUND IN 48 FILES
55-
+A TOTAL OF 406 ERRORS AND 0 WARNINGS WERE FOUND IN 44 FILES
54+
-A TOTAL OF 461 ERRORS AND 2 WARNINGS WERE FOUND IN 49 FILES
55+
+A TOTAL OF 414 ERRORS AND 2 WARNINGS WERE FOUND IN 45 FILES
5656
----------------------------------------------------------------------
57-
-PHPCBF CAN FIX 375 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
58-
+PHPCBF CAN FIX 328 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
57+
-PHPCBF CAN FIX 377 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
58+
+PHPCBF CAN FIX 330 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
5959
----------------------------------------------------------------------
6060

6161

tests/php73-compatibility.patch

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ diff --git a/tests/expected_report.txt b/tests/expected_report.txt
22
index 1773423..0ea80d5 100644
33
--- a/tests/expected_report.txt
44
+++ b/tests/expected_report.txt
5-
@@ -16,26 +16,23 @@ tests/input/constants-var.php 6 0
5+
@@ -17,26 +17,23 @@
66
tests/input/ControlStructures.php 28 0
77
tests/input/doc-comment-spacing.php 11 0
88
tests/input/duplicate-assignment-variable.php 1 0
@@ -37,7 +37,7 @@ index 1773423..0ea80d5 100644
3737
tests/input/semicolon_spacing.php 3 0
3838
tests/input/single-line-array-spacing.php 5 0
3939
tests/input/spread-operator.php 6 0
40-
@@ -44,17 +41,17 @@ tests/input/strings.php 3 0
40+
@@ -45,17 +42,17 @@
4141
tests/input/superfluous-naming.php 11 0
4242
tests/input/test-case.php 8 0
4343
tests/input/trailing_comma_on_array.php 1 0
@@ -52,11 +52,11 @@ index 1773423..0ea80d5 100644
5252
-tests/input/UselessConditions.php 21 0
5353
+tests/input/UselessConditions.php 20 0
5454
----------------------------------------------------------------------
55-
-A TOTAL OF 453 ERRORS AND 0 WARNINGS WERE FOUND IN 48 FILES
56-
+A TOTAL OF 408 ERRORS AND 0 WARNINGS WERE FOUND IN 45 FILES
55+
-A TOTAL OF 461 ERRORS AND 2 WARNINGS WERE FOUND IN 49 FILES
56+
+A TOTAL OF 416 ERRORS AND 2 WARNINGS WERE FOUND IN 46 FILES
5757
----------------------------------------------------------------------
58-
-PHPCBF CAN FIX 375 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
59-
+PHPCBF CAN FIX 330 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
58+
-PHPCBF CAN FIX 377 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
59+
+PHPCBF CAN FIX 332 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
6060
----------------------------------------------------------------------
6161

6262

tests/php74-compatibility.patch

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ diff --git a/tests/expected_report.txt b/tests/expected_report.txt
22
index 1773423..9422a54 100644
33
--- a/tests/expected_report.txt
44
+++ b/tests/expected_report.txt
5-
@@ -16,26 +16,23 @@ tests/input/constants-var.php 6 0
5+
@@ -17,26 +17,23 @@
66
tests/input/ControlStructures.php 28 0
77
tests/input/doc-comment-spacing.php 11 0
88
tests/input/duplicate-assignment-variable.php 1 0
@@ -35,7 +35,7 @@ index 1773423..9422a54 100644
3535
tests/input/semicolon_spacing.php 3 0
3636
tests/input/single-line-array-spacing.php 5 0
3737
tests/input/spread-operator.php 6 0
38-
@@ -44,17 +41,17 @@ tests/input/strings.php 3 0
38+
@@ -45,17 +42,17 @@
3939
tests/input/superfluous-naming.php 11 0
4040
tests/input/test-case.php 8 0
4141
tests/input/trailing_comma_on_array.php 1 0
@@ -50,11 +50,11 @@ index 1773423..9422a54 100644
5050
-tests/input/UselessConditions.php 21 0
5151
+tests/input/UselessConditions.php 20 0
5252
----------------------------------------------------------------------
53-
-A TOTAL OF 453 ERRORS AND 0 WARNINGS WERE FOUND IN 48 FILES
54-
+A TOTAL OF 417 ERRORS AND 0 WARNINGS WERE FOUND IN 45 FILES
53+
-A TOTAL OF 461 ERRORS AND 2 WARNINGS WERE FOUND IN 49 FILES
54+
+A TOTAL OF 425 ERRORS AND 2 WARNINGS WERE FOUND IN 46 FILES
5555
----------------------------------------------------------------------
56-
-PHPCBF CAN FIX 375 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
57-
+PHPCBF CAN FIX 339 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
56+
-PHPCBF CAN FIX 377 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
57+
+PHPCBF CAN FIX 341 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
5858
----------------------------------------------------------------------
5959

6060

tests/php80-compatibility.patch

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ diff --git a/tests/expected_report.txt b/tests/expected_report.txt
22
index 1773423..449da88 100644
33
--- a/tests/expected_report.txt
44
+++ b/tests/expected_report.txt
5-
@@ -18,7 +18,6 @@ tests/input/doc-comment-spacing.php 11 0
5+
@@ -19,7 +19,6 @@
66
tests/input/duplicate-assignment-variable.php 1 0
77
tests/input/EarlyReturn.php 7 0
88
tests/input/example-class.php 47 0
99
-tests/input/ExampleBackedEnum.php 3 0
1010
tests/input/Exceptions.php 1 0
1111
tests/input/forbidden-comments.php 14 0
1212
tests/input/forbidden-functions.php 6 0
13-
@@ -33,7 +32,7 @@ tests/input/null_coalesce_equal_operator.php 5 0
13+
@@ -34,7 +33,7 @@
1414
tests/input/null_coalesce_operator.php 3 0
1515
tests/input/null_safe_operator.php 1 0
1616
tests/input/optimized-functions.php 1 0
@@ -19,15 +19,15 @@ index 1773423..449da88 100644
1919
tests/input/return_type_on_closures.php 26 0
2020
tests/input/return_type_on_methods.php 22 0
2121
tests/input/semicolon_spacing.php 3 0
22-
@@ -52,9 +51,9 @@ tests/input/use-ordering.php 1 0
22+
@@ -53,9 +52,9 @@
2323
tests/input/useless-semicolon.php 2 0
2424
tests/input/UselessConditions.php 21 0
2525
----------------------------------------------------------------------
26-
-A TOTAL OF 453 ERRORS AND 0 WARNINGS WERE FOUND IN 48 FILES
27-
+A TOTAL OF 447 ERRORS AND 0 WARNINGS WERE FOUND IN 47 FILES
26+
-A TOTAL OF 461 ERRORS AND 2 WARNINGS WERE FOUND IN 49 FILES
27+
+A TOTAL OF 455 ERRORS AND 2 WARNINGS WERE FOUND IN 48 FILES
2828
----------------------------------------------------------------------
29-
-PHPCBF CAN FIX 375 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
30-
+PHPCBF CAN FIX 369 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
29+
-PHPCBF CAN FIX 377 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
30+
+PHPCBF CAN FIX 371 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
3131
----------------------------------------------------------------------
3232

3333

0 commit comments

Comments
 (0)