Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure "SlevomatCodingStandard.Commenting.AnnotationName" rule #311

Merged
merged 1 commit into from
Apr 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/Doctrine/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@
<rule ref="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming"/>
<!-- Forbid suffix "Trait" for traits -->
<rule ref="SlevomatCodingStandard.Classes.SuperfluousTraitNaming"/>
<!-- Forbid invalid annotation names in standard PHPDoc tags -->
<rule ref="SlevomatCodingStandard.Commenting.AnnotationName"/>
<!-- Require specific order of phpDoc annotations with empty newline between specific groups -->
<rule ref="SlevomatCodingStandard.Commenting.DocCommentSpacing">
<properties>
Expand Down
7 changes: 4 additions & 3 deletions tests/expected_report.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ PHP CODE SNIFFER REPORT SUMMARY
----------------------------------------------------------------------
FILE ERRORS WARNINGS
----------------------------------------------------------------------
tests/input/annotation-name.php 8 0
tests/input/array_indentation.php 10 0
tests/input/arrow-functions-format.php 10 0
tests/input/assignment-operators.php 4 0
tests/input/attributes.php 15 0
tests/input/binary_operators.php 9 0
tests/input/class-references.php 10 0
tests/input/class-references.php 10 2
tests/input/ClassPropertySpacing.php 2 0
tests/input/concatenation_spacing.php 49 0
tests/input/constants-no-lsb.php 2 0
Expand Down Expand Up @@ -52,9 +53,9 @@ tests/input/use-ordering.php 1 0
tests/input/useless-semicolon.php 2 0
tests/input/UselessConditions.php 21 0
----------------------------------------------------------------------
A TOTAL OF 453 ERRORS AND 0 WARNINGS WERE FOUND IN 48 FILES
A TOTAL OF 461 ERRORS AND 2 WARNINGS WERE FOUND IN 49 FILES
----------------------------------------------------------------------
PHPCBF CAN FIX 375 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
PHPCBF CAN FIX 377 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


29 changes: 29 additions & 0 deletions tests/fixed/annotation-name.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

interface Foo
{
/**
* This method does something
*/
public function doSomething(array $options): void;

/**
* This method does not perform any action
*/
public function nothing(): void;
}

final class Bar implements Foo
{
/** @inheritDoc */
public function doSomething(array $options): void
{
}

/** {@inheritDoc} */
public function nothing(): void
{
}
}
29 changes: 29 additions & 0 deletions tests/input/annotation-name.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

interface Foo
{
/**
* This method does something
*/
public function doSomething(array $options): void;

/**
* This method does not perform any action
*/
public function nothing(): void;
}

final class Bar implements Foo
{
/** @inheritdoc */
public function doSomething(array $options): void
{
}

/** {@inheritdoc} */
public function nothing(): void
{
}
}
12 changes: 6 additions & 6 deletions tests/php72-compatibility.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ diff --git a/tests/expected_report.txt b/tests/expected_report.txt
index 1773423..f6e6841 100644
--- a/tests/expected_report.txt
+++ b/tests/expected_report.txt
@@ -16,26 +16,23 @@ tests/input/constants-var.php 6 0
@@ -17,26 +17,23 @@
tests/input/ControlStructures.php 28 0
tests/input/doc-comment-spacing.php 11 0
tests/input/duplicate-assignment-variable.php 1 0
Expand Down Expand Up @@ -37,7 +37,7 @@ index 1773423..f6e6841 100644
tests/input/semicolon_spacing.php 3 0
tests/input/single-line-array-spacing.php 5 0
tests/input/spread-operator.php 6 0
@@ -44,17 +41,16 @@ tests/input/strings.php 3 0
@@ -45,17 +42,16 @@
tests/input/superfluous-naming.php 11 0
tests/input/test-case.php 8 0
tests/input/trailing_comma_on_array.php 1 0
Expand All @@ -51,11 +51,11 @@ index 1773423..f6e6841 100644
-tests/input/UselessConditions.php 21 0
+tests/input/UselessConditions.php 20 0
----------------------------------------------------------------------
-A TOTAL OF 453 ERRORS AND 0 WARNINGS WERE FOUND IN 48 FILES
+A TOTAL OF 406 ERRORS AND 0 WARNINGS WERE FOUND IN 44 FILES
-A TOTAL OF 461 ERRORS AND 2 WARNINGS WERE FOUND IN 49 FILES
+A TOTAL OF 414 ERRORS AND 2 WARNINGS WERE FOUND IN 45 FILES
----------------------------------------------------------------------
-PHPCBF CAN FIX 375 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 328 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
-PHPCBF CAN FIX 377 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 330 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


