Skip to content

Commit 380e17b

Browse files
committed
Squiz/DocCommentAlignment: add support for enums
1 parent ec3945a commit 380e17b

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ public function process(File $phpcsFile, $stackPtr)
6464
$ignore = [
6565
T_CLASS => true,
6666
T_INTERFACE => true,
67+
T_ENUM => true,
68+
T_ENUM_CASE => true,
6769
T_FUNCTION => true,
6870
T_PUBLIC => true,
6971
T_PRIVATE => true,

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@ abstract class MyClass
8585
readonly public string $prop;
8686
}
8787

88+
/**
89+
* Some info about the enum here
90+
*
91+
*/
92+
enum Suits: string
93+
{
94+
/**
95+
* Some info about the case here.
96+
*/
97+
case HEARTS;
98+
}
99+
88100
/** ************************************************************************
89101
* Example with no errors.
90102
**************************************************************************/

src/Standards/Squiz/Tests/Commenting/DocCommentAlignmentUnitTest.inc.fixed

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@ abstract class MyClass
8585
readonly public string $prop;
8686
}
8787

88+
/**
89+
* Some info about the enum here
90+
*
91+
*/
92+
enum Suits: string
93+
{
94+
/**
95+
* Some info about the case here.
96+
*/
97+
case HEARTS;
98+
}
99+
88100
/** ************************************************************************
89101
* Example with no errors.
90102
**************************************************************************/

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public function getErrorList($testFile='DocCommentAlignmentUnitTest.inc')
4747
$errors[75] = 1;
4848
$errors[83] = 1;
4949
$errors[84] = 1;
50+
$errors[90] = 1;
51+
$errors[91] = 1;
52+
$errors[95] = 1;
53+
$errors[96] = 1;
5054
}
5155

5256
return $errors;

0 commit comments

Comments
 (0)