Skip to content

Commit 4eeb22f

Browse files
committed
SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration: Fixed false positives for constants
1 parent d4175d8 commit 4eeb22f

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

SlevomatCodingStandard/Sniffs/Commenting/InlineDocCommentDeclarationSniff.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use const T_CLOSURE;
2020
use const T_COALESCE_EQUAL;
2121
use const T_COMMENT;
22+
use const T_CONST;
2223
use const T_DOC_COMMENT_OPEN_TAG;
2324
use const T_EQUAL;
2425
use const T_FN;
@@ -85,7 +86,11 @@ public function process(File $phpcsFile, $commentOpenPointer): void
8586
);
8687
} while (true);
8788

88-
if (in_array($tokens[$pointerAfterCommentClosePointer]['code'], [T_PRIVATE, T_PROTECTED, T_PUBLIC, T_READONLY], true)) {
89+
if (in_array(
90+
$tokens[$pointerAfterCommentClosePointer]['code'],
91+
[T_PRIVATE, T_PROTECTED, T_PUBLIC, T_READONLY, T_CONST],
92+
true
93+
)) {
8994
return;
9095
}
9196

tests/Sniffs/Commenting/data/noInvalidInlineDocCommentDeclarations.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<?php // lint >= 8.1
22

3+
/**
4+
* @var string
5+
*/
6+
const BOO = 'boo';
7+
38
class Foo
49
{
510

0 commit comments

Comments
 (0)