Expand Down
12 changes: 6 additions & 6 deletions tests/php73-compatibility.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ diff --git a/tests/expected_report.txt b/tests/expected_report.txt
index 1773423..0ea80d5 100644
--- a/tests/expected_report.txt
+++ b/tests/expected_report.txt
@@ -16,26 +16,23 @@ tests/input/constants-var.php 6 0
@@ -17,26 +17,23 @@
tests/input/ControlStructures.php 28 0
tests/input/doc-comment-spacing.php 11 0
tests/input/duplicate-assignment-variable.php 1 0
Expand Down Expand Up @@ -37,7 +37,7 @@ index 1773423..0ea80d5 100644
tests/input/semicolon_spacing.php 3 0
tests/input/single-line-array-spacing.php 5 0
tests/input/spread-operator.php 6 0
@@ -44,17 +41,17 @@ tests/input/strings.php 3 0
@@ -45,17 +42,17 @@
tests/input/superfluous-naming.php 11 0
tests/input/test-case.php 8 0
tests/input/trailing_comma_on_array.php 1 0
Expand All @@ -52,11 +52,11 @@ index 1773423..0ea80d5 100644
-tests/input/UselessConditions.php 21 0
+tests/input/UselessConditions.php 20 0
----------------------------------------------------------------------
-A TOTAL OF 453 ERRORS AND 0 WARNINGS WERE FOUND IN 48 FILES
+A TOTAL OF 408 ERRORS AND 0 WARNINGS WERE FOUND IN 45 FILES
-A TOTAL OF 461 ERRORS AND 2 WARNINGS WERE FOUND IN 49 FILES
+A TOTAL OF 416 ERRORS AND 2 WARNINGS WERE FOUND IN 46 FILES
----------------------------------------------------------------------
-PHPCBF CAN FIX 375 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 330 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
-PHPCBF CAN FIX 377 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 332 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


Expand Down
12 changes: 6 additions & 6 deletions tests/php74-compatibility.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ diff --git a/tests/expected_report.txt b/tests/expected_report.txt
index 1773423..9422a54 100644
--- a/tests/expected_report.txt
+++ b/tests/expected_report.txt
@@ -16,26 +16,23 @@ tests/input/constants-var.php 6 0
@@ -17,26 +17,23 @@
tests/input/ControlStructures.php 28 0
tests/input/doc-comment-spacing.php 11 0
tests/input/duplicate-assignment-variable.php 1 0
Expand Down Expand Up @@ -35,7 +35,7 @@ index 1773423..9422a54 100644
tests/input/semicolon_spacing.php 3 0
tests/input/single-line-array-spacing.php 5 0
tests/input/spread-operator.php 6 0
@@ -44,17 +41,17 @@ tests/input/strings.php 3 0
@@ -45,17 +42,17 @@
tests/input/superfluous-naming.php 11 0
tests/input/test-case.php 8 0
tests/input/trailing_comma_on_array.php 1 0
Expand All @@ -50,11 +50,11 @@ index 1773423..9422a54 100644
-tests/input/UselessConditions.php 21 0
+tests/input/UselessConditions.php 20 0
----------------------------------------------------------------------
-A TOTAL OF 453 ERRORS AND 0 WARNINGS WERE FOUND IN 48 FILES
+A TOTAL OF 417 ERRORS AND 0 WARNINGS WERE FOUND IN 45 FILES
-A TOTAL OF 461 ERRORS AND 2 WARNINGS WERE FOUND IN 49 FILES
+A TOTAL OF 425 ERRORS AND 2 WARNINGS WERE FOUND IN 46 FILES
----------------------------------------------------------------------
-PHPCBF CAN FIX 375 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 339 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
-PHPCBF CAN FIX 377 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 341 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


Expand Down
14 changes: 7 additions & 7 deletions tests/php80-compatibility.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ diff --git a/tests/expected_report.txt b/tests/expected_report.txt
index 1773423..449da88 100644
--- a/tests/expected_report.txt
+++ b/tests/expected_report.txt
@@ -18,7 +18,6 @@ tests/input/doc-comment-spacing.php 11 0
@@ -19,7 +19,6 @@
tests/input/duplicate-assignment-variable.php 1 0
tests/input/EarlyReturn.php 7 0
tests/input/example-class.php 47 0
-tests/input/ExampleBackedEnum.php 3 0
tests/input/Exceptions.php 1 0
tests/input/forbidden-comments.php 14 0
tests/input/forbidden-functions.php 6 0
@@ -33,7 +32,7 @@ tests/input/null_coalesce_equal_operator.php 5 0
@@ -34,7 +33,7 @@
tests/input/null_coalesce_operator.php 3 0
tests/input/null_safe_operator.php 1 0
tests/input/optimized-functions.php 1 0
Expand All @@ -19,15 +19,15 @@ index 1773423..449da88 100644
tests/input/return_type_on_closures.php 26 0
tests/input/return_type_on_methods.php 22 0
tests/input/semicolon_spacing.php 3 0
@@ -52,9 +51,9 @@ tests/input/use-ordering.php 1 0
@@ -53,9 +52,9 @@
tests/input/useless-semicolon.php 2 0
tests/input/UselessConditions.php 21 0
----------------------------------------------------------------------
-A TOTAL OF 453 ERRORS AND 0 WARNINGS WERE FOUND IN 48 FILES
+A TOTAL OF 447 ERRORS AND 0 WARNINGS WERE FOUND IN 47 FILES
-A TOTAL OF 461 ERRORS AND 2 WARNINGS WERE FOUND IN 49 FILES
+A TOTAL OF 455 ERRORS AND 2 WARNINGS WERE FOUND IN 48 FILES
----------------------------------------------------------------------
-PHPCBF CAN FIX 375 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 369 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
-PHPCBF CAN FIX 377 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 371 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


Expand Down