Skip to content

Commit f15f2e4

Browse files
committed
Add tests
1 parent f928f19 commit f15f2e4

File tree

5 files changed

+94
-36
lines changed

5 files changed

+94
-36
lines changed

lib/Doctrine/ruleset.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181
<rule ref="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming"/>
182182
<!-- Forbid suffix "Trait" for traits -->
183183
<rule ref="SlevomatCodingStandard.Classes.SuperfluousTraitNaming"/>
184-
<!-- Forbid "@inheritdoc" in favor of "@inheritDoc" annotation -->
184+
<!-- Forbid invalid annotation names in standard PHPDoc tags -->
185185
<rule ref="SlevomatCodingStandard.Commenting.AnnotationName"/>
186186
<!-- Require specific order of phpDoc annotations with empty newline between specific groups -->
187187
<rule ref="SlevomatCodingStandard.Commenting.DocCommentSpacing">

tests/fixed/annotation-name.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
/** {@inheritDoc} */
24+
public function nothing(): void;
25+
}

tests/input/annotation-name.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
/** {@inheritdoc} */
24+
public function nothing(): void;
25+
}

tests/php74-compatibility.patch

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,67 @@ 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
6-
tests/input/ControlStructures.php 28 0
5+
@@ -9,31 +9,32 @@
6+
tests/input/assignment-operators.php 4 0
7+
tests/input/attributes.php 15 0
8+
tests/input/binary_operators.php 9 0
9+
-tests/input/class-references.php 10 0
10+
+tests/input/class-references.php 10 2
11+
tests/input/ClassPropertySpacing.php 2 0
12+
tests/input/concatenation_spacing.php 49 0
13+
tests/input/constants-no-lsb.php 2 0
14+
tests/input/constants-var.php 6 0
15+
-tests/input/ControlStructures.php 28 0
16+
+tests/input/ControlStructures.php 29 0
717
tests/input/doc-comment-spacing.php 11 0
818
tests/input/duplicate-assignment-variable.php 1 0
9-
-tests/input/EarlyReturn.php 7 0
10-
-tests/input/example-class.php 47 0
11-
-tests/input/ExampleBackedEnum.php 3 0
12-
-tests/input/Exceptions.php 1 0
13-
+tests/input/EarlyReturn.php 6 0
14-
+tests/input/example-class.php 44 0
19+
-tests/input/EarlyReturn.php 6 0
20+
-tests/input/example-class.php 44 0
21+
+tests/input/EarlyReturn.php 7 0
22+
+tests/input/example-class.php 47 0
1523
tests/input/forbidden-comments.php 14 0
1624
tests/input/forbidden-functions.php 6 0
1725
tests/input/inline_type_hint_assertions.php 10 0
1826
tests/input/LowCaseTypes.php 2 0
1927
tests/input/namespaces-spacing.php 7 0
20-
-tests/input/NamingCamelCase.php 9 0
21-
+tests/input/NamingCamelCase.php 6 0
28+
-tests/input/NamingCamelCase.php 6 0
29+
+tests/input/NamingCamelCase.php 9 0
2230
tests/input/negation-operator.php 2 0
2331
tests/input/new_with_parentheses.php 19 0
2432
tests/input/not_spacing.php 8 0
2533
tests/input/null_coalesce_equal_operator.php 5 0
2634
tests/input/null_coalesce_operator.php 3 0
27-
-tests/input/null_safe_operator.php 1 0
35+
+tests/input/null_safe_operator.php 1 0
2836
tests/input/optimized-functions.php 1 0
29-
-tests/input/PropertyDeclaration.php 14 0
30-
-tests/input/return_type_on_closures.php 26 0
31-
-tests/input/return_type_on_methods.php 22 0
32-
+tests/input/PropertyDeclaration.php 6 0
33-
+tests/input/return_type_on_closures.php 21 0
34-
+tests/input/return_type_on_methods.php 17 0
37+
-tests/input/PropertyDeclaration.php 6 0
38+
-tests/input/return_type_on_closures.php 21 0
39+
-tests/input/return_type_on_methods.php 17 0
40+
+tests/input/PropertyDeclaration.php 7 0
41+
+tests/input/return_type_on_closures.php 26 0
42+
+tests/input/return_type_on_methods.php 22 0
3543
tests/input/semicolon_spacing.php 3 0
3644
tests/input/single-line-array-spacing.php 5 0
3745
tests/input/spread-operator.php 6 0
38-
@@ -44,17 +41,17 @@ tests/input/strings.php 3 0
46+
@@ -42,17 +43,17 @@
3947
tests/input/superfluous-naming.php 11 0
4048
tests/input/test-case.php 8 0
4149
tests/input/trailing_comma_on_array.php 1 0
42-
-tests/input/TrailingCommaOnFunctions.php 6 0
43-
+tests/input/TrailingCommaOnFunctions.php 2 0
50+
-tests/input/TrailingCommaOnFunctions.php 2 0
51+
+tests/input/TrailingCommaOnFunctions.php 4 0
4452
tests/input/traits-uses.php 11 0
45-
-tests/input/type-hints.php 9 0
46-
+tests/input/type-hints.php 8 0
53+
-tests/input/type-hints.php 8 0
54+
+tests/input/type-hints.php 9 0
4755
tests/input/UnusedVariables.php 1 0
4856
tests/input/use-ordering.php 1 0
4957
tests/input/useless-semicolon.php 2 0
50-
-tests/input/UselessConditions.php 21 0
51-
+tests/input/UselessConditions.php 20 0
58+
-tests/input/UselessConditions.php 20 0
59+
+tests/input/UselessConditions.php 21 0
5260
----------------------------------------------------------------------
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
61+
-A TOTAL OF 417 ERRORS AND 0 WARNINGS WERE FOUND IN 45 FILES
62+
+A TOTAL OF 449 ERRORS AND 2 WARNINGS WERE FOUND IN 47 FILES
5563
----------------------------------------------------------------------
56-
-PHPCBF CAN FIX 375 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
57-
+PHPCBF CAN FIX 339 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
64+
-PHPCBF CAN FIX 339 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
65+
+PHPCBF CAN FIX 365 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
5866
----------------------------------------------------------------------
5967

6068

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)