Skip to content

Commit ec3945a

Browse files
committed
Squiz/ClosingDeclarationComment: add support for enums
1 parent 6cbb7f7 commit ec3945a

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/Standards/Squiz/Sniffs/Commenting/ClosingDeclarationCommentSniff.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function register()
2727
T_FUNCTION,
2828
T_CLASS,
2929
T_INTERFACE,
30+
T_ENUM,
3031
];
3132

3233
}//end register()
@@ -69,8 +70,10 @@ public function process(File $phpcsFile, $stackPtr)
6970
$comment = '//end '.$decName.'()';
7071
} else if ($tokens[$stackPtr]['code'] === T_CLASS) {
7172
$comment = '//end class';
72-
} else {
73+
} else if ($tokens[$stackPtr]['code'] === T_INTERFACE) {
7374
$comment = '//end interface';
75+
} else {
76+
$comment = '//end enum';
7477
}//end if
7578

7679
if (isset($tokens[$stackPtr]['scope_closer']) === false) {

src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.inc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,8 @@ class TestClass
7979
}
8080
//end class
8181

82-
?>
82+
enum MissingClosingComment {
83+
}
84+
85+
enum HasClosingComment {
86+
}//end enum

src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public function getErrorList()
3434
63 => 1,
3535
67 => 1,
3636
79 => 1,
37+
83 => 1,
3738
];
3839

3940
}//end getErrorList()

0 commit comments

Comments
 (0)