Skip to content

Commit 0064786

Browse files
echernyavskiykukulich
authored andcommitted
Add a test for multiple annotations (@link, @todo) in method documentation.
1 parent 15f251a commit 0064786

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

tests/Sniffs/Commenting/DocCommentSpacingSniffTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function testDefaultSettingsErrors(): void
3535
{
3636
$report = self::checkFile(__DIR__ . '/data/docCommentSpacingDefaultSettingsErrors.php');
3737

38-
self::assertSame(7, $report->getErrorCount());
38+
self::assertSame(9, $report->getErrorCount());
3939

4040
self::assertSniffError($report, 5, DocCommentSpacingSniff::CODE_INCORRECT_LINES_COUNT_BEFORE_FIRST_CONTENT);
4141
self::assertSniffError($report, 26, DocCommentSpacingSniff::CODE_INCORRECT_LINES_COUNT_BEFORE_FIRST_CONTENT);
@@ -44,6 +44,8 @@ public function testDefaultSettingsErrors(): void
4444
self::assertSniffError($report, 30, DocCommentSpacingSniff::CODE_INCORRECT_LINES_COUNT_BETWEEN_DESCRIPTION_AND_ANNOTATIONS);
4545

4646
self::assertSniffError($report, 42, DocCommentSpacingSniff::CODE_INCORRECT_LINES_COUNT_BETWEEN_DIFFERENT_ANNOTATIONS_TYPES);
47+
self::assertSniffError($report, 56, DocCommentSpacingSniff::CODE_INCORRECT_LINES_COUNT_BETWEEN_DIFFERENT_ANNOTATIONS_TYPES);
48+
self::assertSniffError($report, 58, DocCommentSpacingSniff::CODE_INCORRECT_LINES_COUNT_BETWEEN_DIFFERENT_ANNOTATIONS_TYPES);
4749

4850
self::assertSniffError($report, 9, DocCommentSpacingSniff::CODE_INCORRECT_LINES_COUNT_AFTER_LAST_CONTENT);
4951
self::assertSniffError($report, 42, DocCommentSpacingSniff::CODE_INCORRECT_LINES_COUNT_AFTER_LAST_CONTENT);

tests/Sniffs/Commenting/data/docCommentSpacingDefaultSettingsErrors.fixed.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,16 @@ public function method()
3939

4040
}
4141

42+
/**
43+
* Another method.
44+
*
45+
* @link https://github.com/slevomat/coding-standard
46+
* @todo Make things happen.
47+
* @link https://github.com/slevomat/coding-standard
48+
*/
49+
public function anotherMethod()
50+
{
51+
52+
}
53+
4254
}

tests/Sniffs/Commenting/data/docCommentSpacingDefaultSettingsErrors.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,18 @@ public function method()
4848

4949
}
5050

51+
/**
52+
* Another method.
53+
*
54+
* @link https://github.com/slevomat/coding-standard
55+
*
56+
* @todo Make things happen.
57+
*
58+
* @link https://github.com/slevomat/coding-standard
59+
*/
60+
public function anotherMethod()
61+
{
62+
63+
}
64+
5165
}

0 commit comments

Comments
 (0)